xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Michael Abato <mrabato AT earthlink.net>
- To: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: [XOM-interest] XML Commons Resolver bug
- Date: Tue, 21 Jun 2005 17:02:54 -0400
I've run into another bug between XOM 1.1b1 and XML Commons Resolver (http://xml.apache.org/commons/components/resolver/index.html). The xml: namespace is being stripped on xml:space='preserve' attributes. Here's a simple test:
import nu.xom.*;
import java.io.IOException;
import java.io.ByteArrayInputStream;
public class TestResolver {
public static void main(String[] args) throws ParsingException, IOException {
String test = "<source xml:space='preserve'/>";
Builder defaultBuilder = new Builder();
defaultBuilder.build(new ByteArrayInputStream(test.getBytes())); // ok
Builder resolvingBuilder = new Builder(new org.apache.xml.resolver.tools.ResolvingXMLReader());
resolvingBuilder.build(new ByteArrayInputStream(test.getBytes())); // throws
}
}
This throws:
Exception in thread "main" nu.xom.ParsingException: Wrong namespace URI for xml prefix: at line 1, column -1.
at nu.xom.Builder.build(Builder.java:1117)
at nu.xom.Builder.build(Builder.java:579)
at TestResolver.main(TestResolver.java:14)
Caused by: nu.xom.NamespaceConflictException: Wrong namespace URI for xml prefix:
at nu.xom.Attribute._setNamespace(Attribute.java:475)
at nu.xom.Attribute.<init>(Attribute.java:164)
at nu.xom.NodeFactory.makeAttribute(NodeFactory.java:253)
at nu.xom.XOMHandler.startElement(XOMHandler.java:160)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:575)
at org.apache.xml.resolver.tools.ResolvingXMLFilter.startElement(Unknown Source)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1674)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:371)
at org.apache.xml.resolver.tools.ResolvingXMLFilter.parse(Unknown Source)
at nu.xom.Builder.build(Builder.java:1114)
... 2 more
I identified a similar but more drastic bug a few months ago that stripped ALL names. I'm guessing this is probably similar. Quick regression shows that the bug was introduced between 1.1a2 and 1.1.a3. It shows with both major version of the resolver, 1.0 and 1.1
I've also tested xml:lang, which throws the same exception. I couldn't find any workaround - explicitly declaring xmlns:xml=... doesn't work either.
Michael Abato
-
[XOM-interest] XML Commons Resolver bug,
Michael Abato, 06/21/2005
- Re: [XOM-interest] XML Commons Resolver bug, Elliotte Rusty Harold, 06/21/2005
-
Re: [XOM-interest] XML Commons Resolver bug,
Elliotte Harold, 06/22/2005
- Re: [XOM-interest] XML Commons Resolver bug, Michael Abato, 06/22/2005
- Re: [XOM-interest] XML Commons Resolver bug, Elliotte Harold, 06/22/2005
Archive powered by MHonArc 2.6.24.