• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading xmlschema file

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

My requirement is like this.

1. I need to validate user inputs in a web application. For example user name field.

2. I get user name field restrictions from a xml schema by calling a webservice on the fly.


3. I need to read the schema and validate user input as per the restrictions in xmlschema.

What will be the best approach? I have a plan to accomplish this task. But would like to take experts advice.

Rgds
Peter
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
James Peter
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.


Rgds
Peter
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our XML forum.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic