[XML-SIG] Wrapping a DOM class.
Ian Sparks
ians@etrials.com
Wed, 27 Jun 2001 13:56:56 -0400
I confess the XML support for Python confuses me. I thought I understood the
DOM but I'm having problems with the Python DOM implementations. The
following sample shows what I am *trying* to do. I know the minidom won't
get me here so what implementation will? If someone could convert to a
working sample I'd be very grateful.
from xml.dom.minidom import Document, parse, parseString
class xdoc:
dom = Document
def __init__(self):
self.dom = parseString('<myxml att="hello"/>')
def __getattr__(self,key):
return self.dom.documentElement.getAttributeNS('',key)
def __setattr__(self,key,value):
self.dom.documentElement.setAttributeNS('',key,value)
x = xdoc()
x.walk = 'funny'
print x.walk
print x.att
Thanks for your attention.