Sharad, Stanimir, Needing to check additional constraints on information beyond what a given constraint mechanism can accomplish 'out of the box' is a common problem. While programmatic unique extensions to a given constraint mechanism may be an option, many times it is something undesirable and the user would rather accomplish it in a declarative way. Something that may be of interest here, which allows using several constraint mechanisms:
http://www-128.ibm.com/developerworks/xml/library/x-bics20/ thanks, Scott ------------ Scott R. Hinkelman, Senior Software Engineer IBM Software Group / Emerging Technologies Cross-Industry SOA Foundation Standards Strategy Office: 512.823.8097 (TL 793.8097) Cell: 512.415.8490 Stanimir Stamenkov <[EMAIL PROTECTED] To .com> [email protected] cc 08/17/2006 08:20 AM Subject Re: help with extending saxparser todefine some addtional rules Please respond to [EMAIL PROTECTED] ache.org /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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
