Content is not allowed in prolog
843834May 30 2006 — edited May 30 2006Hi 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