Note that the MS IE XML parser does NOT support many encodings. Plus,
it supports some that are Windows-specific.
XML processors are required to support UTF-8 and UTF-16, but beyond
that,
they are not required to understand any encoding name. So, technically,
Microsoft doesn't HAVE to recognize "US-ASCII" as an encoding name.
For maximum portability of your XML data, use UTF-8 or UTF-16.
Mike
> Shaoping Zhou wrote:
>
> I noticed that IE5 cannot correctly process personal.xml because it
> cannot recognize the encoding scheme "US-ASCII".
> After I changed "US-ASCII" to "UTF-8", it worked under IE5.
>
> My sample program had the same experience, basically it was able to
> parse the xml data file personal.xml after I changed encoding to
> UTF-8. The listing of the code is as follows:
>
> public static void main(String[] args) {
> ParserSample1 parserSample1 = new ParserSample1();
> parserSample1.invokedStandalone = true;
> String xmlFile = "F:\\xercesJ\\xerces-1_0_0\\data\\personal.xml";
>
> DOMParser parser = new DOMParser();
>
> try {
> parser.parse(xmlFile);
>
> } catch (SAXException se) {
> se.printStackTrace();
> } catch (IOException ioe) {
> ioe.printStackTrace();
> }
> // The next line is only for DOM Parsers
> Document doc = parser.getDocument();
>
> Node myNode = null;
>
> // work with element
> Element myElement = doc.getDocumentElement();
> NodeList myNodeList myNodeList = myElement.getChildNodes();
> System.out.println("NodeList length = " + myNodeList.getLength());
> for (int i = 0; i < myNodeList.getLength(); i++)
> {
> myNode = myNodeList.item(i);
> System.out.println(myNode.getNodeName());
> System.out.println(myNode.getNodeValue());
> }
>
> }
>
> I am fairly new to the XML stuff, could someone point out what is
> going on?
>
> regards,
> -Shaoping Zhou