Interface XMLValidator


public interface XMLValidator
  • Method Details

    • isValid

      Validates the input XML data against its schema.
      Returns:
      true on success, false on failure. In case of an error, use function getLastErrorMessage() to get additional information.
      Throws:
      RaptorXMLException
    • isValid

      boolean isValid() throws RaptorXMLException
      Throws:
      RaptorXMLException
    • isWellFormed

      boolean isWellFormed(XMLValidator.ENUMWellformedCheckType type) throws RaptorXMLException
      Checks the input XML data for well-formedness.
      Returns:
      true on success, false on failure. In case of an error, use function getLastErrorMessage to get additional information.
      Throws:
      RaptorXMLException
    • isWellFormed

      boolean isWellFormed() throws RaptorXMLException
      Throws:
      RaptorXMLException
    • extractAvroSchema

      boolean extractAvroSchema(String outputPath) throws RaptorXMLException
      Extract a AVRO schema document from a binary file
      Parameters:
      outputDir - an absolute URL to which the output should be saved.
      Returns:
      true on success, false on failure. In case of an error, use function getLastErrorMessage to get additional information.
      Throws:
      RaptorXMLException
    • setInputFileName

      void setInputFileName(String filePath)
      Set the file name for the input XML data. Please note that you have to use absolute URLs.
      Parameters:
      filePath - an absolute URL giving the base location of the XML data.
    • setInputXMLFileName

      @Deprecated void setInputXMLFileName(String filePath)
      Deprecated.
    • setInputFileCollection

      void setInputFileCollection(Collection<String> fileCollection)
      Set a collection of XML files as input data. Please note that you have to use absolute URLs.
      Parameters:
      fileCollection - Collection of strings containing absolute URLs
    • setInputXMLFileCollection

      @Deprecated void setInputXMLFileCollection(Collection<String> fileCollection)
    • setSchemaFileName

      void setSchemaFileName(String filePath)
      Set file name for external Schema.
      Parameters:
      filePath - an absolute URL giving the base location of the Schema
    • setSchemaFileCollection

      void setSchemaFileCollection(Collection<String> fileCollection)
      Set a collection of files as external schemas
      Parameters:
      fileCollection - array of absolute URLs of the schemas
    • setDTDFileName

      void setDTDFileName(String filePath)
      Set file name for external DTD.
      Parameters:
      filePath - an absolute URL giving the base location of the DTD.
    • setJSONSchemaFileName

      void setJSONSchemaFileName(String filePath)
      Set file name for external JSON schema.
      Parameters:
      filePath - an absolute URL giving the base location of the JSON schema file.
    • setAvroSchemaFileName

      void setAvroSchemaFileName(String filePath)
      Set file name for external Avro schema.
      Parameters:
      filePath - an absolute URL giving the base location of the Avro schema file.
    • setInputFromText

      void setInputFromText(String inputText)
      Set the text value for the input XML data. Example: setInputXMLFromText( " text " )
      Parameters:
      inputText - a string containing XML data
    • setInputXMLFromText

      @Deprecated void setInputXMLFromText(String inputText)
      Deprecated.
    • setInputTextCollection

      void setInputTextCollection(Collection<String> stringCollection)
      Set a collection of strings as input
      Parameters:
      stringCollection - collection of strings containing input documents
    • setInputXMLTextCollection

      @Deprecated void setInputXMLTextCollection(Collection<String> stringCollection)
    • setSchemaFromText

      void setSchemaFromText(String schemaText)
      Set text value for external Schema.
      Parameters:
      schemaText - string containing Schema as text.
    • setSchemaTextCollection

      void setSchemaTextCollection(Collection<String> stringCollection)
      Set a collection of strings as external schemas
      Parameters:
      stringCollection - collection of strings containing additional schemas as text
    • setDTDFromText

      void setDTDFromText(String dtdText)
      Set text value for external DTD.
      Parameters:
      dtdText - string containing DTD as text
    • setJSONSchemaFromText

      void setJSONSchemaFromText(String schemaText)
      Set text value for JSON schema.
      Parameters:
      schemaText - string containing JSON Schema as text
    • setAvroSchemaFromText

      void setAvroSchemaFromText(String schemaText)
      Set text value for Avro schema.
      Parameters:
      schemaText - string containing Avro Schema as text
    • getLastErrorMessage

      String getLastErrorMessage()
      Get the last error message from the engine.
      Returns:
      last error message
    • setEnableNamespaces

      void setEnableNamespaces(boolean enable)
      Enable/disable namespace processing
    • setXSDVersion

      void setXSDVersion(XMLValidator.ENUMXSDVersion version)
      XSD specification version
      Parameters:
      version - Version to be used by the validation engine
    • setXincludeSupport

      void setXincludeSupport(boolean support)
      Enable/disable xinclude support
    • setAssessmentMode

      void setAssessmentMode(XMLValidator.ENUMAssessmentMode mode)
      Assessment mode
      Parameters:
      mode - Assessment mode to be used by the validation engine
    • setXMLValidationMode

      void setXMLValidationMode(XMLValidator.ENUMXMLValidationMode mode)
      Processing mode
      Parameters:
      mode - XML Validation mode to be used by the validation engine
    • setSchemalocationHints

      void setSchemalocationHints(XMLValidator.ENUMLoadSchemalocation opt)
      Configure the usage of the xsi:schemaLocation hints
    • setSchemaImports

      void setSchemaImports(XMLValidator.ENUMSchemaImports opt)
      Configure the usage of the xsi:schemaLocation hints
    • seSchemaImports

      @Deprecated void seSchemaImports(XMLValidator.ENUMSchemaImports opt)
      Configure the usage of the xsi:schemaLocation hints
    • setSchemaMapping

      void setSchemaMapping(XMLValidator.ENUMSchemaMapping opt)
      Configure the usage of the xsi:schemaLocation hints
    • setPythonScriptFile

      void setPythonScriptFile(String file)
      Python script to be executed after a successful validation.
      Parameters:
      file - path of the script file.
    • setStreaming

      void setStreaming(boolean support)
      Enable/disable streaming.
    • setParallelAssessment

      void setParallelAssessment(boolean support)
      Enable/disable parallel schema validity assessment.
    • setJson5

      void setJson5(boolean json5)
      Enable/disable json5 support. Default value is false.
    • setJsonC

      void setJsonC(boolean jsonC)
      Enables support for comments in JSON. Default value is false.
    • setJsonLines

      void setJsonLines(boolean jsonLines)
      Enables support for JSON Lines (that is, one JSON value per line). Default value is false.
    • setJsonSchemaVersion

      void setJsonSchemaVersion(String strJsonSchemaVersion)
      Specifies which version of the JSON Schema specification draft version to use. Default is detect. Use one of draft04|draft06|draft07|2019-09|2020-12|latest|detect.