On Fri, 19 Apr 2002 14:21:33 -0400 Ian Sparks <[EMAIL PROTECTED]> wrote:
>>>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.
Actually, it does depend on what you're trying to achieve...
>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".
Yes, it's a declarative language which permits expressions, similar in
capabilities to SQL for relational databases, as you say. In that sense, it's
really nice, and as I mentioned to another contributor to this list, I managed
to do some really neat tricks with XPath in XSLT documents. I was most
surprised that they worked so well, and credit is surely due to the people who
put the Xerces/Xalan packages together.
>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.
I suppose I'm more interested in systematically processing XML for the purposes
of validation in frameworks, and in such cases, it is interesting to descend
into the depths of a document - I just don't want to be distracted by too many
details while doing so. For applications, I can see significant advantages in
using XPath, although getElementsByTagName[NS] can certainly provide
substantial benefits all by itself. ;-)
Personally, I see the principal benefits of XML as being the development of
high-level patterns around the querying and manipulation of hierarchical data
structures rather than the fact that "XML is text" and "it's a common format"
(the classic executive summary statements), which although true and beneficial
in themselves, don't necessarily lead to massive gains in productivity beyond a
certain point.
I'll certainly look into Python XPath packages, of which there must surely be
one included in the PyXML suite. I'm not 100% convinced of the robustness of
PyXML in these "edge cases", however - there was a fair amount of discussion
recently about what was needed to use XSLT with PyXML and whether those extra
components (from 4Suite) were even compatible with the most recent PyXML. I
must confess to not having followed such discussions in depth - one often has
limited time to indulge in tracking "bleeding edge" dependencies, ignoring most
of the back-and-forth conversations and just sticking to "more mature" releases.
Paul
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss