|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.xml.XMLValidator
XMLValidator uses Xerces to parse and validate xml files in a directory or an individual xml file you specify. Each xml file should contain a DOCTYPE declaration or a schema reference, which is used to perform the validation. XMLValidator then writes a report to the file path indicated listing the number of files validated and any validation problems encountered. How: Use JAXP SAXPaser to parse 1 .xml file or all the .xml files in a directory.
Field Summary | |
---|---|
protected static boolean |
DEFAULT_DYNAMIC_VALIDATION
Default dynamic validation support (false). |
protected static boolean |
DEFAULT_MEMORY_USAGE
Default memory usage report (false). |
protected static boolean |
DEFAULT_NAMESPACE_PREFIXES
Default namespace prefixes (false). |
protected static boolean |
DEFAULT_NAMESPACES
Default namespaces support (true). |
protected static String |
DEFAULT_PARSER_NAME
Default parser name. |
protected static boolean |
DEFAULT_SCHEMA_FULL_CHECKING
Default Schema full checking support (false). |
protected static boolean |
DEFAULT_SCHEMA_VALIDATION
Default Schema validation support (false). |
protected static boolean |
DEFAULT_TAGGINESS
Default "tagginess" report (false). |
protected static boolean |
DEFAULT_VALIDATION
Default validation support (false). |
protected static String |
DYNAMIC_VALIDATION_FEATURE_ID
Dynamic validation feature id (http://apache.org/xml/features/validation/dynamic). |
protected static String |
NAMESPACE_PREFIXES_FEATURE_ID
Namespace prefixes feature id (http://xml.org/sax/features/namespace-prefixes). |
protected static String |
NAMESPACES_FEATURE_ID
Namespaces feature id (http://xml.org/sax/features/namespaces). |
protected static String |
SCHEMA_FULL_CHECKING_FEATURE_ID
Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking). |
protected static String |
SCHEMA_VALIDATION_FEATURE_ID
Schema validation feature id (http://apache.org/xml/features/validation/schema). |
protected static String |
VALIDATION_FEATURE_ID
Validation feature id (http://xml.org/sax/features/validation). |
Constructor Summary | |
---|---|
XMLValidator()
|
Method Summary | |
---|---|
static void |
main(String[] args)
The main program for the XMLValidator class |
StringBuffer |
validate(String filePath)
Validate a single XML file or directory of XML files. |
StringBuffer |
validate(String filePath,
String[] inputFileNames)
Validate a single XML file or directory of XML files, processing only the xml files that match the ID list provided. |
StringBuffer |
validate(String filePath,
String[] inputFileNames,
String reportFilePath)
Validate a single XML file or directory of XML files. |
static String |
validateFile(File f)
Validates an XML File to the external DTD or schema that is present in the File. |
static String |
validateFile(File f,
boolean showWarnings)
Validates an XML File to the external DTD or schema that is present in the File. |
static String |
validateString(String s)
Validates an XML String to the external DTD or schema that is present in the String. |
static String |
validateString(String s,
boolean showWarnings)
Validates an XML String to the external DTD or schema that is present in the String. |
static String |
validateUri(String URI)
Validates an XML document at the given URI. |
static String |
validateUri(String URI,
boolean showWarnings)
Validates an XML document at the given URI. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final String NAMESPACES_FEATURE_ID
protected static final String NAMESPACE_PREFIXES_FEATURE_ID
protected static final String VALIDATION_FEATURE_ID
protected static final String SCHEMA_VALIDATION_FEATURE_ID
protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID
protected static final String DYNAMIC_VALIDATION_FEATURE_ID
protected static final String DEFAULT_PARSER_NAME
protected static final boolean DEFAULT_NAMESPACES
protected static final boolean DEFAULT_NAMESPACE_PREFIXES
protected static final boolean DEFAULT_VALIDATION
protected static final boolean DEFAULT_SCHEMA_VALIDATION
protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING
protected static final boolean DEFAULT_DYNAMIC_VALIDATION
protected static final boolean DEFAULT_MEMORY_USAGE
protected static final boolean DEFAULT_TAGGINESS
Constructor Detail |
public XMLValidator()
Method Detail |
public static void main(String[] args)
args
- The command line argumentspublic StringBuffer validate(String filePath) throws FileNotFoundException, IOException, ParserConfigurationException, SAXException, Exception
filePath
- A single XML file or directory
contianing XML files to be validated.
FileNotFoundException
- DESCRIPTION
IOException
- DESCRIPTION
ParserConfigurationException
- DESCRIPTION
SAXException
- DESCRIPTION
Exception
- DESCRIPTIONpublic StringBuffer validate(String filePath, String[] inputFileNames) throws FileNotFoundException, IOException, ParserConfigurationException, SAXException, Exception
filePath
- A single XML file or directory
contianing XML files to be validated.inputFileNames
- An array of all the ID names found
in the directory indicated in filePath to be validated. If null, then
the list of files is obtained from the filePath directory.
FileNotFoundException
- DESCRIPTION
IOException
- DESCRIPTION
ParserConfigurationException
- DESCRIPTION
SAXException
- DESCRIPTION
Exception
- DESCRIPTIONpublic StringBuffer validate(String filePath, String[] inputFileNames, String reportFilePath) throws Exception
filePath
- A single XML file or directory contianing XML files
to be validated.inputFileNames
- An array of all the ID names found in the directory
indicated in filePath to be validated. If null, then the list of files
is obtained from the filePath directory. the file list is obtainedreportFilePath
- The file where a validation report will be appended.
If null then nothing is written.
Exception
- DESCRIPTIONpublic static final String validateString(String s)
s
- An XML String, which must include a DTD or schema declaration.
public static final String validateString(String s, boolean showWarnings)
s
- An XML String, which must include a DTD or schema
declaration.showWarnings
- Set to true to check for warnings as well as errors.
public static final String validateUri(String URI)
file:///usr/local/nonesuch.xml
- an XML document on the local system.
http://www.nonesuch.com/nonsuch.xml
- an XML document on the Internet.
URI
- A URI path to an XML document.
public static final String validateUri(String URI, boolean showWarnings)
file:///usr/local/nonesuch.xml
- an XML document on the local system.
http:///www.nonesuch.com/nonsuch.xml
- an XML document on the Internet.
URI
- A URI path to an XML document.showWarnings
- Set to true to check for warnings as well as errors.
public static final String validateFile(File f)
f
- An XML File, which must include a DTD or schema declaration.
public static final String validateFile(File f, boolean showWarnings)
f
- An XML File, which must include a DTD or schema
declaration.showWarnings
- Set to true to check for warnings as well as errors.
|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |