I'm still debating the question of whether or not to allow access to children via property names (like xmltramp). The problem is that you end up having to mangle either child names or "real" property names. Also, you need to have a mangled way for dealing with node-sets. YAXL curretly supports XPath even in XML fragments so theoretically you should use that, but it's hard not to like
root.title
as opposed to root('title')
. More complex queries, however, reveal the power of XPath: compare [x for x in root.head.children if x.localname == 'style']
to root('head//style')
to retrieve all style
elements of an HTML document. Or even root('//p')
to retrieve all the paragraphs.Ideally, YAXL would support both methods but I still need to come to terms with all the mangling required.
No comments:
Post a Comment