On Wed, 2008-03-05 at 05:58 -0500, Daniel Veillard wrote: > On Tue, Mar 04, 2008 at 06:56:01PM +0000, Dan Stromberg wrote: > > > > I'm having a little trouble with some basic XPath queries from shell. > > > > I dug up a small handful of what-seem-like simple examples from http:// > > www.w3schools.com/xpath/xpath_syntax.asp and fed them into three xpath > > programs (one in C, one in python, one in perl), and got pretty different > > results from the 3, a number of which I believe must be incorrect. > > > > I've summarized what I found at: > > > > http://stromberg.dnsalias.org/~dstromberg/xml/xpath-issues.html
I am having a hard time reading that Web page. The black background doesn't help :-) but by viewing the source, it looks like the Perl program is not serializing the results as XML. The desire to get pointy-bracket results rather than a string was part of why I wrote the short libxml wrapper that I did. > > > > Is it perhaps the case that some XPath processing programs don't do > > complete xpath? Are there different levels of xpath implementation > > completeness? $ rpm -qf /usr/bin/xpath perl-XML-XPath-1.13-8mdv2008.0 It's by Matt Sargeant, and you could do $ perldoc XML::XPath (after installing perl-doc if needed) to learn more. The findnodes_as_string method might work. I am not sure what XPath engine is used there; there's support for libxml in Perl these days, but it's separate, see $ perldoc XML::LibXML for more information. There's a separate mailing list for XML on Perl. It was not clear from your Web page in what way the results differed. When the /usr/bin/xpath program prints "NODE" it's just not returning the results in a useful way if you're after a tree. But it probably found the same results. I think my program may take only the first matching node and print it, I forget. My expectation was (and remains) that you would look at it and edit it to meet you needs. Actually I didn't mean to send a copy of it to the list! Liam -- Liam Quin - http://www.holoweb.net/~liam/ XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org www.advogato.org _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ [email protected] http://mail.gnome.org/mailman/listinfo/xslt
