<?xml version=“1.0” encoding=“UTF-8”?> not <?xml version='1.0' encoding='UTF-8'?>

Posted by user2446702 on Stack Overflow See other posts from Stack Overflow or by user2446702
Published on 2013-06-28T22:14:59Z Indexed on 2013/06/28 22:21 UTC
Read the original article Hit count: 964

Filed under:
|
|
|

I am using lxml with

tree.write(xmlFileOut, pretty_print = True, xml_declaration = True, encoding='UTF-8'

to write out my opened and edited xml file, but I absolutely need to have the xml declaration as

<?xml version=“1.0” encoding=“UTF-8”?> 

and NOT

<?xml version='1.0' encoding='UTF-8'?>

Now I know they are exactly the same when it comes to xml, but I am dealing with a very tricky customer who absolutely has to have " in the declaration and not '. I have searched everywhere but can't find the answer.

Could I create it and add it in myself to the head of the xml somehow?

Could I tell lxml that this is what I need as an xml declaration?

© Stack Overflow or respective owner

Related posts about python

Related posts about Xml