xml validation

Hello,

 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 !!!

Goel.
pgoelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CeldricCommented:
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.
0
mightyoneCommented:
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...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CeldricCommented:
Interesting, im gonna check the link too :D
Regards mighty!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.