Re: [xml] python xpath

Jason Jesso wrote:
I'm really new to python and especially libxml2.

The node's 'content' (python) attribute will contain the actual text (if it
is a text node).

Could you tell me how to do that?

results = ctxt.xpathEval("/your/xpath/*")
for r in results:
    print r.content

Some other attributes you may be interested in are 'type', 'name', etc.
To find out what attributes a node supports, use 'dir(node)'


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]