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

List:       xerces-j-user
Subject:    Re: replaceChild namespace possible bug
From:       Neil Delima <nddelima () ca ! ibm ! com>
Date:       2005-11-11 18:33:56
Message-ID: OFE1636187.362DDF1F-ON852570B6.006562D1-852570B6.0065D8D9 () ca ! ibm ! com
[Download RAW message or body]

--=_alternative 0065D8CF852570B6_=
Content-Type: text/plain; charset="US-ASCII"

In the first case, the xmlns="" attribute is added to the new replaced 
child to undeclare the parent's namespace which is in scope.


Anurag Chakravarti <ac2491@cs.columbia.edu> wrote on 11/11/2005 08:13:30 
AM:

> Hi,
> In xerces-2 jdk 1.5
> 
> I am using replaceChild method. For some strange reason a 
> xmlns="" attribute is added to the new child if it originally did not
> have a namespace. Otherwise if originally namespace was there of the
> parent context then no such attribute is added.
> 
> CASE 1
> =======
> NODE TO BE UPDATED
> ---------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <list xmlns="urn:ietf:params:xml:ns:resource-lists" name="mfriends">
>       <entry uri="sip:bob@example.com">
>          <display-name>Bob Jones</display-name>
>       </entry>
> </list>
> 
> 
> NEW NODE
> ---------
> <?xml version="1.0" encoding="UTF-8"?>
> <list name="mfriends">
>    <entry uri="sip:bob@example.com">
>       <display-name>Bob Jones</display-name>
>    </entry>
> </list>
> 
> 
> FINAL DOCUMENT
> ---------------
> <?xml version="1.0" encoding="UTF-8"?>
> <resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists">
>    <list xmlns="" name="mfriends">
>       <entry uri="sip:bob@example.com">
>          <display-name>Bob Jones</display-name>
>       </entry>
>    </list>
> </resource-lists>
> 
> 
> CASE 2
> =======
> NODE TO BE UPDATED
> ---------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <list xmlns="urn:ietf:params:xml:ns:resource-lists" name="mfriends">
>       <entry uri="sip:bob@example.com">
>          <display-name>Bob Jones</display-name>
>       </entry>
> </list>
> 
> NEW NODE
> ---------
> <?xml version="1.0" encoding="UTF-8"?>
> <list xmlns="urn:ietf:params:xml:ns:resource-lists" name="mfriends">
>    <entry uri="sip:bob@example.com">
>       <display-name>Bob Jones</display-name>
>    </entry>
> </list>
> 
> FINAL DOCUMENT
> ---------------
> <?xml version="1.0" encoding="UTF-8"?>
> <resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists">
>    <list name="mfriends">
>       <entry uri="sip:bob@example.com">
>          <display-name>Bob Jones</display-name>
>       </entry>
>    </list>
> </resource-lists>
> 
> 
> Notice the difference in list element (xmlns="") in both the cases in
> the FINAL DOCUMENT SECTION.
> 
> What am I doing wrong?? I think this is a bug in xerces-2.
> 
> -Anurag
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 

