DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7430>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7430

Parser unknown the character 0x96

           Summary: Parser unknown the character 0x96
           Product: Xerces2-J
           Version: 2.0.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I found an exception when parsing a simple xml as following:
------------begin of xml--------------
<?xml version="1.0" encoding="UTF-8"?>
<root>
        <!-- Value of tag 'child1' is a character 0x96 -->
        <child1>�</child1>
</root>
------------end of xml--------------
Here is the exception using DomParser of Xalan j2.3.1 and Xerces 2.0.1:

------------begin of the exception--------------
[Error] :2:7: Document root element "root", must match DOCTYPE root "null".
[Error] :2:7: Document is invalid: no grammar found.
java.io.UTFDataFormatException: invalid byte 1 of 1-byte UTF-8 sequence (0x96)
        at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source)
        at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(Unknown 
Source)
        at org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipChar
(Unknown Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.
dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown Source)
        at org.apache.xerces.parsers.StandardParserConfiguration.parse(Unknown 
Source)
        at org.apache.xerces.parsers.StandardParserConfiguration.parse(Unknown 
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at TestParser.parseToNode(TestParser.java:52)
        at TestParser.run(TestParser.java:26)
        at TestParser.main(TestParser.java:18)
------------end of the exception--------------

Here is my java codes to parse the above simple xml-data:

  public static Node parseToNode(InputStream stream) throws Exception
  {
    DOMParser parser = new DOMParser();
    parser.setFeature("http://xml.org/sax/features/validation";, true);

    parser.parse(new InputSource(stream));
    Document dom = parser.getDocument();

    Node node = dom.getFirstChild();
    return node;
  }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to