Re: [xml] noob xpath question



Perhaps your difficulty is not with XPath, but rather with the command
interpreter (bash?) on your system?  Try surrounding your query with
"single-quotes", i.e. make the command line query
   '/myroot/myelement[ type="a"]'
and see if the result becomes more meaningful.

Bill

Stefan Jeglinski wrote:
I think what you want is this: /myroot/myelement[ type="a"]

Yes, this is a variant I tried. xpath1.c sample code returns "Result
(0 nodes):" where as /myroot/myelement returns (as I would expect):

Result (2 nodes):
= element node "myelement"
= element node "myelement"

I have been interpreting the 0-node result as my mistake in syntax,
but based on another off-list reply, and yours, I have at least on
several occasions used the correct syntax. I hesitate to blame the
sample code though, as I am pretty green at this so far.


here is a simple python program to play with:

Thanks I will try this.


Stefan Jeglinski





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