Skip to Main Content

Java Programming

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!

[Fatal Error] :1:1: Content is not allowed in prolog.

810618Nov 16 2010 — edited Nov 17 2010
When Java's XML parser - the one you get from:
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = f.newDocumentBuilder();
Doesn't like what it is being fed during a parse, you see the above message on the console.

Why in the world, did someone take it upon themselves to do this and not pass this as an Exception instead? If you don't happen to be staring at the console (the likely case for server programs), you will never know that you have a problem.

I've seen this problem all over the web, but the responses have been about how to fix the XML. I would be interested in how to fix the parser so that it lets us know about the problem. (I would also be interested in twisting the ear of the programmer that did this, but that's beside the point : ).

Does someone know how I can 'catch' these error messages?

Thanks,

Kevin

Edited by: KevinRyan on Nov 16, 2010 6:14 AM

Edited by: KevinRyan on Nov 16, 2010 6:27 AM
This post has been answered by walterln on Nov 16 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2010
Added on Nov 16 2010
5 comments
1,175 views