[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: ComCity <mikeb@comcity.com>
- To: Julian Reschke <julian.reschke@gmx.de>, xml-dev@lists.xml.org
- Date: Wed, 29 Aug 2001 14:59:46 -0700
----- Original Message -----
From: Julian Reschke <julian.reschke@gmx.de>
To: ComCity <mikeb@comcity.com>; <xml-dev@lists.xml.org>
Sent: Wednesday, August 29, 2001 2:26 PM
Subject: RE: How to specify a Processing Instruction? (better: how to
controlencoding on saving)
> > From: ComCity [mailto:mikeb@comcity.com]
> > Sent: Wednesday, August 29, 2001 9:13 PM
> > To: Arnold, Curt; xml-dev@lists.xml.org
> > Subject: Re: How to specify a Processing Instruction? (better: how to
> > controlencoding on saving)
> >
> > ...
> >
> > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > <foo/>
> > >
> > > Is an XML document
> >
> > Well it still won't read it in. It will only read it in if the encoding
> > string is not present. I assume that means its not in
>
> Then obviously something is wrong on *your* side. Or do you happen to use
> loadXML()? In which case I recommend to read the SDK documentation and the
> MSDN article about encodings
>
(<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxml/htm
> l/xmlencodings.asp>).
Yes, I do use loadXML and not load. I have read this article about 10 times
already. However, reading again after your and others posts has made this a
little clearer to me. It appears I'm reading an existing XML document with
LoadXML. That document is thus read in by default as UTF-8 because there is
no encoding declaration. Then I receive an XML response from a second
party. I try and move one node from that XML document into my new one where
that node is actually in ISO-8859-1. It automatically converts the
ISO-8859-1 node to UTF-8 otherwise it wouldn't be able to stick it in the
XML document in the first place and the whole thing quits working.
Conclusion:
I have to create a brand new XML document and ensure it is ISO-8859-1 from
the start. Define the elements and then move over the text from the XML
response from a second party. And, then it will remain ISO-8859-1
Thanks for your help. I'm going to go try this now.
> > ISO-8859-1. I think
> > I might be starting to understand it. If I do, then I think what
everyone
> > is saying is that I cannot start with an XML template, rather, I have to
> > create the XML document completely over again, with the
> > ISO-8859-1 encoding
> > standard from the start and then hopefully the UPS text encoding will
stay
> > preserved when the node is added.
>
> No, that's not the case. Start with a document like the one above, replace
> the document element with what you need, and that's it.
>
> > So, I can't take an existing DOM in whatever originally encoding it was,
> > even UTF-8, modify it and save it in a differnet encoded byte stream?
>
> You can. How this works depends on the implementation of the XML
serializer
> that you use with your DOM.
>
> > > The XML recommendation addressed this by basing XML on Unicode
> > and stating
> > the only required encodings are UTF-8 and UTF-16. Use of any other
> > encodings is allowed but not required, so if you want
> > > your documents to universally readable, you will encode them in either
> > UTF-8 or UTF-16.
> >
> > Unfortunely, UPS requires the XML document be in a specific format with
a
> > certain text element being very specific. I'm not in control of their
> > parser or their requirements.
>
> Is this requirement documented somewhere (web link)?
>
>
>