So, you have an XML document and you want to validate it against a schema? Well, if you follow the link XmlFaq you'll see that this is one of the many FAQ's we encounter in our XML forum. Follow the appropriate link from that page.
Joined: Sep 15, 2010
I want to validate user inputs as per the restrictions in the schema.
My plan is :
1. Call the webservice and get the schema (not going to store this schema physically. it will be in memory)
2. Read xmlschema using jdom and store element restrictions in javabeans.
3. Create Patterns and Matchers as per the restrictions for a particular element.
4. Validate user inputs in webpage using this Matchers.
Sorry, I would say that's a bad plan. Don't attempt to replicate the workings of schema validation on your own, especially when you're a beginner. Just use the standard process for validating a document against a schema.
Actually, reading your post carefully it sort of looks like you don't actually have an XML document to validate. If that's the case then why are you using an XML schema, whose whole purpose is to validate an XML document? If you just have a collection of rules which your field inputs have to follow, then I would recommend using one of the validators you get from one of the standard open-source frameworks. Don't drag in a complex beast like XML schema where it doesn't belong.