Package org.languagetool
Class XMLValidator
- java.lang.Object
-
- org.languagetool.XMLValidator
-
public final class XMLValidator extends Object
Validate XML files with a given DTD or XML Schema (XSD).- Author:
- Daniel Naber
-
-
Constructor Summary
Constructors Constructor Description XMLValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkSimpleXMLString(String xml)
Check some limits of our simplified XML output.void
validateStringWithXmlSchema(String xml, String xmlSchemaPath)
Validate XML file using the given XSD.void
validateWithDtd(String filename, String dtdPath, String docType)
Validate XML file in classpath with the given DTD.void
validateWithXmlSchema(String filename, String xmlSchemaPath)
Validate XML file using the given XSD.void
validateWithXmlSchema(String baseFilename, String filename, String xmlSchemaPath)
Validate XML file using the given XSD.void
validateXMLString(String xml, String dtdFile, String docType)
Validate XML with the given DTD.
-
-
-
Method Detail
-
checkSimpleXMLString
public void checkSimpleXMLString(String xml) throws IOException
Check some limits of our simplified XML output.- Throws:
IOException
-
validateXMLString
public void validateXMLString(String xml, String dtdFile, String docType) throws SAXException, IOException, ParserConfigurationException
Validate XML with the given DTD. Throws exception on error.
-
validateWithDtd
public void validateWithDtd(String filename, String dtdPath, String docType) throws IOException
Validate XML file in classpath with the given DTD. Throws exception on error.- Throws:
IOException
-
validateWithXmlSchema
public void validateWithXmlSchema(String filename, String xmlSchemaPath) throws IOException
Validate XML file using the given XSD. Throws an exception on error.- Parameters:
filename
- File in classpath to validatexmlSchemaPath
- XML schema file in classpath- Throws:
IOException
-
validateWithXmlSchema
public void validateWithXmlSchema(String baseFilename, String filename, String xmlSchemaPath) throws IOException
Validate XML file using the given XSD. Throws an exception on error.- Parameters:
baseFilename
- File to prepend common parts (unification) from before validating main filefilename
- File in classpath to validatexmlSchemaPath
- XML schema file in classpath- Throws:
IOException
-
validateStringWithXmlSchema
public void validateStringWithXmlSchema(String xml, String xmlSchemaPath) throws IOException
Validate XML file using the given XSD. Throws an exception on error.- Parameters:
xml
- the XML string to be validatedxmlSchemaPath
- XML schema file in classpath- Throws:
IOException
- Since:
- 2.3
-
-