ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AXIOM-376) Axiom should report conflicting namespace declarations
Date Sun, 13 Nov 2011 12:19:51 GMT

     [ https://issues.apache.org/jira/browse/AXIOM-376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andreas Veithen updated AXIOM-376:
----------------------------------

    Description: 
Consider the following code:

OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("urn:ns1", "p");
OMElement parent = factory.createOMElement("parent", ns);
OMElement child = factory.createOMElement("child", ns, parent);
child.declareNamespace("urn:ns2", "p");
System.out.println("XML = " + parent);
System.out.println("URI = " + child.getNamespaceURI());

Both elements are created in the urn:ns1 namespace. An attempt is made to add a namespace
declaration that binds the prefix to a different namespace. No error occurs and the output
is as follows:

XML = <p:parent xmlns:p="urn:ns1"><p:child xmlns:p="urn:ns2" /></p:parent>
URI = urn:ns1

This means that in the serialized document, the namespace of the child element is different
than in the object model. This situation (which is expected to be accidental in most cases)
will lead to subtle issues later.

Axiom should make sure that the namespaces of element and attribute information items are
always preserved and trigger an exception if this constraint is violated by a conflicting
namespace declaration.

These checks can be implemented at two levels:
* In the serializer. This is the most robust solution, but makes it more difficult to identify
the code that is responsible for the conflicting declaration (because it is only detected
later).
* In the declareNamespace and declareDefaultNamespace methods.

  was:
Consider the following code:

OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("urn:ns1", "p");
OMElement parent = factory.createOMElement("parent", ns);
OMElement child = factory.createOMElement("child", ns, parent);
child.declareNamespace("urn:ns2", "p");
System.out.println("XML = " + parent);
System.out.println("URI = " + child.getNamespaceURI());

Both elements are created in the urn:ns1 namespace. An attempt is made to add a namespace
declaration that binds the prefix to a different namespace. No error occurs and the output
is as follows:

XML = <p:parent xmlns:p="urn:ns1"><p:child xmlns:p="urn:ns2" /></p:parent>
URI = urn:ns1

This means that in the serialized document, the namespace of the child element is different
than in the object model. This situation (which is expected to be accidental in most cases)
will lead to subtle issues later.

The serializer should make sure that the namespaces of element and attribute information items
are always preserved and trigger an exception if this constraint is violated by a conflicting
namespace declaration.

        Summary: Axiom should report conflicting namespace declarations  (was: The serializer
should report conflicting namespace declarations)
    
> Axiom should report conflicting namespace declarations
> ------------------------------------------------------
>
>                 Key: AXIOM-376
>                 URL: https://issues.apache.org/jira/browse/AXIOM-376
>             Project: Axiom
>          Issue Type: Improvement
>    Affects Versions: 1.2.12
>            Reporter: Andreas Veithen
>            Assignee: Andreas Veithen
>            Priority: Minor
>             Fix For: 1.2.14
>
>
> Consider the following code:
> OMFactory factory = OMAbstractFactory.getOMFactory();
> OMNamespace ns = factory.createOMNamespace("urn:ns1", "p");
> OMElement parent = factory.createOMElement("parent", ns);
> OMElement child = factory.createOMElement("child", ns, parent);
> child.declareNamespace("urn:ns2", "p");
> System.out.println("XML = " + parent);
> System.out.println("URI = " + child.getNamespaceURI());
> Both elements are created in the urn:ns1 namespace. An attempt is made to add a namespace
declaration that binds the prefix to a different namespace. No error occurs and the output
is as follows:
> XML = <p:parent xmlns:p="urn:ns1"><p:child xmlns:p="urn:ns2" /></p:parent>
> URI = urn:ns1
> This means that in the serialized document, the namespace of the child element is different
than in the object model. This situation (which is expected to be accidental in most cases)
will lead to subtle issues later.
> Axiom should make sure that the namespaces of element and attribute information items
are always preserved and trigger an exception if this constraint is violated by a conflicting
namespace declaration.
> These checks can be implemented at two levels:
> * In the serializer. This is the most robust solution, but makes it more difficult to
identify the code that is responsible for the conflicting declaration (because it is only
detected later).
> * In the declareNamespace and declareDefaultNamespace methods.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


Mime
View raw message