[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can anyone help me, plz?--with xpath query


>Hi.. I am completely new to ozone, but I found it very useful.
>When I wanted to use the ozone-db for xml repository and string query within the xml documents, I found that I couldn't get the values of attributes.
>For the values of elements, I could see it among the text printed.
>C:\ozone-1.0\samples\XML>ojvm Client xpath -p CPA.xml -q"//Retries"
>print: true
>query string: //Retries
>XPath query: filename=CPA.xml, qstring=//Retries
>XPath query: query time: 1522 ms
>XPATH query: result: (NodeList): 2 Entries
>1 Entry: [extract time: 1172 ms]
>        Node name [tp:Retries] value [null]
>           Node name [#text] value [5]
>2 Entry: [extract time: 190 ms]
>        Node name [tp:Retries] value [null]
>           Node name [#text] value [5]
>However, I couldn't get the values of attributes. It always returns me with the "null".
>Can anyone help me with this? Is it something to do with the command line or the java source?  

Are you using the "print" command line to visualize the query result?
If you look at the java source (samples/XML/Client.java) you'll see
that the printNodeTree() method ignores the special DOM node type
"Attr". The DOM API defines the method Attr.getValue() to retrieve
the value of an attribute, the used getNodeValue() returns "null" for
Attr nodes. If you use the "-f<filename>" you should get the correct
output in the provided file.

Lars Martin                                    mailto:lars@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com