[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlrpc-user
Subject:    [jira] [Commented] (AXIOM-497) Removal of namespace declaration breaks type attribute
From:       "Unifiers Pega (JIRA)" <jira () apache ! org>
Date:       2019-05-11 10:45:00
Message-ID: JIRA.13232403.1557391028000.235412.1557571500248 () Atlassian ! JIRA
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/AXIOM-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16837810#comment-16837810 \
] 

Unifiers Pega commented on AXIOM-497:
-------------------------------------

Thank you for your email request. Your request ID is S-1054

------------------------------------------------------------
                   jira@apache.org           wrote:

                   
     [ https://issues.apache.org/jira/browse/AXIOM-497?page&#61;com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]

Andreas Veithen resolved AXIOM-497.
-----------------------------------
    Resolution: Cannot Reproduce

&gt; Removal of namespace declaration breaks type attribute
&gt; ------------------------------------------------------
&gt;
&gt;                 Key: AXIOM-497
&gt;                 URL: https://issues.apache.org/jira/browse/AXIOM-497
&gt;             Project: Axiom
&gt;          Issue Type: Bug
&gt;          Components: Core Model, OM Mixins
&gt;    Affects Versions: 1.2.13
&gt;         Environment: Weblogic 12.2.1.3 version application server
&gt;            Reporter: Unifiers Pega
&gt;            Priority: Critical
&gt;
&gt; When the following XML is converted to an OMElement, then written back out, the \
namespace prefix used by the xsi:type attribute refers to the incorrect namespace \
URI. That is because the local prefix mapping used in the type name reference is \
removed from the element that contains the type attribute during parsing. &gt; It \
appears to be caused by a null return value from the getNsBuilder method of \
AttributeCollector when it thinks the namespace declaration is redundant. &gt; \
Original XML: &gt; &lt;ns1:A xmlns:ns1&#61;&quot;urn:foo&quot;&gt;
&gt; &lt;ns1:B xmlns:ns1&#61;&quot;urn:bar&quot;&gt;
&gt; &lt;ns2:C xmlns:ns1&#61;&quot;urn:foo&quot; xmlns:ns2&#61;&quot;urn:bar&quot; \
xmlns:xsi&#61;&quot;[http://www.w3.org/2001/XMLSchema-instance]&quot; \
xsi:type&#61;&quot;ns1:TypeA&quot;/&gt; &gt; &lt;/ns1:B&gt;
&gt; &lt;/ns1:A&gt;
&gt; After conversion to OMElement, xsi:type name cannot be resolved because it is \
mapped to the wrong namespace URI: &gt; &lt;ns1:A \
xmlns:ns1&#61;&quot;urn:foo&quot;&gt; &gt; &lt;ns1:B \
xmlns:ns1&#61;&quot;urn:bar&quot;&gt; &gt; &lt;ns2:C \
xmlns:ns2&#61;&quot;urn:bar&quot; \
xmlns:xsi&#61;&quot;[http://www.w3.org/2001/XMLSchema-instance]&quot; \
xsi:type&#61;&quot;ns1:TypeA&quot;/&gt; &gt; &lt;/ns1:B&gt;
&gt; &lt;/ns1:A&gt;
&gt;   
&gt; Here&#39;s some sample code to reproduce the issue:
&gt; ```
&gt; System.out.println&#40;&quot;Before StAX \
parsing:\n&quot;&#43;xmlString&#41;&#59; &gt; try {
&gt; java.io.StringReader stringReader &#61; new \
java.io.StringReader&#40;xmlString&#41;&#59; &gt; javax.xml.stream.XMLInputFactory \
inputFactory &#61; javax.xml.stream.XMLInputFactory.newInstance&#40;&#41;&#59; &gt; \
javax.xml.stream.XMLStreamReader streamReader &#61; \
inputFactory.createXMLStreamReader&#40;stringReader&#41;&#59; &gt; \
org.apache.axiom.om.impl.builder.StAXOMBuilder builder &#61; new \
org.apache.axiom.om.impl.builder.StAXOMBuilder&#40;streamReader&#41;&#59; &gt; \
xmlString &#61; builder.getDocumentElement&#40;&#41;.toString&#40;&#41;&#59; &gt; } \
catch &#40;Exception e&#41; { &gt; System.out.println&#40;&quot;Caught exception \
&quot; &#43; e&#41;&#59; &gt; }
&gt; System.out.println&#40;&quot;After StAX parsing:\n&quot;&#43;xmlString&#41;&#59;
&gt; ```
&gt;   



--
This message was sent by Atlassian JIRA
&#40;v7.6.3#76005&#41;


> Removal of namespace declaration breaks type attribute
> ------------------------------------------------------
> 
> Key: AXIOM-497
> URL: https://issues.apache.org/jira/browse/AXIOM-497
> Project: Axiom
> Issue Type: Bug
> Components: Core Model, OM Mixins
> Affects Versions: 1.2.13
> Environment: Weblogic 12.2.1.3 version application server
> Reporter: Unifiers Pega
> Priority: Critical
> 
> When the following XML is converted to an OMElement, then written back out, the \
> namespace prefix used by the xsi:type attribute refers to the incorrect namespace \
> URI. That is because the local prefix mapping used in the type name reference is \
> removed from the element that contains the type attribute during parsing. It \
> appears to be caused by a null return value from the getNsBuilder method of \
> AttributeCollector when it thinks the namespace declaration is redundant. Original \
> XML: <ns1:A xmlns:ns1="urn:foo">
> <ns1:B xmlns:ns1="urn:bar">
> <ns2:C xmlns:ns1="urn:foo" xmlns:ns2="urn:bar" \
> xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance]" xsi:type="ns1:TypeA"/> \
> </ns1:B> </ns1:A>
> After conversion to OMElement, xsi:type name cannot be resolved because it is \
> mapped to the wrong namespace URI: <ns1:A xmlns:ns1="urn:foo">
> <ns1:B xmlns:ns1="urn:bar">
> <ns2:C xmlns:ns2="urn:bar" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance]" \
> xsi:type="ns1:TypeA"/> </ns1:B>
> </ns1:A>
> 
> Here's some sample code to reproduce the issue:
> ```
> System.out.println("Before StAX parsing:\n"+xmlString);
> try {
> java.io.StringReader stringReader = new java.io.StringReader(xmlString);
> javax.xml.stream.XMLInputFactory inputFactory = \
> javax.xml.stream.XMLInputFactory.newInstance(); javax.xml.stream.XMLStreamReader \
> streamReader = inputFactory.createXMLStreamReader(stringReader); \
> org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new \
> org.apache.axiom.om.impl.builder.StAXOMBuilder(streamReader); xmlString = \
> builder.getDocumentElement().toString(); } catch (Exception e) {
> System.out.println("Caught exception " + e);
> }
> System.out.println("After StAX parsing:\n"+xmlString);
> ```
> 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic