Class XMLFileReader

java.lang.Object
eu.europa.ec.taxud.validation.reader.XMLFileReader
All Implemented Interfaces:
Reader

public class XMLFileReader extends Object implements Reader
XMLFileReader is an XML file reader provided with the validation module core module.
  • Constructor Details

    • XMLFileReader

      public XMLFileReader()
      Constructor.
  • Method Details

    • getInputFormat

      public InputFormatType getInputFormat()
      Return the input format supported by the reader.
      Specified by:
      getInputFormat in interface Reader
      Returns:
      Input format supported by the reader
    • setValidator

      public void setValidator(Validator validator)
      Set Validation to call during the reading.
      Specified by:
      setValidator in interface Reader
      Parameters:
      validator - Validation to apply.
    • read

      public void read(ValidationInput input, ValidationContext context) throws ValidationException
      Main method to process the input.
      Specified by:
      read in interface Reader
      Parameters:
      input - The input to read
      context - Validation context with all information required
      Throws:
      ValidationException - The validation exception.
    • numberXPath

      public void numberXPath(Node node, int index)
      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

      public Node getCurrentNode(Transformer t, XMLStreamReader xsr) throws ValidationException
      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

      public Map<String,Class<?>> getReaderInfo()
      Get information required by the reader to read the input source.
      Returns:
      Reader information
    • setReaderInfo

      public void setReaderInfo(Map<String,Class<?>> readerInfo)
      Set information required by the reader to read the input source.
      Parameters:
      readerInfo - information
    • getContextPath

      public String getContextPath()
      Get the context path required by the reader to read the input source.
      Returns:
      The context path
    • setContextPath

      public void setContextPath(String contextPath)
      Set the context path required by the reader to read the input source.
      Parameters:
      contextPath - The context path