[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to specify a Processing Instruction? (better: how tocontrolencoding on saving)
- From: s.livingstone@btinternet.com
- To: xml-dev@lists.xml.org
- Date: Wed, 29 Aug 2001 23:34:07 +0100 (BST)
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