Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

org.xml.sax.SAXParseException: Content is not allowed in prolog

843834Sep 5 2006 — edited Sep 5 2006
I have parsed same XML file in Java 1.4 and Java 1.5

But java 1.4 shows desired result but Java 1.5 gives

"org.xml.sax.SAXParseException: Content is not allowed in prolog"

error....
I think that the a node along with childnodes cannot convert into String here..............

How I handle this case so that it is compatable in both version or atleast Java 1.5.............which are the api ( s ) I have to use to handle this case in Java 1.5 .........

Java 1.4 code is something like this where the same code gives error in Java 1.5........

String str =  list.item(0).toString() ;     // here list is an object of NodeList
Document xmlDoc =  builder.parse( new InputSource( new StringReader (str));  // here builder is an object of DocumentBuilder  
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2006
Added on Sep 5 2006
1 comment
160 views