Re: [xml] How to add encoding property in xml document




Hi Sai Reddy,

I don't know too much about the C implementation, but in the Python examples (serialize.py) he uses the 
encoding as a parameter to the serialize method...

doc = libxml2.parseDoc("""<root><foo>hello</foo></root>""")
str = doc.serialize()
if str != """<?xml version="1.0"?>
<root><foo>hello</foo></root>
""":
   print "error serializing XML document 1"
   sys.exit(1)
str = doc.serialize("iso-8859-1")
if str != """<?xml version="1.0" encoding="iso-8859-1"?>
<root><foo>hello</foo></root>
""":
   print "error serializing XML document 2"
   sys.exit(1)


any help?

Cheers
Mike



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]