OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

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

RE: How to specify a Processing Instruction? (better: how tocontrolencoding on saving)



The following same changes the file test.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<steven></steven>

and changes the encoding as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<steven></steven>

The script is..

set xmlDoc = server.createobject("Msxml2.DOMDocument.3.0")
xmlDoc.async = false
xmlDoc.validateOnParse = true
xmlDoc.load(server.MapPath("test.xml"))

set pi = xmlDoc.createProcessingInstruction("xml", "version='1.0' encoding='ISO-8859-1'")
xmlDoc.replaceChild pi,xmlDoc.childNodes.item(0)

xmlDoc.save(server.MapPath("test.xml"))

Whether standard or not, it works.

Cheers,
Steven
Author, Pro XML2e