You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Paul Millar (JIRA)" <ji...@apache.org> on 2012/11/12 17:17:15 UTC

[jira] [Created] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Paul Millar created AXIOM-441:
---------------------------------

             Summary: Fails to parse XML with empty default namespace attribute value
                 Key: AXIOM-441
                 URL: https://issues.apache.org/jira/browse/AXIOM-441
             Project: Axiom
          Issue Type: Bug
          Components: LLOM
    Affects Versions: 1.2.13
            Reporter: Paul Millar
            Priority: Critical


From:

    http://www.w3.org/TR/2009/REC-xml-names-20091208/

"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='http://example.org/'>
    <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)

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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497078#comment-13497078 ] 

Paul Millar commented on AXIOM-441:
-----------------------------------

OK, that makes sense.

Thanks again for you help.

Paul.
                
> Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation
> -------------------------------------------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496332#comment-13496332 ] 

Paul Millar commented on AXIOM-441:
-----------------------------------

It turns out the bug is in axiom-api's StAXOMBuilder#processNamespaceData method.  The bug is that this method assumes the parser's getNamespaceURI method will always returns a non-null String.

The Oracle and Woodstox JavaDoc are clear that this method may return null.  The getNamespaceURI method in the StAX implementation that comes with Java 7 returns null for the element 'bar' in the above example.  This results in an attempt to create a namespace object with a null namespace, triggering the exception.

The patch fixes this by converting the null value to an empty String.  From the org.apache.axiom.om.impl.llom.OMElementImpl#getDefaultNamespace method, an empty String seems the expected way of expressing "outside a namespace".  A prefix of an empty String is how the default namespace is represented.  Therefore, adding a namespace declaration of an empty String URI to an empty String prefix achieves the desired result of taking the element outside of a defined namespace.

It would be good if someone with more familiarity with the code-base could double-check that this is OK.

After applying the patch, the existing tests continue to pass ("mvn clean verify") and the above XML is parsed correctly and builds the correct XML output.

NB. I've not added unit- or functional- tests for this patch as I'm not sure where such a test would fit in with the existing test infrastructure.  There doesn't seem to be existing unit tests for StAXOMBuilder and I'm not sure which of the more function-orientated tests would be the most appropriate place.

Cheers,

Paul.
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: API, LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Priority: Critical
>              Labels: patch
>         Attachments: patch-fix-StAXOMBuilder.diff
>
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496814#comment-13496814 ] 

Hudson commented on AXIOM-441:
------------------------------

Integrated in ws-axiom-trunk #1269 (See [https://builds.apache.org/job/ws-axiom-trunk/1269/])
    AXIOM-441: Fixed an IllegalArgumentException that occurs with empty default namespace attributes if the StAX implementation in OpenJDK 7 is used. Note that this XML construct is amply covered by the test suites, but right now we don't have a simple way to execute them against the OpenJDK StAX implementation. (Revision 1408984)
AXIOM-441: Added some stuff needed to run our test suites with the StAX implementation in Java 7. (Revision 1408980)

     Result = ABORTED
veithen : 
Files : 
* /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java

veithen : 
Files : 
* /webservices/commons/trunk/modules/axiom/modules/axiom-parent/pom.xml
* /webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/conformance/ConformanceTestFile.java

                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Updated] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen updated AXIOM-441:
----------------------------------

    Fix Version/s: 1.2.14
         Assignee: Andreas Veithen
    
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: API, LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Assignee: Andreas Veithen
>            Priority: Critical
>              Labels: patch
>             Fix For: 1.2.14
>
>         Attachments: patch-fix-StAXOMBuilder.diff
>
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Resolved] (AXIOM-441) Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen resolved AXIOM-441.
-----------------------------------

    Resolution: Fixed
    
> Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation
> -------------------------------------------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496196#comment-13496196 ] 

Paul Millar commented on AXIOM-441:
-----------------------------------

If it helps, I ran "mvn clean verify" on the 1.2.13 source and the build was successful.
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Priority: Critical
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496971#comment-13496971 ] 

Paul Millar commented on AXIOM-441:
-----------------------------------

Hi Andreas,

Sorry, I must confess to being increasingly confused by all this.

I was wrong when I said the JavaDoc is "clear that this method may return null".  I was mistakenly looking at the nullary getNamespaceURI.  However, this method is *not* used by the StAXOMBuilder#processNamespaceData method.  Instead, the unary getNamespaceURI(int) is used.

The Oracle JavaDoc for the getNamespaceURI(int) method:

http://docs.oracle.com/javaee/5/api/javax/xml/stream/XMLStreamReader.html#getNamespaceURI%28int%29

and Woodstox JavaDoc for this method:

http://woodstox.codehaus.org/javadoc/stax-api/1.0/javax/xml/stream/XMLStreamReader.html#getNamespaceURI%28int%29

