ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <>
Subject [jira] [Commented] (AXIOM-441) Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation
Date Wed, 14 Nov 2012 10:52:12 GMT


Andreas Veithen commented on AXIOM-441:

The StAX specification indeed has lots of ambiguities and is of rather poor quality. At some
point I documented the ambiguities relevant for Axiom and how to handle them:

At the time I wrote that documentation, I actually came to the same conclusion as you:

[quote]An XML document may contain a namespace declaration such as xmlns="". In this case,
it is not clear if XMLStreamReader.getNamespaceURI(int) should return null or an empty string.[/quote]

Therefore the code in Axiom is expected to handle both situations, and this was indeed not
the case in StAXOMBuilder#processNamespaceData. This has been fixed now and I checked that
there are no other usages of the getNamespaceURI(int) method that have the same problem.
> Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation
> -------------------------------------------------------------------------------------------------
>                 Key: AXIOM-441
>                 URL:
>             Project: Axiom
>          Issue Type: Bug
>          Components: API, LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Assignee: Andreas Veithen
>              Labels: patch
>             Fix For: 1.2.14
>         Attachments: patch-fix-StAXOMBuilder.diff
> From:
> "The attribute value in a default namespace declaration MAY be empty. This has the same
effect, within the scope of the declaration, of there being no default namespace."
> Here is a document that demonstrates this:
> <?xml version='1.0' encoding='UTF-8'?>
> <foo xmlns=''>
>     <bar xmlns=''>value</bar>
> </foo>
> The following code snippet (slightly modified from Axiom documentation) uses Axiom to
parse a String variable xmlData:
>         InputStream in =
>                 new ByteArrayInputStream(xmlData.getBytes(Charset.forName("UTF-8")));
>         OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(in);
>         OMElement documentElement = builder.getDocumentElement();
>         documentElement.serialize(System.out);
>         System.out.println();
> When given the above XML example, an IllegalArgumentException is thrown:
> Exception in thread "main" java.lang.IllegalArgumentException: Namespace URI may not
be null
> 	at<init>(
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> This looks like a bug.
> Cheers,
> Paul.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message