|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to specify a Processing Instruction?
On 29 Aug 2001 10:35:25 -0700, ComCity wrote:
> Well, this is not what I read. I read that the encoding part of the
> processing instruction is something that will be used eventually by the
> server I'm sending it to. Right now, I'm just creating the document from
> scratch so there really is "no" encoding. I want to set the encoding so
> that the eventually server will be able to understand the XML document....it
> expects ISO-8859-1. This seems a bit like a chicken and the egg....
The XML Declaration is not a processing instruction, as others have
noted. However, MSXML 3.0 (and I think 4.0) treats it as a processing
instruction.
You can assign an XML Declaration to an MSXML DOM by adding a processing
instruction to the DOM _before_ adding anything else:
var pi=xmldoc.CreateProcessingInstruction("xml"," version='1.0'
encoding='ISO-8859-1'");
xmldoc.appendChild(pi);
This PI must be the first thing in the DOM - no whitespace, nothing else
- or MSXML will ignore it.
I don't currently have a functional MSXML parser, so this description is
based on old notes, but hopefully it will help.
There is also an excellent book, Unicode: A Primer, by Tony Graham,
which explains a lot of encoding issues, though it isn't focused on XML.
Simon St.Laurent
http://simonstl.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








