Bug in XUpdateProcessor. Snapshot 20050805. Dealing with attributes without namespace

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in XUpdateProcessor. Snapshot 20050805. Dealing with attributes without namespace

Chelliah Thirunavukkarasu
Hi,

Snapshot: 20050805 (noticed that the current version in CVS still has
the bug)

There is a bug in org.exist.xupdate.XUpdateProcessor in line 389 (the
startElement method).

The check n.getLocalName().equals(name) is wrong. If n.getNamespaceURI()
is null, it should be n.getNodeName() and if namespaceURI is not null,
it should be n.getLocalName().

Regards

Chelliah


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Renaming an element's name and namespace using XUpdate

Chelliah Thirunavukkarasu
Hi,

How does one rename an element's name and namespace using XUpdate. The
XUpdate specification does not mention if the content of the rename
instruction is a string or QName.

I looked at eXist's implementation and noticed that the implementation
treats the content of the rename instruction to be a string and only
renames the element's name - actually, it does rename the namespace URI
too - it just gets rid of the current namespace URI.

I can go ahead and change eXist code to treat the content to be a QName
and rename both the namespace URI and the name. However, there are a few
tricky issues.

1. Should we use the QName's prefix as the prefix for the element's
name? Or should we use the empty prefix ("").

2. If we use the QName's prefix, there is no mechanism for the caller to
rename the element and also use the empty prefix ("").

3. If we use the QName's prefix or the empty prefix, what if it clashes
with an existing xmlns attribute? Should we overwrite the xmlns attribute?

Regards

Chelliah



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

xmlns attributes are being swallowed by XUpdateProcessor

Chelliah Thirunavukkarasu
Hi,

If I send the following xupdate command to eXist, the xmlns attribute is
being suppressed by XUpdateProcessor

<xu:modifications xmlns:ns1="myNS"
xmlns:xu="http://www.xmldb.org/xupdate" version="1.0">
<xu:append select="/ns1:Service/ns1:foo">
<bar xmlns=""> This child does not have a namespace whereas the parent
has a namespace and might be using the xmlns="myNS" to specify it's
namespace instead of xmlns:somePrefix="myNS"
</bar>
</xu:append>
</xu:modifications>

There is a comment in the XUpdateProcessor that says, "Why are these
showing up? They are supposed to be stripped out?"

In the above example the xmlns attribute is there to reset any potential
xmlns declaration in the parent.

Is there a specific reason, why the xmlns attributes are being suppressed?

Thanks

Chelliah


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Bug in XUpdateProcessor. Snapshot 20050805. Dealing with attributes without namespace

wolfgangmm
In reply to this post by Chelliah Thirunavukkarasu
Hi,

> The check n.getLocalName().equals(name) is wrong. If n.getNamespaceURI()
> is null, it should be n.getNodeName() and if namespaceURI is not null,
> it should be n.getLocalName().

Ok, thanks. I tried to fix this in CVS.

Wolfgang


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: xmlns attributes are being swallowed by XUpdateProcessor

wolfgangmm
In reply to this post by Chelliah Thirunavukkarasu
> If I send the following xupdate command to eXist, the xmlns attribute is
> being suppressed by XUpdateProcessor

The namespace is correctly set on the element. I checked the stored
node. It is the serializer that fails to output the required xmlns="".
I still have to check why.

> There is a comment in the XUpdateProcessor that says, "Why are these
> showing up? They are supposed to be stripped out?"

The namespace/prefix mappings should be passed through the
startPrefixMapping/endPrefixMapping methods.

Wolfgang


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open