Oliver Klee wrote:

Hi,

at the moment, I'm playing around with XPath (using the command line tool of today's CVS build).

I have inserted the document http://www.jeckle.de/vorlesung/xml/examples/projektverwaltung4.xml under the collection /db/test/ .

This query works fine:

./xindice xpath -c /db/test/ -q "//Person[count(Vorname)=1]/Nachname[following-sibling::[EMAIL PROTECTED]/parent::Person/"


But using this query (in order to access the attribute "@mitarbeitInProjekt") ...:


./xindice xpath -c /db/test/ -q "//Person[count(Vorname)=1]/Nachname[following-sibling::[EMAIL PROTECTED]/parent::Person/@mitarbeitInProjekt"



Hm... I think this one is shorter and does the same:
./xindice xpath -c /db/test/ -q "//Person[count(Vorname)=1][Nachname/following-sibling::Geburtsname/@value]/@mitarbeitInProjekt"



... I get:

trying to register database
org.xmldb.api.base.XMLDBException: Failed to execute command 'Query' on server: http://127.0.0.1:8888/xindice/, message: java.lang.Exception: org.w3c.dom.DOMException: This Node Cannot Contain This Child

...

Is this a bug in Xindice, or is my XPath query just plain wrong? If it is wrong, how can I get this attribute's value as a result?


Xindice supports attribute results, as shown by unit tests. See (and try) unit tests, and take a look at guide-xpath document.

So, it might be some new bug in Xindice. Can you send sample XML file so it's possible to reproduce the bug, or find the problem?


Vadim




Reply via email to