python xpath

Discussion in 'Python' started by Jason Jesso, Jul 14, 2004.

  1. Jason Jesso

    Jason Jesso Guest

    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.

    This is probably a stupid question, but I can't seem to get it.

    Thanks for any help.
     
    Jason Jesso, Jul 14, 2004
    #1
    1. Advertising

  2. Jason Jesso

    John Lenton Guest

    On Wed, 14 Jul 2004 01:23:00 GMT, 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.
    >
    > This is probably a stupid question, but I can't seem to get it.


    try help(libxml2) from the interpreter, or pydoc libxml2 from the shell. I'd do

    print flight[0].content

    (or getContent(), or get_content())

    --
    John Lenton () -- Random fortune:
    bash: fortune: command not found
     
    John Lenton, Jul 14, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,993
    jan V
    Jul 29, 2005
  2. Alastair Cameron
    Replies:
    1
    Views:
    7,442
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  3. Anna
    Replies:
    0
    Views:
    541
  4. goog
    Replies:
    0
    Views:
    518
  5. Tjerk Wolterink

    XPath: efficiency in xpath expressions

    Tjerk Wolterink, Nov 13, 2004, in forum: XML
    Replies:
    1
    Views:
    1,662
    Richard Tobin
    Nov 13, 2004
Loading...

Share This Page