are basically identical and say only that this method "returns the namespace uri".  There is no description of how an element with no default namespace is represented.

The problem is that Woodstox and SJSXP (used by OpenJDK 6 and OpenJDK 7) have adopting different ways of representing this situation and the JavaDoc does not make it clear which is correct.

Given there is a reference implementation, I looked at how this code-base handles the situation.  My reading of the source-code is that getNamespaceURI will return null for an element without a namespace:

http://svn.stax.codehaus.org/browse/stax/trunk/dev/src/com/bea/xml/stream/MXParser.java?hb=true#to2705

Therefore, one could argue that Woodstox is buggy for returning a non-null string in this case.

In all this, there is considerable ambiguity.  This seems to be true for other methods in XMLStreamReader (e.g., on a START_ELEMENT event for an element with no prefix, should the nullary getNamespaceURI return the default namespace or null?  The JavaDoc says it should do both)

It's not clear to me where I should report these problems but, as a standard, StAX seems to have some issues.

Thanks for committing the patch (or trying to ("Result = ABORTED" sounds ominous).  I agree that allowing Axiom test suite to run against non-Woodstox StAX implementation is a good idea.  In the absence of a StAX conformity suite, it's Axiom's best bet.

HTH,

Paul.
                
> Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation
> -------------------------------------------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496602#comment-13496602 ] 

Andreas Veithen commented on AXIOM-441:
---------------------------------------

@Paul: Where did you see the documentation/spec that clearly says that XMLStreamReader#getNamespaceURI(int) may return null?
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Work started] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on AXIOM-441 started by Andreas Veithen.

> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: API, LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Assignee: Andreas Veithen
>            Priority: Critical
>              Labels: patch
>             Fix For: 1.2.14
>
>         Attachments: patch-fix-StAXOMBuilder.diff
>
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497020#comment-13497020 ] 

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:

http://ws.apache.org/axiom/apidocs/org/apache/axiom/util/stax/dialect/StAXDialect.html

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: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Comment Edited] (AXIOM-441) Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496971#comment-13496971 ] 

Paul Millar edited comment on AXIOM-441 at 11/14/12 9:27 AM:
-------------------------------------------------------------

Hi Andreas,

Sorry, I must confess to being increasingly confused by all this.

I was wrong when I said the JavaDoc is "clear that this method may return null".  I was mistakenly looking at the nullary getNamespaceURI.  However, this method is *not* used by the StAXOMBuilder#processNamespaceData method.  Instead, the unary getNamespaceURI(int) is used.

The Oracle JavaDoc for the getNamespaceURI(int) method:

http://docs.oracle.com/javaee/5/api/javax/xml/stream/XMLStreamReader.html#getNamespaceURI%28int%29

and Woodstox JavaDoc for this method:

http://woodstox.codehaus.org/javadoc/stax-api/1.0/javax/xml/stream/XMLStreamReader.html#getNamespaceURI%28int%29

are basically identical and say only that this method "returns the namespace uri".  There is no description of how an element with no default namespace is represented.

The problem is that Woodstox and SJSXP (used by OpenJDK 6 and OpenJDK 7) have adopting different ways of representing this situation and the JavaDoc does not make it clear which is correct.

Given there is a reference implementation, I looked at how this code-base handles the situation.  My reading of the source-code is that getNamespaceURI will return null for an element without a namespace:

http://svn.stax.codehaus.org/browse/stax/trunk/dev/src/com/bea/xml/stream/MXParser.java?hb=true#to2705

Therefore, one could argue that Woodstox is buggy for returning a non-null string in this case.

In all this, there is considerable ambiguity.  This seems to be true for other methods in XMLStreamReader (e.g., on a START_ELEMENT event for an element with no prefix, should the nullary getNamespaceURI return the default namespace or null?  The JavaDoc says it should do both)

It's not clear to me where I should report these problems but, as a standard, StAX seems to have some issues.

Thanks for committing the patch (or trying to, "Result = ABORTED" sounds ominous).  I agree that allowing Axiom test suite to run against non-Woodstox StAX implementation is a good idea.  In the absence of a StAX conformity suite, it's Axiom's best bet.

HTH,

Paul.
                
      was (Author: paulmillar):
    Hi Andreas,

Sorry, I must confess to being increasingly confused by all this.

I was wrong when I said the JavaDoc is "clear that this method may return null".  I was mistakenly looking at the nullary getNamespaceURI.  However, this method is *not* used by the StAXOMBuilder#processNamespaceData method.  Instead, the unary getNamespaceURI(int) is used.

The Oracle JavaDoc for the getNamespaceURI(int) method:

http://docs.oracle.com/javaee/5/api/javax/xml/stream/XMLStreamReader.html#getNamespaceURI%28int%29

and Woodstox JavaDoc for this method:

http://woodstox.codehaus.org/javadoc/stax-api/1.0/javax/xml/stream/XMLStreamReader.html#getNamespaceURI%28int%29

