That's actually exactly what XQuery is for. If you want some
programmatic power with XML manipulation and query, its really hard to
beat XQuery, especially if you're using a XML database. Consider
querying an XML database, pull bits of the response, and presenting
them, all handily done in a single XQuery loop:

    for $reply in $entry//reply[state = $states]
    return <dd>{ $reply/author/name/last/text() }</dd>

$entry in this case is assumed to be the XML document being operated
on.

Granted XQuery is odd, and yet another language.... but if you're heavy
into XML, and want to use XML files with XPath queries and do a little
manipulation on the output (for HTML), I don't know how you can get any
better than an expression based language that treats XML as first-class
objects.

If you want to stick with as much Python as possible, I'd be more
inclined to suggest lxml as you get full XPath 1.0 queries as well as
XSLT capabilities. Though the thing that annoys me about both
ElementTree and lxml is that they don't implement__str__ method that
dump the data as a string (which would be awesome when using ET/lxml
nodes in template languages); instead you have to call another function
on them to dump their contents. That feels pretty odd to me as I'd
expect the objects themselves to either give me the string data with
__str__ or have a function attached that can dump the data.

I should also mention, if you're building web-apps with XML data that
people are giving you, pushing the data into a RDBMS rather than
keeping it structured in a XML database isn't going to help. Why not
keep the XML as XML, and use an XML database that lets you pull your
data with XPath expressions; then just print out or update nodes as
needed?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to