--=_alternative 0065D8CF852570B6_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2><tt>In the first case, the xmlns=&quot;&quot; attribute
is added to the new replaced child to undeclare the parent's namespace
which is in scope.</tt></font>
<br>
<br>
<br><font size=2><tt>Anurag Chakravarti &lt;ac2491@cs.columbia.edu&gt;
wrote on 11/11/2005 08:13:30 AM:<br>
<br>
&gt; Hi,<br>
&gt; In xerces-2 jdk 1.5<br>
&gt; <br>
&gt; I am using replaceChild method. For some strange reason a <br>
&gt; xmlns=&quot;&quot; attribute is added to the new child if it originally
did not<br>
&gt; have a namespace. Otherwise if originally namespace was there of the<br>
&gt; parent context then no such attribute is added.<br>
&gt; <br>
&gt; CASE 1<br>
&gt; =======<br>
&gt; NODE TO BE UPDATED<br>
&gt; ---------------------<br>
&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&gt; &lt;list xmlns=&quot;urn:ietf:params:xml:ns:resource-lists&quot; name=&quot;mfriends&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;entry uri=&quot;sip:bob@example.com&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;display-name&gt;Bob Jones&lt;/display-name&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;/entry&gt;<br>
&gt; &lt;/list&gt;<br>
&gt; <br>
&gt; <br>
&gt; NEW NODE<br>
&gt; ---------<br>
&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&gt; &lt;list name=&quot;mfriends&quot;&gt;<br>
&gt; &nbsp; &nbsp;&lt;entry uri=&quot;sip:bob@example.com&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;display-name&gt;Bob Jones&lt;/display-name&gt;<br>
&gt; &nbsp; &nbsp;&lt;/entry&gt;<br>
&gt; &lt;/list&gt;<br>
&gt; <br>
&gt; <br>
&gt; FINAL DOCUMENT<br>
&gt; ---------------<br>
&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&gt; &lt;resource-lists xmlns=&quot;urn:ietf:params:xml:ns:resource-lists&quot;&gt;<br>
&gt; &nbsp; &nbsp;&lt;list xmlns=&quot;&quot; name=&quot;mfriends&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;entry uri=&quot;sip:bob@example.com&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;display-name&gt;Bob Jones&lt;/display-name&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;/entry&gt;<br>
&gt; &nbsp; &nbsp;&lt;/list&gt;<br>
&gt; &lt;/resource-lists&gt;<br>
&gt; <br>
&gt; <br>
&gt; CASE 2<br>
&gt; =======<br>
&gt; NODE TO BE UPDATED<br>
&gt; ---------------------<br>
&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&gt; &lt;list xmlns=&quot;urn:ietf:params:xml:ns:resource-lists&quot; name=&quot;mfriends&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;entry uri=&quot;sip:bob@example.com&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;display-name&gt;Bob Jones&lt;/display-name&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;/entry&gt;<br>
&gt; &lt;/list&gt;<br>
&gt; <br>
&gt; NEW NODE<br>
&gt; ---------<br>
&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&gt; &lt;list xmlns=&quot;urn:ietf:params:xml:ns:resource-lists&quot; name=&quot;mfriends&quot;&gt;<br>
&gt; &nbsp; &nbsp;&lt;entry uri=&quot;sip:bob@example.com&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;display-name&gt;Bob Jones&lt;/display-name&gt;<br>
&gt; &nbsp; &nbsp;&lt;/entry&gt;<br>
&gt; &lt;/list&gt;<br>
&gt; <br>
&gt; FINAL DOCUMENT<br>
&gt; ---------------<br>
&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&gt; &lt;resource-lists xmlns=&quot;urn:ietf:params:xml:ns:resource-lists&quot;&gt;<br>
&gt; &nbsp; &nbsp;&lt;list name=&quot;mfriends&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;entry uri=&quot;sip:bob@example.com&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;display-name&gt;Bob Jones&lt;/display-name&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;/entry&gt;<br>
&gt; &nbsp; &nbsp;&lt;/list&gt;<br>
&gt; &lt;/resource-lists&gt;<br>
&gt; <br>
&gt; <br>
&gt; Notice the difference in list element (xmlns=&quot;&quot;) in both
the cases in<br>
&gt; the FINAL DOCUMENT SECTION.<br>
&gt; <br>
&gt; What am I doing wrong?? I think this is a bug in xerces-2.<br>
&gt; <br>
&gt; -Anurag<br>
&gt; <br>
&gt; ---------------------------------------------------------------------<br>
&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org<br>
&gt; For additional commands, e-mail: j-users-help@xerces.apache.org<br>
&gt; <br>
</tt></font>
--=_alternative 0065D8CF852570B6_=--

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

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