You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by v v <er...@yahoo.com> on 2003/02/09 16:48:30 UTC

Empty attribute in xu:attribute (XUpdate) doesn't work like i expected

If you try following query:

<xu:modifications version="1.0"
xmlns:xu="http://www.xmldb.org/xupdate">
  <xu:append select="/element">
    <xu:element name="style">
      <xu:attribute name="attr1"/>
      <xu:attribute name="attr2"/>
      <xu:attribute name="attr3">0</xu:attribute>
      <xu:attribute name="attr4"></xu:attribute>
    </xu:element>
  </xu:append>
</xu:modifications>

Xindice gives a lot of the following messages:
* java.lang.Exception: no nodes selected !
* java.util.NoSuchElementException

If I ommit attributes 1, 2 and 4 in my query, it works
fine. Is this a restriction/bug of Xindice or just the
definition of XUpdate? Temporary I work around this
problem by setting the value to any arbitrary value
and updating it to "". 

David.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

RE: Empty attribute in xu:attribute (XUpdate) doesn't work like i expected

Posted by Jeroen Breedveld <je...@x-hive.com>.
Hi David,

 || -----Original Message-----
 || From: v v [mailto:erosares@yahoo.com] 
 || Sent: zondag 9 februari 2003 16:49
 || To: xindice-users@xml.apache.org
 || Subject: Empty attribute in xu:attribute (XUpdate) doesn't 
 || work like i expected
 || 
 || 
 || If you try following query:
 || 
 || <xu:modifications version="1.0" 
 || xmlns:xu="http://www.xmldb.org/xupdate">
 ||   <xu:append select="/element">
 ||     <xu:element name="style">
 ||       <xu:attribute name="attr1"/>
 ||       <xu:attribute name="attr2"/>
 ||       <xu:attribute name="attr3">0</xu:attribute>
 ||       <xu:attribute name="attr4"></xu:attribute>
 ||     </xu:element>
 ||   </xu:append>
 || </xu:modifications>
 || 
 || Xindice gives a lot of the following messages:
 || * java.lang.Exception: no nodes selected !
 || * java.util.NoSuchElementException

I tested it myself and also got a java.util.NoSuchElementException, this
is a bug because xupdate should be able to append empty attributes. In
any case it shouldn't give a crytic exception like
java.util.NoSuchElementException.

 || If I ommit attributes 1, 2 and 4 in my query, it works
 || fine. Is this a restriction/bug of Xindice or just the 
 || definition of XUpdate? Temporary I work around this problem 
 || by setting the value to any arbitrary value and updating it to "". 

The working draft (http://www.xmldb.org/xupdate/xupdate-wd.html) is not
very clear about this but since empty attributes are legal in XML IMO
xupdate should be able to append empty attributes.

I will fix this in the next release of Lexus. Btw you have more chance
getting problems with xupdate fixed if you post your problems to
xupdate-dev@xmldb.org

regards,

Jeroen Breedveld

--

X-Hive Corporation
e-mail: jeroenb@x-hive.com
phone: +31 10 2818080
http://www.x-hive.com