Using APIs for java XML validation

XML validation can also be done using the java API. A separate package is available with all the available classes and methods. You need to use the package javax.xml.validation if you want to use these classes.

As with other XML processing the key to this validation also is to load the XML document, you want to validate, in the Document object.

As a part of creating a document object you would need to create a DocumentBuilderFactory and then a DocumentBuilder. Then load the XML document you want to validate into the Document object.

Now our next task is to load the schema file to a schema object. For this you need to create a SchemaFactory and then create a schema object to load the schema file. Then the next step is to create a validator object to validate the document source. The validator object has a validate() method that is used to validate the document.



.

SetApp - 100 Apps for everything you ever wanted to do on Mac

FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________







 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!

Visit XML Training Material Guide Homepage

 

 

“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

Copyright - © 2004 - 2019 - All Rights Reserved.