aspose file tools*
The moose likes XML and Related Technologies and the fly likes SAXParseException: for 2 following marshals Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "SAXParseException: for 2 following marshals" Watch "SAXParseException: for 2 following marshals" New topic
Author

SAXParseException: for 2 following marshals

Dupont Girard
Greenhorn

Joined: Mar 21, 2011
Posts: 24
Hello,

I struggle to run this following code:



This is the exception raised:


My xml schema is correctly built and works perfectly for 1 marshal but not for 2 marshals followed

Someone Have an idea how to resolve this ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It looks as if you have two XML documents concatenated together in the same file.
Dupont Girard
Greenhorn

Joined: Mar 21, 2011
Posts: 24
Thanks Paul for replying. is it not recommended ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I don't know about "recommended". I do know that if you give such a file to a parser and claim that it's an XML document, the parser will tell you (correctly) that it isn't a well-formed XML document.

A well-formed XML document has an optional prolog (the <?xml ... > part) at the beginning followed by a single root element. And nothing else.

If the parser sees a prolog in the middle of the document, it will attempt to treat it as a processing-instruction. And since processing-instructions in an XML document can't be named "xml", you get the error message which tells you that.
 
 
subject: SAXParseException: for 2 following marshals