Home | Trees | Indices | Help |
|
---|
|
Initialize me with a DOM node or a DOM document node (the toplevel node you get when parsing an XML file). Then use me to generate fully qualified XML names.
>>> xml = '<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"></office>' >>> from lxml import etree >>> namer = XmlNamer(etree.fromstring(xml)) >>> namer.name('office', 'blah') {urn:oasis:names:tc:opendocument:xmlns:office:1.0}blah >>> namer.name('office:blah') {urn:oasis:names:tc:opendocument:xmlns:office:1.0}blah
I can also give you XmlNamespace objects if you give me the abbreviated namespace name. These are useful if you need to reference a namespace continuously.
>>> office_ns = name.namespace('office') >>> office_ns.name('foo') {urn:oasis:names:tc:opendocument:xmlns:office:1.0}foo
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Mar 3 16:37:53 2010 | http://epydoc.sourceforge.net |