/Sharad Singh/:

I am using the SAXParser provided in the xerces.jar through which i am able to validate xml based on dtd validations. Now I need to extend the Saxparser functionality so that i can define some additional rules and perform validations on that rules. Can anyone please tell me how can i do that?

for EXAMPLE i would like to validate expression : a+(b+c)
on following grammar that the brackets are properly closed and the operator + must have two operands....
I will have the expression written in the xml as
<mytag> a+(b+c) </mytag>

So you have already written an |org.xml.sax.ContentHandler| implementation to read the element text content? Then you process it in whatever fashion you need and you could throw a |org.xml.sax.SAXException| (you may make a subtype you handle specifically) from your handler to terminate the parsing if something is not valid - all handler methods are declared to throw |org.xml.sax.SAXException|. That content validation of course is specific to your application and is not something you could get out of the box using standard XML validation.

--
Stanimir

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

Reply via email to