You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Rebecca Searls Sun - Developer Engineering <Re...@Sun.COM> on 2001/10/11 00:11:02 UTC

Basic problem parsing XML data file


    I'm running xalan-j_2_2_d9 code: samples/applyxpath/ApplyXPath
    on Solaris 8.

    Having a problem parsing a simple XML data file.
    The parser throws a org.xml.sax.SAXParseException
    on the initial attempt to read the input stream.
    It craps out on the first 2 lines.  If the first
    two lines are removed it's happy.

    <?xml version="1.0" encoding="ISO8859_1"?>
    <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Applicat
ion 1.2// EN' 'http://java.sun.com/j2ee/dtds/application_1_2.dtd'>

    <application>
        <display-name>MyEjbAppWithClient</display-name>
    </application>


    I can not find the problem.  The doc says this should work.
    I've tried reading the first 2 line before handing the io
    stream to the DocumentBuilder; this fails as "The
    root element is required in a well-formed document."
    I tried running with the xercer DocumentBuilderFactory 
    but I get the same results. (-Djavax.xml.parsers.DocumentBuilderFactory
        =org.apache.xerces.jaxp.DocumentBuilderFactoryImpl


    Must the first 2 line be stripped from the file before
    this will work?  What am I missing?
~


------------- End Forwarded Message -------------