Re: [xml] python xpath

Jason Jesso wrote:
> flight = self.ctxt.xpathEval( "table/tr/td/a/text()" )
> print flight[0]
> I am evaluating this xpath expression using python's libxml2.
> How can I get the actual text data?  When I print the result set I get text
> node information, like the address and stuff.

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

Daniel: it might indeed be convenient to return the content in the __str__ attribute
(for text nodes only, of course), thus returning the actual text if 'print node'
is called.


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