| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
XMLWriter
Doctest:
>>>from xmlwriter import XMLWriter
>>>writer = XMLWriter()
>>>writer.doctype(
... u"xsa", u"-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML",
... u"http://www.garshol.priv.no/download/xsa/xsa.dtd")
>>>#Notice: there is no error checking to ensure that the root element
>>>#specified in the doctype matches the top-level element generated
>>>writer.push(u"xsa")
>>>#Another element with child elements
>>>writer.push(u"vendor")
>>>#Element with simple text (#PCDATA) content
>>>writer.elem(u"name", u"Centigrade systems")
>>>writer.elem(u"email", u"info@centigrade.bogus")
>>>writer.elem(u"vendor", u"Centigrade systems")
>>>#Close currently open element ("vendor)
>>>writer.pop()
>>>#Element with an attribute
>>>writer.push(u"product", {u"id": u"100\u00B0"})
>>>writer.elem(u"name", u"100\u00B0 Server")
>>>writer.elem(u"version", u"1.0")
>>>writer.elem(u"last-release", u"20030401")
>>>#Empty element
>>>writer.empty(u"changes")
>>>writer.pop()
>>>writer.pop()
startElement
endElement
emptyElement
text, data
endDocument
attribute
indentation
close
flush
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
out - a stream for the output encoding - an encoding used to wrap the output for unicode indent - white space used for indentation
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0 on Thu Jun 12 22:01:50 2008 | http://epydoc.sourceforge.net |