|
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
|
- a typo in sample code Shaoping Zhou
- Re: encoding problem for sample DTD personal.d... Shaoping Zhou
- Re: encoding problem for sample DTD person... 黄 永紅
- Re: encoding problem for sample DTD person... twleung
- Re: encoding problem for sample DTD person... Mike Pogue
- Re: encoding problem for sample DTD pe... Dirk-Willem van Gulik
- Short PATCH primer (Was Re: a typo in sample co... Dirk-Willem van Gulik
- Re: a typo in sample code Mike Pogue
- RE: a typo in sample code Zhou Shaoping-W16678
- Re: a typo in sample code Mike Pogue
