uk.org.jcam.processor.validator
Class DefaultValidator
java.lang.Object
uk.org.jcam.processor.validator.DefaultValidator
- All Implemented Interfaces:
- IValidator
- Direct Known Subclasses:
- UnOrderedValidatorLax
public class DefaultValidator
- extends java.lang.Object
- implements IValidator
|
Method Summary |
boolean |
checkKeyItems(java.lang.String ID)
|
boolean |
expandRepeats(org.jdom.Element templateElement,
org.jdom.Element xmlFileElement)
|
void |
generateExtraChildFieldsError(org.jdom.Element xmlFileElement,
java.lang.Object[] xmlFileElementListofChildren)
|
boolean |
Validate()
|
boolean |
Validate(org.jdom.Element templateElement,
org.jdom.Element xmlFileElement,
boolean ordered)
Validates the CAMtemplate.xmlfile against CAMtemplate.template
Logic: For every element/attribute in Trimmed Document
check exist associated item in xmlfile
check correct values etc against CAMtemplate attributes
Recurses through the Template Tree keep trees in step for makeRepeatable and makeOptional
check if element is repeatable
if so count number of repetitions in xmlfile and duplicate that number in template. |
boolean |
Validate(java.lang.String ID)
|
boolean |
validateChildren(org.jdom.Element templateElement,
org.jdom.Element xmlFileElement)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultValidator
public DefaultValidator(Template template,
IDataFile xmlfile,
ITrimmer trimmer)
Validate
public boolean Validate()
throws ValidatorException
- Specified by:
Validate in interface IValidator
- Returns:
- boolean
- Throws:
ValidatorException
java.net.MalformedURLException
Validate
public boolean Validate(org.jdom.Element templateElement,
org.jdom.Element xmlFileElement,
boolean ordered)
throws NamespaceException,
Parameter.ParameterException,
Parameters.ParametersException,
Parser.ParserException,
FunctionException,
Condition.ConditionInvalidArguments,
org.jdom.JDOMException,
java.io.IOException,
org.jaxen.JaxenException,
TrimmerException
- Validates the CAMtemplate.xmlfile against CAMtemplate.template
Logic: For every element/attribute in Trimmed Document
check exist associated item in xmlfile
check correct values etc against CAMtemplate attributes
Recurses through the Template Tree keep trees in step for makeRepeatable and makeOptional
check if element is repeatable
if so count number of repetitions in xmlfile and duplicate that number in template.
remove is repeatable attribute
- Returns:
- true is validation completed OK false if not
- Throws:
java.io.IOException
org.jaxen.JaxenException
TrimmerException
NamespaceException
Parameter.ParameterException
Parameters.ParametersException
Parser.ParserException
FunctionException
Condition.ConditionInvalidArguments
org.jdom.JDOMException
Validate
public boolean Validate(java.lang.String ID)
throws ValidatorException
- Specified by:
Validate in interface IValidator
- Returns:
- boolean
- Throws:
java.net.MalformedURLException
ValidatorException
validateChildren
public boolean validateChildren(org.jdom.Element templateElement,
org.jdom.Element xmlFileElement)
throws NamespaceException,
Parameter.ParameterException,
Parameters.ParametersException,
Parser.ParserException,
FunctionException,
Condition.ConditionInvalidArguments,
org.jdom.JDOMException,
java.io.IOException,
org.jaxen.JaxenException,
TrimmerException
- Throws:
NamespaceException
Parameter.ParameterException
Parameters.ParametersException
Parser.ParserException
FunctionException
Condition.ConditionInvalidArguments
org.jdom.JDOMException
java.io.IOException
org.jaxen.JaxenException
TrimmerException
checkKeyItems
public boolean checkKeyItems(java.lang.String ID)
throws org.jdom.JDOMException,
Parameters.ParametersException,
org.jaxen.JaxenException
- Throws:
org.jdom.JDOMException
Parameters.ParametersException
org.jaxen.JaxenException
expandRepeats
public boolean expandRepeats(org.jdom.Element templateElement,
org.jdom.Element xmlFileElement)
throws java.lang.NumberFormatException
- Throws:
java.lang.NumberFormatException
generateExtraChildFieldsError
public void generateExtraChildFieldsError(org.jdom.Element xmlFileElement,
java.lang.Object[] xmlFileElementListofChildren)