are basically identical and say only that this method "returns the namespace uri".  There is no description of how an element with no default namespace is represented.

The problem is that Woodstox and SJSXP (used by OpenJDK 6 and OpenJDK 7) have adopting different ways of representing this situation and the JavaDoc does not make it clear which is correct.

Given there is a reference implementation, I looked at how this code-base handles the situation.  My reading of the source-code is that getNamespaceURI will return null for an element without a namespace:

http://svn.stax.codehaus.org/browse/stax/trunk/dev/src/com/bea/xml/stream/MXParser.java?hb=true#to2705

Therefore, one could argue that Woodstox is buggy for returning a non-null string in this case.

In all this, there is considerable ambiguity.  This seems to be true for other methods in XMLStreamReader (e.g., on a START_ELEMENT event for an element with no prefix, should the nullary getNamespaceURI return the default namespace or null?  The JavaDoc says it should do both)

It's not clear to me where I should report these problems but, as a standard, StAX seems to have some issues.

Thanks for committing the patch (or trying to ("Result = ABORTED" sounds ominous).  I agree that allowing Axiom test suite to run against non-Woodstox StAX implementation is a good idea.  In the absence of a StAX conformity suite, it's Axiom's best bet.

HTH,

Paul.
                  
> Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation
> -------------------------------------------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Updated] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Millar updated AXIOM-441:
------------------------------

    Attachment: patch-fix-StAXOMBuilder.diff

Patch against 1.2.13 to fix the bug
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: API, LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Priority: Critical
>              Labels: patch
>         Attachments: patch-fix-StAXOMBuilder.diff
>
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Updated] (AXIOM-441) Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen updated AXIOM-441:
----------------------------------

    Summary: Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation  (was: Fails to parse XML with empty default namespace attribute value)
    
> Unable to parse XML with empty default namespace attribute value with OpenJDK StAX implementation
> -------------------------------------------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13495460#comment-13495460 ] 

Andreas Veithen commented on AXIOM-441:
---------------------------------------

That case is definitely supported by Axiom. The only reason that could explain that failure would be an incompatibility between Axiom and the underlying parser. What StAX implementation are you using?
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Priority: Critical
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13496398#comment-13496398 ] 

Andreas Veithen commented on AXIOM-441:
---------------------------------------

Regarding the successful build of the 1.2.13 sources: the build always uses Woodstox; therefore an incompatibility with the StAX implementation in the JRE will not be detected.
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: API, LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Priority: Critical
>              Labels: patch
>         Attachments: patch-fix-StAXOMBuilder.diff
>
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Updated] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Millar updated AXIOM-441:
------------------------------

    Component/s: API
         Labels: patch  (was: )
    
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: API, LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Priority: Critical
>              Labels: patch
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Updated] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen updated AXIOM-441:
----------------------------------

    Priority: Major  (was: Critical)

Changing priority to major because a simple workaround is available: add Woodstox to the classpath.
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             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:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-441) Fails to parse XML with empty default namespace attribute value

Posted by "Paul Millar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIOM-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13495485#comment-13495485 ] 

Paul Millar commented on AXIOM-441:
-----------------------------------

Hi Andreas,

AFAIK, I'm using the one coming with OpenJDK 7u3 (via Debian unstable):

paul@zitpcx6184:~$ dpkg-query -S /usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar
openjdk-7-jre-headless:i386: /usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar
paul@zitpcx6184:~$ dpkg-query -W openjdk-7-jre-headless:i386
openjdk-7-jre-headless:i386     7u3-2.1.3-1

Could you verify that Axiom is able to parse the above example XML?

I haven't delved into Axiom codebase, but the stacktrace makes it look like this is a problem with Axiom --- assuming null is the correct response for 'bar' element's namespace, in this case.

Cheers,

Paul.
                
> Fails to parse XML with empty default namespace attribute value
> ---------------------------------------------------------------
>
>                 Key: AXIOM-441
>                 URL: https://issues.apache.org/jira/browse/AXIOM-441
>             Project: Axiom
>          Issue Type: Bug
>          Components: LLOM
>    Affects Versions: 1.2.13
>            Reporter: Paul Millar
>            Priority: Critical
>
> From:
>     http://www.w3.org/TR/2009/REC-xml-names-20091208/
> "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='http://example.org/'>
>     <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  org.apache.axiom.om.impl.llom.OMNamespaceImpl.<init>(OMNamespaceImpl.java:38)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.addNamespaceDeclaration(OMElementImpl.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.processNamespaceData(StAXOMBuilder.java:608)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.populateOMElement(StAXOMBuilder.java:430)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createOMElement(StAXOMBuilder.java:461)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.createNextOMElement(StAXOMBuilder.java:318)
> 	at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:709)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:121)
> 	at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
> 	at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:69)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:846)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:120)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:108)
> 	at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:127)
> 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: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org