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?




Since you are using the MS implementation of DOM, the best I can come up
with is the transform and transformNodeToObject methods [1, 2]. You can
use it to transform a node with a stylesheet. In an XSLT document, you
can specify the output encoding using the output element like:

<xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk3
0/htm/xmmthtransform.asp
[2]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk3
0/htm/xmmthtransformnodetoobject.asp


Hope this helps.

Manos




> -----Original Message-----
> From: Julian Reschke [mailto:julian.reschke@gmx.de]
> Sent: Wednesday, August 29, 2001 10:24 AM
> To: ComCity; xml-dev@lists.xml.org
> Subject: RE: How to specify a Processing Instruction?
> 
> 
> > From: ComCity [mailto:mikeb@comcity.com]
> > Sent: Tuesday, August 28, 2001 11:43 PM
> > To: xml-dev@lists.xml.org
> > Subject: How to specify a Processing Instruction?
> >
> >
> > I need to create an MSXML document with a specific 
> Processing Instruction
> > and I'm finding it impossible to do.  First, I tried create 
> a template XML
> > document on disk that I read in and modify it.
> >
> > Unfortunately, the XML file opens fine when it says this at the top
> > <?xml version="1.0"?>
> >
> > but if I change it to this, which is what I need, it won't open.
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >
> > Why?
> 
> This will only work when the file actually *IS* encoded in 
> ISO-8859-1. For
> instance, it will fail for files encoded in UTF-8 or UTF-16.
> 
> > I can't even seem to be a way to create a new XML document 
> by scratch (or
> > one that I can find) where you can create a new processing 
> instruction
> > beyond one that contains the version only even modify an 
> existing XML
> > document where you would change the
> > processing instruction.
> 
> The XML declaration isn't a processing instruction. It's a 
> conformance bug
> in MSXML to treat it this way.
> 
> > There's IXMLDOMProcessingInstruction ....
> >
> > Very little documentation on it, but it only allow appears to let
> > you set or
> > change the XML version.  I need to set the encoding as well.
> >
> > I need to be able to send an XML document and the 
> processing instruction
> > mus be:  <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> So what you really want it is: specify the output encoding 
> when saving the
> contents of the DOM to an XML file. This is currently outside 
> the scope of
> the DOM spec (DOM level 2 doesn't treat saving at all).
> 
> As far as I know, MSXML should support setting a processing 
> instruction with
> target "xml" and value "version='1.0' encoding='ISO-8859-1'" 
> and later will
> use the encoding value when saving.
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this elist use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>