MSXML for Java Questions

Hunter, David dhunter at Mobility.com
Tue Sep 14 16:48:23 BST 1999


If I read your post right, that might not work either.  :-(

<my-assumption>
You want to take text which is in ISO-8859-2 and put it into MSXML using
load(), and then get it back at some point, still in ISO-8859-2.
</my-assumption>

<the-problem>
MSXML <em>always</em> translates all text to Unicode internally; that is,
when you pass your ISO-8859-2 text to load(), MSXML first translates the
text to Unicode, and then parses it.  Any text that MSXML passes back to you
will also be in Unicode, regardless of the initial encoding used.
</the-problem>

So if my assumption is correct, you won't be able to do what you want and
get the text back from MSXML in ISO-8859-2; only in Unicode.

<the-sig>
David Hunter
david.hunter at mediaserv.com
MediaServ Information Architects
http://www.MediaServ.com
</the-sig>

-----Original Message-----
From: Marko Zerdin [mailto:marko.zerdin at ixtlan-team.si]
Sent: Tuesday, September 14, 1999 3:40 AM
To: 'xml-dev at ic.ac.uk'
Subject: RE: MSXML for Java Questions


Thank you all. I got the idea now. Since String in Java is already in
Unicode (and not in ISO-8859-2), parser doesn't simply ignore the encoding
setting (simply put it in DOM tree without any consequences), but complains
about it. I wanted to use this setting in order to preserve original and
final encoding in the overall structure of XML document, but it seems that
I'll have to find some way aroun (most probably use load()).

Thank you all again. I wish you all the best,

Marko.

-----Original Message-----
From: Hunter, David [mailto:dhunter at Mobility.com]
Sent: Monday, September 13, 1999 5:47 PM
To: 'Marko Zerdin'; 'Chris Lovett'
Cc: 'xml-dev at ic.ac.uk'
Subject: RE: MSXML for Java Questions


The problem is that loadXML() in MSXML takes only Unicode strings, whereas
load() will take strings in any character set (as long as it's specified).

If you take that same XML and load it into MSXML using the load() method,
you should find that it will work fine.

The trick is that you have to either

a)  make sure any text you pass to loadXML is Unicode.  This is easier if
you use a language like Visual Basic, which uses all Unicode strings
internally; this means that any text you generate using VB can be passed to
load() no problem, without specifying the encoding.

OR

b)  pass any XML which isn't Unicode to load() instead of loadXML(), and
specify the encoding explicitly.

It can sometimes take a bit of planning to get these issues straight.

David Hunter
david.hunter at mediaserv.com
MediaServ Information Architects
http://www.MediaServ.com


-----Original Message-----
From: Marko Zerdin [mailto:marko.zerdin at ixtlan-team.si]
Sent: Monday, September 13, 1999 11:17 AM
To: 'Chris Lovett'
Cc: 'xml-dev at ic.ac.uk'
Subject: RE: MSXML for Java Questions


OK. Here is XML that I sent in my first mail at the beginning of the thread:

<?xml version="1.0" encoding="ISO-8859-2"?>
<Document>
   <Structures>
      <BankAccountInfo>
         <BankNumberCode>value</BankNumberCode>
         <BankAccountTypeID>value</BankAccountTypeID>
         <BankAccountPart1>value</BankAccountPart1>
         <BankAccountPart2>value</BankAccountPart2>
         <BankAccountPart3>value</BankAccountPart3>
      </BankAccountInfo>
   </Structures>
   <Messages>
      <Transactions>
         <t_Transaction>
            <CashAccount>
               <BankAccountInfo>
                  <BankNumberCode>value</BankNumberCode>
                  <BankAccountTypeID>value</BankAccountTypeID>
                  <BankAccountPart1>value</BankAccountPart1>
                  <BankAccountPart2>value</BankAccountPart2>
                  <BankAccountPart3>value</BankAccountPart3>
               </BankAccountInfo>
            </CashAccount>
         </t_Transaction>
      </Transactions>
   </Messages>
</Document>

When I pass this as an argument into the method DOMDocument.loadXML(String),
I get following error:
line 1, column 44: Switch from current encoding to specified encoding not
supported.

That's it. This is actually the only problem I had with this parser. I
didn't really work with some very complicated XML, and I didn't even touch
XSL yet, so I don't know what's waiting for me in the future. If anybody
knows for other "features" of IE5 parser, I would appreciate any
information.

Wish you all the best,

Marko.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN
981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN
981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list