xml validation

Posted on 2004-11-02
Medium Priority
Last Modified: 2013-11-23

 I am creating an xml document using DOM implementation by Xerces in java . I would like to validate each element using the pre-defined xml schema when its(xml file) created rather than validate the whole file at a time. Basically the idea is to get rid of the invalid xml elements (may get due to database errors) at the time of creating xml file itself. I know to set the validation features on the domparser to validate the whole file but need to know how can I validate element by element i.e on the fly. Can anyone help me with a snippet of the code to do this....

Thanks in advance !!!

Question by:pgoel
  • 2

Expert Comment

ID: 12483336
Whoa, know almost nothing of this, but its interesting.
My limited knowledge of XML Parses tell me to ask you if you have considered
DTD's although i dont know how they work I know they are used to check
XML tags and invalidate the ones that dont match up to the DTD syntax.

If you like, i could do some research later on at lunch time and help you out.

But maybe you are too far an expert and already know DTDs, which, if you are I ask you
to share the details here, so I can learn some :D

Thanks in advance.

Accepted Solution

mightyone earned 300 total points
ID: 12486510
see www.cafeconleche.org....

there you find a book to download: javaandxml i think it was chapter 9!

good luck

to celdric:

DTD just lets you check if a tag is present, madatory or optinal, but lets you not validate it´s value, therefore you use shemas...

Expert Comment

ID: 12486534
Interesting, im gonna check the link too :D
Regards mighty!

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question