org.apache.commons.jelly.tags.validate
Class ValidateTag
java.lang.Object
|
+--org.apache.commons.jelly.TagSupport
|
+--org.apache.commons.jelly.tags.validate.ValidateTag
- All Implemented Interfaces:
- Tag
- Direct Known Subclasses:
- AssertValidTag
- public class ValidateTag
- extends TagSupport
This tag validates its body using a schema Verifier which can
validate against DTDs, XML Schema, RelaxNG, Relax or TREX.
Any JARV compliant Verifier could be used.
The error messages are output as XML events so that they can be styled by the parent tag.
- Version:
- $Revision: 1.1 $
- Author:
- James Strachan
Method Summary |
void |
doTag(XMLOutput output)
Evaluates this tag after all the tags properties have been initialized. |
org.xml.sax.ErrorHandler |
getErrorHandler()
|
protected void |
handleValid(boolean valid)
Processes whether or not the document is valid. |
protected void |
outputException(XMLOutput output,
java.lang.String name,
org.xml.sax.SAXParseException e)
Outputs the given validation exception as XML to the output |
void |
setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Sets the SAX ErrorHandler which is used to capture
XML validation events. |
void |
setVar(java.lang.String var)
Sets the name of the variable that will contain a boolean flag for whether or
not the XML is valid. |
void |
setVerifier(org.iso_relax.verifier.Verifier verifier)
Sets the schema Verifier that this tag will use to verify its body |
Methods inherited from class org.apache.commons.jelly.TagSupport |
findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isTrim, setBody, setContext, setParent, setTrim, trimBody |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ValidateTag
public ValidateTag()
doTag
public void doTag(XMLOutput output)
throws java.lang.Exception
- Description copied from interface:
Tag
- Evaluates this tag after all the tags properties have been initialized.
setVerifier
public void setVerifier(org.iso_relax.verifier.Verifier verifier)
- Sets the schema Verifier that this tag will use to verify its body
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
- Returns:
- the ErrorHandler used when validating
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
- Sets the SAX ErrorHandler which is used to capture
XML validation events.
If an ErrorHandler is specified
then this tag will output its body and redirect all error messages
to the ErrorHandler.
If no ErrorHandler is specified then this tag will just output the
error messages as XML events
setVar
public void setVar(java.lang.String var)
- Sets the name of the variable that will contain a boolean flag for whether or
not the XML is valid.
handleValid
protected void handleValid(boolean valid)
throws java.lang.Exception
- Processes whether or not the document is valid.
Derived classes can overload this method to do different things, such
as to throw assertion exceptions etc.
outputException
protected void outputException(XMLOutput output,
java.lang.String name,
org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- Outputs the given validation exception as XML to the output
Copyright © 2002-2002 Apache Software Foundation. All Rights Reserved.