You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Williamson, Siehnai" <sw...@docucorp.com> on 2000/10/18 22:15:33 UTC

Fatal error after comment

Hi Guys,

I keep getting a fatal error  "Expected comment or processing instruction".


The error occurs when comments exist after the root element in a file.   For
example, whenever the SAX parser parses the file below, it throws an error
at Line 7, Column 5 saying that a comment or processing instruction is
expected.  The comment is pulled in (as shown in the advance handler) but
the parser seems to have a problem with the element following the comment.
If the comment is BEFORE the root element, then all is well.  I couldn't
seem to find where having comments after the root is a violation of SAX
rules.  Is it, or is this simply a Xerces problem?

<?xml version="1.0"?>

<!-- Various test -->

<tests>
    <!-- First group of test -->
    <test id="Test1">Test 1</test>
    <test id="Test2"/>
    <test id="Test3" sample="1">AT&amp;T</test>

    <!-- Second group of test -->
    <test id="Test4">4 &lt; 5</test>
    <test id="Test5">&apos;Test 5&apos;</test>
    <test id="Test6">A&#98;&#x63;d</test>
    
    <!-- Third group of test -->
    <test id="Test7">A CDATA: <![CDATA[<Hello>]]></test>
</tests>