Xerces validates the document while parsing. So it does by default the thing
you ask for.
But if you need more validation then can be described in a schema then you
might try this.

Parse the file with SAX. The internal validator validates each element
against the schema before calling the SAX eventhandler.
In the eventhandler do your extended validations.
If valid, add the element to a document tree (hence build your own
DOMDocument with the standard DOMDocument API)

Regards

Erik Rydgren
Mandarinen systems AB
Sweden


-----Original Message-----
From: Bagepalli, Kiran [mailto:[EMAIL PROTECTED]
Sent: den 25 mars 2003 00:34
To: '[EMAIL PROTECTED]'
Subject: Validating DOM


Is there a way for me to validate the DOM content while building.
Essentially I am interested in element and attribute content only. Does the
value for the elements adhere to the schema. Things like default
values/restrictive datatypes etc. Is there anyway I could get to a
XMLElementDecl and call a validate given a value string.

I do not want to validate at the end and say the whole document is not
valid. I want to say it is not valid while building.
I am not interested in the complicated content spec but atleast the values
should be correct.

Thanks
Kiran


�


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to