Zhou Shaoping-W16678 wrote: > > Thanks for all the explanation about encoding vs. XML. > > The problem that I reported has to do with a source file from sample > section. The file name is "personal.dtd". In that file, the encoding scheme > is "US-ASCII". > > I would like to suggest that the encoding for the sample file "personal.dtd" > change to "UTF-8" or "UTF-16".
Good suggestion. > > An update on IE5 and XML encoding. It actually supports "US-ASCII". I just > need to make sure that the font be changed to "Western alphabet". When I > encountered the error, the encoding was GB2312 (simplified chinese). It > seems not to dynamically change the encoding environment based on the xml > file encoding schema spec, although it does change the encoding accordingly > for HTML contents. > That sounds like an IE5 bug to me. I think it should have noticed that US-ASCII was specified, and it should do the transcoding from US-ASCII to the current display encoding. > regards, > -Shaoping Zhou > > -----Original Message----- > From: Mike Pogue [mailto:[EMAIL PROTECTED] > Sent: Monday, November 15, 1999 1:50 PM > To: [EMAIL PROTECTED] > Subject: Re: encoding problem for sample DTD personal.dtd > > 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
