jgb
Class ValidateFile
java.lang.Object
|
+--org.xml.sax.helpers.DefaultHandler
|
+--jgb.ValidateFile
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
- public class ValidateFile
- extends org.xml.sax.helpers.DefaultHandler
Validates a file using it's specified DTD.
This tool simply parses the first argument in a validating XML parser.
This detects any gross problems with the file (missing tags, missing
required attributes, wrong attribute values, etc.).
Usage
Simply run the following:
java jgb.ValidateFile path/to/xml-file
This tool may be used to validate any file, not just JGB XML files,
as the tool is not specifically geared towards that.
- Since:
- 0.1a
- Author:
- Francois Beausoleil, fbos@users.sourceforge.net
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ValidateFile
public ValidateFile()
main
public static void main(String[] args)
throws Exception
- Parses the file passed as the first argument.
- Parameters:
args
- The arguments that were on the command line.
- Throws:
Exception
- If an exception is thrown while parsing the document.
startElement
public void startElement(String uri,
String localName,
String qName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- Specified by:
startElement
in interface org.xml.sax.ContentHandler
- Overrides:
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
endElement
public void endElement(String uri,
String localName,
String qName)
throws org.xml.sax.SAXException
- Specified by:
endElement
in interface org.xml.sax.ContentHandler
- Overrides:
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
warning
public void warning(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- Specified by:
warning
in interface org.xml.sax.ErrorHandler
- Overrides:
warning
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
error
public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- Specified by:
error
in interface org.xml.sax.ErrorHandler
- Overrides:
error
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
fatalError
public void fatalError(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- Specified by:
fatalError
in interface org.xml.sax.ErrorHandler
- Overrides:
fatalError
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
resolveEntity
public org.xml.sax.InputSource resolveEntity(String publicId,
String systemId)
throws org.xml.sax.SAXException
- Specified by:
resolveEntity
in interface org.xml.sax.EntityResolver
- Overrides:
resolveEntity
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
setReportStream
public void setReportStream(PrintWriter logWriter)
validate
public void validate(org.xml.sax.InputSource source)
throws org.xml.sax.SAXException,
javax.xml.parsers.ParserConfigurationException,
IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
IOException
Copyright 2002-2003, François Beausoleil, All Rights Reserved