public class DTDValidator extends Object
Constructor and Description |
---|
DTDValidator() |
Modifier and Type | Method and Description |
---|---|
void |
validateDir(File sourceDir,
SAXParserFactory spf)
Recursively validate a directory of XML files against a DTD.
|
public void validateDir(File sourceDir, SAXParserFactory spf) throws SAXException, ParserConfigurationException
ValidateDTD val = new ValidateDTD();
File sourceDir = new File("C:/OUTPUT");
//prepare the parsing
javax.xml.parsers.SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance();
spf.setValidating(true);
spf.setNamespaceAware(true);
val.validateDir(sourceDir, spf);
sourceDir
- the root directory containing XML files to be validatesspf
- the sax parserSAXException
- SAXExceptionParserConfigurationException
- ParserConfigurationExceptionCopyright © 2016. All rights reserved.