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!

Content is not allowed in prolog

843834May 30 2006 — edited May 30 2006
Hi guys,
I got a strange thing: I use a XML Parser and it worked fine. but some days after it did not work anymore and I did not touch anything.
However, I have this error:

"Content is not allowed in prolog."

I read various topics about it, so I checked if the document is well formed (and it is with xmlspy) , if it contains characters not in the UTF-8 (and it does not) and so on.

I add the code that generates the error: it seems to be easy:

public NodeList PrepareDocument(String Filename) {

Document document = null;
InputSource is;
NodeList root;

DOMParser parser = new DOMParser();
String xmlString = URLDecoder.decode( Filename );
is = new InputSource( new StringReader( xmlString ) );


try {
parser.parse(is);
document = parser.getDocument();
} catch (SAXException spe) {
System.err.println(spe);
} catch (IOException ioe) {
System.err.println(ioe);
}
root = document.getChildNodes();
return root;
}

Tomcat signals the error at "root=document.getChildNodes()".

how can I solve this?
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 27 2006
Added on May 30 2006
1 comment
250 views