Class XmlValidationService
java.lang.Object
gov.niem.tools.api.validation.xml.XmlValidationService
Validate XML files against XML schemas.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
logTestResults
(Test test) Log XML validation test results to the console.Test[]
validateXml
(File xmlFile, File[] xsdFiles) Validate an XML file against the given XML schemas.Test[]
validateXml
(org.springframework.web.multipart.MultipartFile multipartXmlFile, org.springframework.web.multipart.MultipartFile multipartXsdFile) Validate the given XML file with the given XSD (single file) or XSD zipfile.validateXmlCatalog
(File xmlFile) Validate the given XML file with the OASIS schema for XML catalogs.validateXmlCatalog
(org.springframework.web.multipart.MultipartFile xml) Validate the given XML file with the OASIS schema for XML catalogs.validateXmlOnly
(File xmlFile, File[] xsdFiles) Validate an XML file against the given XML schemas.validateXmlOnly
(File xmlFile, File[] xsdFiles, String testId, String description) Validate an XML file against the given XML schemas.validateXmlOnly
(File xmlFile, Source[] xsdSources, String testId, String description) Validate an XML file against the given XML schemas.validateXsd
(File[] xsdFiles) Validate the given XML schema files against the W3C XML Schema specification.validateXsd
(org.springframework.web.multipart.MultipartFile multipartFile) Runs XML schema validation on a single XSD file or a zip file of XSDs.validateXsdZip
(File zipFile) Validate the XSD files from the given zip file against the W3C XML Schema specification.
-
Constructor Details
-
XmlValidationService
public XmlValidationService()
-
-
Method Details
-
validateXsd
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
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
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
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
Validate the given XML file with the OASIS schema for XML catalogs.- Throws:
Exception
-
logTestResults
Log XML validation test results to the console.
-