Ovnicraft wrote:
2009/1/20 Stefan Behnel
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
getroot(), This atribute doesnt exist
Sorry, make that doc = etree.parse(StringIO( '<?xml version="1.0" standalone="true"?><root/>')) root = doc.getroot() or root = etree.fromstring( '<?xml version="1.0" standalone="true"?><root/>')
I added that header with etree.tostring(root, encoding='iso-8859-1') but can i add a flag with standalone value?
Not currently. Please file a wishlist bug in lxml's bug tracker. I think a flag on the _ElementTree class's docinfo property would work here.
what instruction is for create flags in a node?
This is not about changing nodes, but about changing documents features. Stefan