Xerces xml Parsing error

From: Dan (danthony74_at_hotmail.com)
Date: 02/27/04


Date: Thu, 26 Feb 2004 23:47:23 GMT

Hi,
I've just installed Xerces 2.5 to try and use SAX to parse some xml (was
having problems before).

Now every time I attempt to parse, I'm getting the following:
org.xml.sax.SAXParseException: Content is not allowed in prolog.

The xml is:
<?xml version="1.0"?>
<message sender="sadasdssad" dateSent="Feb 26, 2004 3:55:24 PM CST">
<messageBody>
sadsadadsa
</messageBody>
</message>

The code is:
<CODE>
StringReader stringReader = new StringReader(message);
InputSource in = new InputSource(stringReader);
parser = new SAXParser(); //org.apache.xerces.parsers.SAXParser
parser.setContentHandler(this);
System.out.println("About to Parse.");
System.out.println(message.charAt(0)); // first char is firschar of prolog
parser.parse(in);
</CODE>

Does anyone have any idea what's going on here? I've been beating my head
against a wall for a day now.

Thanks in advance,

D.



Relevant Pages

  • Re: Sending existing XML document to a document-literal web servic
    ... So the WSDL defines a type ... I don't want to parse the existing document and load the productOrderType ... My understanding is that you can use XmlSerializer to read the XML document ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: XML editor using MFC
    ... add elements to the tree control. ... XML tree is represented by an HTREEITEM. ... except for the CDATA stuff which is a real pain to parse. ... Error recovery: simplest form, when you find an error, throw a CException-derived class, ...
    (microsoft.public.vc.mfc)
  • Parsing XML data as it arrives from LWP call
    ... I am trying to improve the performance of a Perl application that uses LWP ... I would like to parse the resulting XML data as it's being returned as ... Build request XML input parms ...
    (comp.lang.perl.modules)
  • Re: Logfile analysing with pyparsing
    ... You can parse it just once, you just have to setup your data structure ... I inferred this from your XML. ... But looking through the logfile is a time consuming process. ...
    (comp.lang.python)
  • Heuristic backtrack in Prolog?
    ... I'm trying to learn Prolog because it's a very interesting language and seems to be on par with LISP with respect to freedom of expression:) My own experience with Prolog is limited to writing some parsers and recursive predicates such as permutations and so on. ... Another execution environment I've needed is a heuristic parser where each alternative parse has a probability. ... Ordinary Prolog backtracking is a special case of such an environment where fail:- probability. ...
    (comp.lang.prolog)