XML syntax validation in Java

Viewed 52477

I've been trying to figure out how to check the syntax of an XML file, make sure all tags are closed, there's no random characters, etc... All I care at this point is making sure there is no broken XML in the file.

I've been looking at some SO posts like these...

... but I realized that I don't want to validate the structure of the XML file; I don't want to validate against an XML Schema (XSD)... I just want to check the XML syntax and determine if it is correct.

3 Answers
Related