Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Createprocessinginstructions don't show encoding
Message
 
To
28/05/2021 14:02:57
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01680811
Message ID:
01680820
Views:
28
Hi Antonio,

thanks a lot, I'll try it right now.

Best regards

Thomas



Thomas,

Unless you're doing something strange down the process line, this should be straightforward:
LOCAL XML AS MSXML2.DOMDocument60

m.XML = CREATEOBJECT("MSXML2.DOMDocument.6.0")

m.XML.appendChild(m.XML.createProcessingInstruction("xml", 'version="1.0" encoding="utf-8"'))

m.XML.appendChild(m.XML.createElement("root"))

m.XML.childNodes(1).appendChild(m.XML.createTextNode("La Méditerranée et le Monde méditerranéen à l'époque de Philippe II"))

m.XML.save("holste.xml")
This will produce, verbatim (encoded as UTF-8)
<?xml version="1.0" encoding="utf-8"?>
<root>La Méditerranée et le Monde méditerranéen à l'époque de Philippe II</root>
>Hi there,
>
>I want to create a xml-file using msxml2.domdocument encodesd in UTF-8
>Almost everything is fine but two things do not work as expected.
>
>I start with:
>
>oxml = createobject("msxml2.domdocument")
>opi= oXML.createProcessingInstruction('xml','version="1.0" encoding="UTF-8"')
>* or, as found in a Doug Hennig post
>opi= x.createProcessingInstruction('xml','version="1.0"' + ' encoding="UTF-8"')
>oXML.appendChild( oPI )
>
>But it makes no difference what I use, the encoding doesn't show up in the processing instruction.
>What am I doing wrong here?
>
>I assume the second problem is a follow up. When I try to save the file,
>I get an error telling me, that some chars cannot be saved in ISO-8859-Mode"
>By now I helped myself by saving the file with strtofile(oXML.xml, cOutput)
>but I would prefer the save-method to work
>
>Best regards
>
>Thomas
Previous
Reply
Map
View

Click here to load this message in the networking platform