libxml2 - Attribute

Richard Mertens richard.mertens at wolfi.org
Fri Jul 11 10:00:15 CEST 2003


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





More information about the Python-list mailing list