|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.xml.sax.ext.DefaultHandler2
org.foray.hyphen.util.ValidateChars
public class ValidateChars
Command-line application that reads an XML file and checks its content against a predefined set of characters that are legitimate in a given language, reporting on anomalies. The purpose here is to find words that are misspelled or that are not encoded properly, so that they can be fixed in preparation for creating a word list.
Field Summary | |
---|---|
static byte |
STATUS_FILE_NOT_FOUND
Command-line return status constant indicating that a file was not found. |
static byte |
STATUS_PARSING_ERROR
Command-line return status constant indicating that there was a parsing error. |
static byte |
STATUS_WRONG_QTY_ARGUMENTS
Command-line return status constant indicating that the number of arguments is wrong. |
Constructor Summary | |
---|---|
ValidateChars(HyphenationServer4a server,
InputSource input,
String catalog,
String languageCode)
Constructor. |
Method Summary | |
---|---|
void |
characters(char[] buffer,
int offset,
int length)
|
XMLReader |
createParser()
Creates a SAX parser. |
void |
endDocument()
|
void |
endElement(String uri,
String local,
String qName)
|
org.apache.commons.logging.Log |
getLogger()
Returns the logger. |
static void |
main(String[] args)
Command-line interface for validating the characters in an XML document. |
void |
setDocumentLocator(Locator locator)
|
void |
start()
Intantiates parser and starts parsing of input. |
void |
startDocument()
|
void |
startElement(String uri,
String local,
String qName,
Attributes attributes)
|
Methods inherited from class org.xml.sax.ext.DefaultHandler2 |
---|
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntity |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte STATUS_WRONG_QTY_ARGUMENTS
public static final byte STATUS_FILE_NOT_FOUND
public static final byte STATUS_PARSING_ERROR
Constructor Detail |
---|
public ValidateChars(HyphenationServer4a server, InputSource input, String catalog, String languageCode)
server
- The server used to find natural language resources.input
- The input source encapsulating the document to be
pretty-printed.catalog
- The location of a catalog file that should be used to find
DTDs.languageCode
- The valid ISO-639 language against which this
document will be tested.
find the DTD for this document.Method Detail |
---|
public void start() throws IOException, SAXException, ParserConfigurationException
IOException
- For I/O Errors.
SAXException
- For parsing errors.
ParserConfigurationException
- For errors configuring parser.public XMLReader createParser() throws SAXException, ParserConfigurationException
SAXException
- For error creating parser.
ParserConfigurationException
- For error configuring parser.public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
public void startDocument()
startDocument
in interface ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void endDocument()
endDocument
in interface ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
public void startElement(String uri, String local, String qName, Attributes attributes)
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
public void endElement(String uri, String local, String qName)
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
public void characters(char[] buffer, int offset, int length)
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
public org.apache.commons.logging.Log getLogger()
public static void main(String[] args)
args
- command-line arguments.
Argument 1 is the location of the input file.
Argument 2 is the ISO-639 language code for the language to be used to
validate this file.
Argument 3 is the URL to the directory containing the natural language
input files.
Argument 4 is an optional location of an OASIS-compliant catalog file.
that can be used to locate local DTDs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |