Class XMLFileReader
java.lang.Object
eu.europa.ec.taxud.validation.reader.XMLFileReader
- All Implemented Interfaces:
Reader
XMLFileReader is an XML file reader provided with the validation module core module.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the context path required by the reader to read the input source.getCurrentNode(Transformer t, XMLStreamReader xsr) Return current XML Stream position as Node.Return the input format supported by the reader.Get information required by the reader to read the input source.voidnumberXPath(Node node, int index) Assign PATH to all node in the tree.voidread(ValidationInput input, ValidationContext context) Main method to process the input.voidsetContextPath(String contextPath) Set the context path required by the reader to read the input source.voidsetReaderInfo(Map<String, Class<?>> readerInfo) Set information required by the reader to read the input source.voidsetValidator(Validator validator) Set Validation to call during the reading.voidvalidate(LightweightElement lwElem, ValidationContext context) Validate the business object expected in the rule (lightweight element).voidvalidate(Node node, ValidationContext context, Class<?> ruleClass) Validate the business object expected in the rule (POJO or Node).
-
Constructor Details
-
XMLFileReader
public XMLFileReader()Constructor.
-
-
Method Details
-
getInputFormat
Return the input format supported by the reader.- Specified by:
getInputFormatin interfaceReader- Returns:
- Input format supported by the reader
-
setValidator
Set Validation to call during the reading.- Specified by:
setValidatorin interfaceReader- Parameters:
validator- Validation to apply.
-
read
Main method to process the input.- Specified by:
readin interfaceReader- Parameters:
input- The input to readcontext- Validation context with all information required- Throws:
ValidationException- The validation exception.
-
numberXPath
Assign PATH to all node in the tree.- Parameters:
node- Root Node from which numbering starts.index- Current list index of Node.
-
validate
public void validate(Node node, ValidationContext context, Class<?> ruleClass) throws ValidationException Validate the business object expected in the rule (POJO or Node).- Parameters:
node- Root node for validation.context- Context information.ruleClass- Target class for current node.- Throws:
ValidationException- Validation exception.
-
validate
public void validate(LightweightElement lwElem, ValidationContext context) throws ValidationException Validate the business object expected in the rule (lightweight element).- Parameters:
lwElem- Element for validation.context- Context information.- Throws:
ValidationException- Validation exception.
-
getCurrentNode
Return current XML Stream position as Node.- Parameters:
t- Transformer to use.xsr- Current XMLStreamReader position.- Returns:
- Node of current XMLStreamReader position.
- Throws:
ValidationException- Exception raised in transformation process.
-
getReaderInfo
Get information required by the reader to read the input source.- Returns:
- Reader information
-
setReaderInfo
Set information required by the reader to read the input source.- Parameters:
readerInfo- information
-
getContextPath
Get the context path required by the reader to read the input source.- Returns:
- The context path
-
setContextPath
Set the context path required by the reader to read the input source.- Parameters:
contextPath- The context path
-