Class XmlValidationService

java.lang.Object
gov.niem.tools.api.validation.xml.XmlValidationService

@Service public class XmlValidationService extends Object
Validate XML files against XML schemas.
  • Constructor Details

    • XmlValidationService

      public XmlValidationService()
  • Method Details

    • validateXsd

      public Test validateXsd(File[] xsdFiles) throws SAXException, IOException
      Validate the given XML schema files against the W3C XML Schema specification.
      Throws:
      SAXException
      IOException
    • validateXsd

      public Test validateXsd(org.springframework.web.multipart.MultipartFile multipartFile) throws Exception
      Runs XML schema validation on a single XSD file or a zip file of XSDs.
      Throws:
      Exception
    • validateXsdZip

      public Test validateXsdZip(File zipFile) throws Exception
      Validate the XSD files from the given zip file against the W3C XML Schema specification.
      Throws:
      Exception
    • validateXmlOnly

      public Test validateXmlOnly(File xmlFile, File[] xsdFiles, String testId, String description) throws SAXException, IOException
      Validate an XML file against the given XML schemas. Returns early with validation errors if the given XML schemas do not validate.
      Throws:
      SAXException
      IOException
    • validateXmlOnly

      public Test validateXmlOnly(File xmlFile, File[] xsdFiles) throws SAXException, IOException
      Validate an XML file against the given XML schemas. Returns early with validation errors if the given XML schemas do not validate.
      Throws:
      SAXException
      IOException
    • validateXmlOnly

      public Test validateXmlOnly(File xmlFile, Source[] xsdSources, String testId, String description) throws SAXException, IOException
      Validate an XML file against the given XML schemas. Returns early with validation errors if the given XML schemas do not validate.
      Throws:
      SAXException
      IOException
    • validateXml

      public Test[] validateXml(File xmlFile, File[] xsdFiles) throws SAXException, IOException
      Validate an XML file against the given XML schemas. Returns early with validation errors if the given XML schemas do not validate.
      Throws:
      SAXException
      IOException
    • validateXml

      public Test[] validateXml(org.springframework.web.multipart.MultipartFile multipartXmlFile, org.springframework.web.multipart.MultipartFile multipartXsdFile) throws Exception
      Validate the given XML file with the given XSD (single file) or XSD zipfile.
      Throws:
      Exception
    • validateXmlCatalog

      public Test validateXmlCatalog(org.springframework.web.multipart.MultipartFile xml) throws Exception
      Validate the given XML file with the OASIS schema for XML catalogs.
      Throws:
      Exception
    • validateXmlCatalog

      public Test validateXmlCatalog(File xmlFile) throws Exception
      Validate the given XML file with the OASIS schema for XML catalogs.
      Throws:
      Exception
    • logTestResults

      public void logTestResults(Test test)
      Log XML validation test results to the console.