>>It's certainly hard to define what convenience is where XML processing is
concerned.<<
XPath is as useful to XML documents as SQL is to RDBMS's. Sure, you can use
cursors to do everything you'd want to in an RDBM's but you'd be mad.
XPath allows you to frame statements like "provide me a list of nodes that
have attribute X = Y" or "find me the first node that is the 3rd <z> element
of a parent <x> element".
XPath also takes away the uncertainty of processing poorly sytructured XML.
I'm at element X and I know there's a child under me which has an attribute
a="1". Now I can just find it without having to dredge all the child nodes
and test them (possibly tripping over spurious whitespace nodes as I go) :
child = x.xpathQuery('/*[a="1"]')
if child:
....
NB. My XPath is rusty, the above probably isn't valid and I don't know the
Python syntax for XPath use but you get the idea.
- Ian Sparks.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 1:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [Webware-discuss] Whence FormKit? Or, alas, poor FormKit,
weknew him.
[EMAIL PROTECTED] (Mike Orr) wrote:
>
>On Fri, Apr 19, 2002 at 12:14:15PM -0400, Jeff Johnson wrote:
>>
>> I haven't checked out pyrxp yet but have you all tried XPath? It's
>> really easy to access XML info with it.
>
>No, what's xpath? ... Hmm, Parnassus lists three xpath packages
(xml_indexer,
>a 4Suite tool, and PyXPath). Which do you recommend?
>http://www.vex.net/parnassus/apyllo.py?so=d&find=xpath
>From my understanding, XPath is just a convenient way of addressing known
locations in an XML document. Indeed, it's used extensively in XSLT and can
be
quite powerful.
It's certainly hard to define what convenience is where XML processing is
concerned. Personally, I'm more and more against converting XML documents to
other representations (or accessing them as those representations), and I
don't
think it's particularly hard to use certain parts of the DOM API to find,
process or extract parts of XML documents. However, there are some issues
(text
section handling being a good example) which are irrelevant for certain
applications and where it should be possible to "optimise away" the tedious
code that results from having to handle them.
Paul
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss