ex1
Class DataFileParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byex1.DataFileParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class DataFileParser
extends org.xml.sax.helpers.DefaultHandler

This class contains functions to parse the data XML file for WEPS crops and operations. The parsing is done with the SAX parser and the important information is saved in internal data structures.


Constructor Summary
DataFileParser(DefnFileParser listing, java.lang.String topdir, boolean isCrop)
          Creates a new instance to handle parsing detail CROP or OPRN files
 
Method Summary
 void addXmlFile(WepsDBFile xfile)
          Parses the weps file contained in the structure.
 void characters(char[] buf, int offset, int len)
          Called automatically by the SAX parser to get the string inside the tags This may require several calls to piece together the data.
 void endDocument()
          Called automatically by the SAX parser.
 void endElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName)
          Called automatically by the SAX parser when an ending <> is seen.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicID, java.lang.String sysID)
          This translates the external DTD references to the file location in the main mcrew_cfg directory.
 void startDocument()
          Called automatically by the SAX parser.
 void startElement(java.lang.String namespaceURI, java.lang.String lName, java.lang.String qName, org.xml.sax.Attributes attrs)
          Called automatically by the SAX parser when a beginning <> tag is seen.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFileParser

public DataFileParser(DefnFileParser listing,
                      java.lang.String topdir,
                      boolean isCrop)
Creates a new instance to handle parsing detail CROP or OPRN files

Parameters:
listing - parameter dictionary constructed from mcrew config files
topdir - directory of mcrew files
isCrop - true if we are parsing a crop xml file (simpler structre), false for operations
Method Detail

addXmlFile

public void addXmlFile(WepsDBFile xfile)
Parses the weps file contained in the structure.

Parameters:
xfile - File to load as a WepsDBFile class

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Called automatically by the SAX parser.

Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Called automatically by the SAX parser.

Throws:
org.xml.sax.SAXException

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicID,
                                             java.lang.String sysID)
This translates the external DTD references to the file location in the main mcrew_cfg directory. This is called automatically by the SAX parser.


startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String lName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Called automatically by the SAX parser when a beginning <> tag is seen.

Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String sName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Called automatically by the SAX parser when an ending <> is seen. This causes the information to be added to the internal viewer classes

Throws:
org.xml.sax.SAXException

characters

public void characters(char[] buf,
                       int offset,
                       int len)
                throws org.xml.sax.SAXException
Called automatically by the SAX parser to get the string inside the tags This may require several calls to piece together the data.

Throws:
org.xml.sax.SAXException