[lxml-dev] Standalone declaration

Stefan Behnel stefan_ml at behnel.de
Tue Jan 20 19:59:23 CET 2009


Hi,

Ovnicraft wrote:
> i created an xml now i want to make
> standalone declaration in my structure, how i can do it?

There isn't currently a way to set the flag programmatically, but you can
just parse in the declaration like this:

    doc = etree.fromstring(
             '<?xml version="1.0" standalone="true"?><root/>')
    root = doc.getroot()
    root[:] = your_content_elements

Stefan




More information about the lxml-dev mailing list