SOA
© 2004 SoS Group
All Rights Reserved

sos.koa
Class ImportCandidatesAdapter.CandidateFileParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bysos.koa.ImportCandidatesAdapter.CandidateFileParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Enclosing class:
ImportCandidatesAdapter

class ImportCandidatesAdapter.CandidateFileParser
extends org.xml.sax.helpers.DefaultHandler

Inner class to parse the candidate list file.


Field Summary
(package private)  Candidate candidate
           
(package private)  java.lang.StringBuffer code
           
(package private)  java.lang.StringBuffer codecount
           
(package private)  java.lang.StringBuffer creationtime
           
(package private)  java.lang.StringBuffer districtcount
           
(package private)  KiesKring kieskring
           
(package private)  java.lang.StringBuffer kieskringcount
           
(package private)  KiesLijst kieslijst
           
(package private)  java.lang.StringBuffer kieslijstcount
           
(package private)  java.util.Stack parserState
           
(package private)  java.lang.StringBuffer positiecount
           
(package private)  java.lang.StringBuffer requestreference
           
(package private)  java.lang.StringBuffer responsereference
           
 
Constructor Summary
(package private) ImportCandidatesAdapter.CandidateFileParser()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Gets called when processing the ('PCDATA') contents of elements.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Gets called for every close element.
(package private)  void parse(java.io.File file)
          Parses file file.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          Gets called for every open element.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
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
 

Field Detail

parserState

java.util.Stack parserState

requestreference

java.lang.StringBuffer requestreference

responsereference

java.lang.StringBuffer responsereference

creationtime

java.lang.StringBuffer creationtime

kieskringcount

java.lang.StringBuffer kieskringcount

districtcount

java.lang.StringBuffer districtcount

kieslijstcount

java.lang.StringBuffer kieslijstcount

positiecount

java.lang.StringBuffer positiecount

codecount

java.lang.StringBuffer codecount

kieskring

KiesKring kieskring

kieslijst

KiesLijst kieslijst

candidate

Candidate candidate

code

java.lang.StringBuffer code
Constructor Detail

ImportCandidatesAdapter.CandidateFileParser

ImportCandidatesAdapter.CandidateFileParser()
Method Detail

parse

void parse(java.io.File file)
     throws KOAException
Parses file file.

Parameters:
file - the file to parse.
Throws:
KOAException - when file could not be parsed.

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
Gets called for every open element. Pushes the name onto the stack. Initializes the various string buffers. Adds a candidate to the candidate list for each 'positie' element encountered.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - a string.
localName - a string.
qName - contains the qualified name of the element.
Throws:
org.xml.sax.SAXException - in case of a parse error.
Specifications:
     also
requires qName != null;
assignable objectState;

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Gets called when processing the ('PCDATA') contents of elements. Appends characters to the various string buffers, most notably to code.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - the character buffer containing the data.
start - the offset into ch where unprocessed data is found.
length - the length of the available unprocessed data in ch.
Throws:
org.xml.sax.SAXException - in case of a parse error.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Gets called for every close element. The closing of the 'metadata' element marks the occasion for constructing the candidate list. The closing of a 'code' element results in adding the (now fully processed) code to the candidate list. Pops the element name from the stack.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - a string.
localName - a string.
qName - the qualified name of the element.
Throws:
org.xml.sax.SAXException - in case of a parse error.

SOA
© 2004 SoS Group
All Rights Reserved