Re: [xml] python xpath



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?





On July 13, 2004 05:21 pm, Stefan Seefeld wrote:
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.

Regards,
              Stefan
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml



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