Two Laptop Bag*
The moose likes XML and Related Technologies and the fly likes XML parser to validate XML docs in my Servlet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML parser to validate XML docs in my Servlet." Watch "XML parser to validate XML docs in my Servlet." New topic
Author

XML parser to validate XML docs in my Servlet.

sreeni san
Ranch Hand

Joined: Aug 14, 2001
Posts: 39
Hi,

I need to write an XML parser to validate two XML docs in my Servlet.

The Administator will have some features provisioned for the user, which will be stored as an Admin XML doc.

The user logs-in and will be presented with a page wherein the user can avail only the features enabled by the Admin. Once the user submits the form (the XML is generated in the front end and the same is posted to the Servlet), I need to validate/compare the user XML and Admin XML to check whether the user is eligible to avail a certain feature.


Admin XML will be as follows:

<Admin user="xyz">
<feature1 enabled="Y"/>
<feature2 enabled="N"/>
</Admin>

User XML will be as follows:

<User user="xyz">
<feature1 enabled="Y"><val>abcd</val></feature1>
<feature2 enabled="N"/>
</User>


Thanks,
Sreeni.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60749
    
  65

Not a servlet issue, so this has been moved to the XML forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Originally posted by sreeni san:
I need to write an XML parser to validate two XML docs in my Servlet.
I disagree. I think you should use the XML parser that's already built into Java 1.4 and later.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML parser to validate XML docs in my Servlet.
 
Similar Threads
Struts 1.1 - Tomcat 4.1.30 deployment problem
how to validate an xml using DTD in DOM parser
Get values from only child elements
how to validate an XML using DTD in Dom parser
How to parse special charcacters(&)