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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 18113
    
    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: 18113
    
    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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SAXParseException: for 2 following marshals
 
Similar Threads
JAXB and XmlJavaTypeAdapter
get "java.net.SocketException: socket closed", even if i am using HTTP connection
Unable to locate jaxb.properties
Jboss class cast exception: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
Communication between a Swing Client and a Servlet via HttpURLConnection