Hi,

I think I found a bug in the rename command. In RenameCommand.java from
line 59:
this:
            Node parent = current.getParentNode( );

should be replaced with this:

            Node parent;
            switch (current.getNodeType()) {
                case Node.ATTRIBUTE_NODE:
                    parent = ((Attr)current).getOwnerElement( );
                    break;
                default:
                    parent = current.getParentNode( );
            }


This will allow attributes to be renamed. (Attr nodes do not have a
parent node, at least not in our implementation)

uses case:

input:

<?xml version="1.0"?>
<addresses>
  <address name="Andreas">
    <town>New York</town>
  </address>
  <address name="Lars">
    <town>Los Angeles</town>
  </address>
</addresses>

update:

<lexus:modifications version="1.0"
xmlns:lexus="http://www.xmldb.org/xupdate";>
  <lexus:rename select="/addresses/address/@name">naam</lexus:rename>
</lexus:modifications>

result:

<?xml version="1.0"?>
<addresses>
  <address naam="Andreas">
    <town>New York</town>
  </address>
  <address naam="Lars">
    <town>Los Angeles</town>
  </address>
</addresses>

greetings,

jeroen


--

X-Hive Corporation
e-mail: [EMAIL PROTECTED]
phone: +31 10 7108622
http://www.x-hive.com
----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact administrator:  mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------

Reply via email to