[
https://issues.apache.org/jira/browse/AXIOM-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149352#comment-13149352
]
Hudson commented on AXIOM-28:
-----------------------------
Integrated in ws-axiom-trunk #690 (See
[https://builds.apache.org/job/ws-axiom-trunk/690/])
* AXIOM-28: Don't allow declareDefaultNamespace to change the namespace of
the element.
* AXIOM-376: Throw an exception if an attempt is made to use
declareDefaultNamespace to add a conflicting namespace declaration (in
particular in the case considered in AXIOM-28).
* Changed the code in the builder to bypass these checks internally (so that
they only apply when manipulating the OM tree programmatically).
* Fixed a couple of test cases that were attempting to create conflicting
namespace declarations.
veithen :
Files :
*
/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
*
/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/SAXOMBuilder.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAPBuilderHelper.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestChildReDeclaringGrandParentsDefaultNSWithPrefix.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestChildReDeclaringParentsDefaultNSWithPrefix.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestDeclareDefaultNamespace1.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestDeclareDefaultNamespaceConflict1.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestDeclareDefaultNamespaceConflict2.java
*
/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestMultipleDefaultNS.java
> OMElement.declareDefaultNamespace() declares empty namespace for child
> element.
> -------------------------------------------------------------------------------
>
> Key: AXIOM-28
> URL: https://issues.apache.org/jira/browse/AXIOM-28
> Project: Axiom
> Issue Type: Bug
> Components: LLOM
> Affects Versions: 1.2.8
> Environment: Microsoft Windows 2003 Server, Java 1.5.0_11. Axis2
> version 1.3 (uses AXIOM version 1.2.5).
> Reporter: Yechiel Mondrowitz
> Assignee: Andreas Veithen
> Fix For: 1.2.14
>
>
> When calling declareDefaultNamespace() on a parent node, AXIOM assignes a
> blank namespace on the first level's child element. So if XML is passed to
> AXIOM that looks like this:
> <outerTag>
> <innerTag>
> <node1>Hello</node1>
> <node2>Hello</node2>
> </innerTag>
> </outerTag>
> And then declareDefaultNamespace() of "http://someNamespace" is called on the
> <outerTag>, the resulting XML will be this:
> <outerTag xmlns="http://someNamespace">
> <innerTag xmlns="">
> <node1>Hello</node1>
> <node2>Hello</node2>
> </innerTag>
> </outerTag>
> Notice the xmlns="" declared in the <innerTag>. According to my
> understanding of XML namespaces, the <innerTag> and its child nodes will no
> longer belong to the parent namespace of "http://someNamespace", since it
> explicitly overrides it with an empty namespace. So <innerTag> and its child
> nodes will in fact not belong to any namespace! Here is a small program to
> illustrate:
> import org.apache.axiom.om.*;
> import org.apache.axiom.om.impl.llom.util.*;
> public class Test2 {
> public static void main(String [] args) {
> try {
> String xmlString =
> "<outerTag>" +
> "<innerTag>" +
> "<node1>Hello</node1>" +
> "<node2>Hello</node2>" +
> "</innerTag>" +
> "</outerTag>";
> OMElement elem = AXIOMUtil.stringToOM(xmlString);
> elem.declareDefaultNamespace("http://someNamespace");
> System.out.println(elem.toString());
> }
> catch(Exception e) {
> e.printStackTrace();
> }
> }
> }
> The output of this program is this (I added line breaks in the XML for easier
> readability):
> <outerTag xmlns="http://someNamespace">
> <innerTag xmlns="">
> <node1>Hello</node1>
> <node2>Hello</node2>
> </innerTag>
> </outerTag>
> As you can see, the <innerTag> was assigned xmlns="" by AXIOM.
--
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: [email protected]
For additional commands, e-mail: [email protected]