libxml2 - Attribute

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard Mertens

    libxml2 - Attribute

    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">ku limuh</muh>
    </test>

    example python - script

    ctxt = doc.xpathNewCon text()
    res = ctxt.xpathEval( "//test/muh")
    for myres in res:
    print myres.Attribute Count


    File "/usr/lib/python2.2/site-packages/libxml2.py", line 189, in __getattr__
    raise AttributeError, attr
    AttributeError: AttributeCount

Working...