Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML not in UTF-8 format
Message
 
To
29/01/2004 18:28:55
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00872117
Message ID:
00872964
Views:
15
Hi Michel,

this is a code-snippet which shows how I create an UTF-8-encodes xml-file
with msxml2.
this.oxml = createobject("msxml2.domdocument"+"."+this.cParserversion)
this.oXML.async = .F.
* XML-Deklaration anlegen
this.oxml.validateonParse = .F.
cxmlstart = ""

IF LEN(ALLTRIM(this.cEncode)) == 0
   cEnc = "UTF-8"
ELSE
   cEnc = ALLTRIM(this.cEncode)
Endif

IF this.lUseDTD
   cURL = this.cDTD
   cxmlstart = "<?xml version=" + CHR(34)+"1.0"+CHR(34) + " encoding=" +;
               CHR(34)+cEnc+CHR(34) + " ?>"
   cxmlstart = cxmlstart + CHR(13) + CHR(10)
   cxmlstart = cxmlstart + "<!DOCTYPE ONIXmessage SYSTEM " + CHR(34) + cURL
+
CHR(34) +;
            "><DUMMY/>"
   this.oxml.loadXML(cxmlstart)
   this.oxml.RemoveChild(this.oxml.ChildNodes(2))
else
   cxmlstart = "version=" + CHR(34) + "1.0" +CHR(34) + " encoding=" +
CHR(34) + cEnc
+ CHR(34)
   oDec = this.oxml.createProcessinginstruction('xml',cxmlstart)
   this.oxml.insertBefore(oDec,this.oxml.childnodes.item(0))
endif
*****
Hope this helps

Thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform