libxml2 - Attribute

Discussion in 'Python' started by Richard Mertens, Jul 11, 2003.

  1. I'd like to read the attributes from a node in my xml - file, but i didn't
    found an example for this. Could someone help me please?
    I ghet the attribute count work neither.

    example - xml file

    <test>
    <muh attr1="test1" attr2="test">kulimuh</muh>
    </test>

    example python - script

    ctxt = doc.xpathNewContext()
    res = ctxt.xpathEval("//test/muh")
    for myres in res:
    print myres.AttributeCount


    File "/usr/lib/python2.2/site-packages/libxml2.py", line 189, in __getattr__
    raise AttributeError,attr
    AttributeError: AttributeCount
     
    Richard Mertens, Jul 11, 2003
    #1
    1. Advertisements

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. Alain Ketterlin

    libxml2/libxslt crash

    Alain Ketterlin, Feb 26, 2004, in forum: XML
    Replies:
    0
    Views:
    674
    Alain Ketterlin
    Feb 26, 2004
  2. Replies:
    1
    Views:
    669
    Patrick TJ McPhee
    Mar 2, 2004
  3. Replies:
    0
    Views:
    608
  4. Ale Vesely
    Replies:
    0
    Views:
    692
    Ale Vesely
    Mar 21, 2005
  5. Laurens

    libxml2 overhead?

    Laurens, Jun 28, 2005, in forum: XML
    Replies:
    0
    Views:
    579
    Laurens
    Jun 28, 2005
  6. zen

    libxml2 and parsing

    zen, Aug 3, 2005, in forum: XML
    Replies:
    0
    Views:
    598
  7. Juergen R. Plasser

    libxml2 Python bindings error

    Juergen R. Plasser, Jul 3, 2003, in forum: Python
    Replies:
    0
    Views:
    484
    Juergen R. Plasser
    Jul 3, 2003
  8. Logan
    Replies:
    1
    Views:
    470
    Logan
    Nov 21, 2003
Loading...