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?



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