2

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...

1 Answer 1

2

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.