Hi all,
I have set of XML files and they have a particular stucture. I want to validate the XML so that the stucture is fine always before using it.
Can anyone help with some samples like how to validate the XML files using java code.
Thanks...
Hi all,
I have set of XML files and they have a particular stucture. I want to validate the XML so that the stucture is fine always before using it.
Can anyone help with some samples like how to validate the XML files using java code.
Thanks...
You need to create an XML Schema file (.xsd
). This will define which elements may and may not be present in the file.
You can then use Java libraries to check that the XML file you have is compatible against this schema, see here: http://java.sun.com/developer/technicalArticles/xml/validationxpath/