[lxml-dev] Standalone declaration
Hi, i am new with lxml and is great, i created an xml now i want to make standalone declaration in my structure, how i can do it? i search in docs but i didnt good results. Thx in advance -- [b]question = (to) ? be : !be; .[/b]
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
2009/1/20 Stefan Behnel
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
I added that header with etree.tostring(root, encoding='iso-8859-1') but can i add a flag with standalone value? what instruction is for create flags in a node? regards,
Stefan
-- [b]question = (to) ? be : !be; .[/b]
2009/1/20 Ovnicraft
2009/1/20 Stefan Behnel
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()
getroot(), This atribute doesnt exist so, how can i add the flag standalone?
root[:] = your_content_elements
I added that header with etree.tostring(root, encoding='iso-8859-1')
but can i add a flag with standalone value?
what instruction is for create flags in a node?
regards,
Stefan
-- [b]question = (to) ? be : !be; .[/b]
-- [b]question = (to) ? be : !be; .[/b]
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
participants (2)
-
Ovnicraft
-
Stefan Behnel