Are you running xerces on a machine running a Chinese Windows OS?
----- Original Message -----
Sent: Thursday, November 11, 1999 10:09 PM
Subject: encoding problem for sample DTD personal.dtd

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

Reply via email to