sos.koa
Class ImportCandidatesAdapter.CandidateFileChecker
java.lang.Object
org.xml.sax.helpers.DefaultHandler
sos.koa.ImportCandidatesAdapter.CandidateFileChecker
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
- Enclosing class:
- ImportCandidatesAdapter
- class ImportCandidatesAdapter.CandidateFileChecker
- extends org.xml.sax.helpers.DefaultHandler
Inner class to do light-weight sanity check on xml file.
If check terminates normally on a file, then it's likely to
be a candidate file.
I'd love to replace this with a DTD validity checker, but
the example input files do not contain doctype info.
Method Summary |
(package private) void |
check(java.io.File file)
Checks to see if file is likely
to be an XML file containing candidates. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Checks for each open tag if it's known and whether the multiplicity
is allowed. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
resultCount
int resultCount
metadataCount
int metadataCount
kieskringCount
int kieskringCount
kieslijstCount
int kieslijstCount
positieCount
int positieCount
ImportCandidatesAdapter.CandidateFileChecker
ImportCandidatesAdapter.CandidateFileChecker()
check
void check(java.io.File file)
throws KOAException
- Checks to see if
file
is likely
to be an XML file containing candidates. Note
that this does not do DTD validity checking!
- Parameters:
file
- the file.
- Throws:
KOAException
startElement
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- Checks for each open tag if it's known and whether the multiplicity
is allowed.
- Specified by:
startElement
in interface org.xml.sax.ContentHandler
- Overrides:
startElement
in class org.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
- if a tag occurs too often, or an
unknown tag is encountered, or the file is
not a well-formed XML file.
- Specifications:
- also
-
requires qName != null;
assignable objectState;
endElement
public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.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
- Throws:
org.xml.sax.SAXException