[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to specify a Processing Instruction?
- From: "Simon St.Laurent" <firstname.lastname@example.org>
- To: ComCity <email@example.com>
- Date: Wed, 29 Aug 2001 13:48:02 -0400
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
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'
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.