SORTIE Java Interface  1
Public Member Functions | Protected Attributes | Private Attributes | List of all members
sortie.tools.parfileupdater.OldParFileParser Class Reference

SAX parameter file parse handler. More...

Inheritance diagram for sortie.tools.parfileupdater.OldParFileParser:

Public Member Functions

 OldParFileParser (BufferedWriter jOut) throws IOException
 Constructor.
 
void startElement (String sURI, String sLocalName, String sQName, Attributes oAttributes) throws SAXException
 Function called when an opening tag is encountered.
 
void characters (char[] p_cCh, int iStart, int iLength) throws SAXException
 Reads character data from the XML file.
 
void endElement (String sURI, String sLocalName, String sQName) throws SAXException
 Called at the end of an XML tag.
 
void endDocument () throws SAXException
 Called when the end of the document is reached.
 

Protected Attributes

StringBuffer m_sBuf = new StringBuffer()
 String buffer to collect data in our parser.
 

Private Attributes

ParseReader m_oParseReader
 Object that will take care of the data parsed out.
 
AttributesImpl m_oAttributes
 Place to stash attributes of a tag.
 
Stack< String > m_jParentTagStack = new Stack<String>()
 
ArrayList< String > m_jClosedParentTagStack = new ArrayList<String>()
 
Behavior m_oOutput
 
String m_sTagName = ""
 Where we'll store the tag name of the element being parsed.
 
boolean m_bParsingGrid = false
 Whether or not we're parsing grid data.
 
boolean m_bParsingOutput = false
 Whether or not we're parsing output data.
 

Detailed Description

SAX parameter file parse handler.

This takes old pre-version 7 parameter files and translates the tags to conform to version 7. It then writes them to a new file.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Cary Institute of Ecosystem Studies

Author
Lora E. Murphy
Version
1.0


Edit history:
---------------—
June 28, 2012: Created (LEM)

Constructor & Destructor Documentation

sortie.tools.parfileupdater.OldParFileParser.OldParFileParser ( BufferedWriter  jOut) throws IOException

Constructor.

Member Function Documentation

void sortie.tools.parfileupdater.OldParFileParser.characters ( char[]  p_cCh,
int  iStart,
int  iLength 
) throws SAXException

Reads character data from the XML file.

The data is appended to the string buffer. This is done because, according to the SAX parser specs, it is free to call this function multiple times per tag if it wants. So this function collects the data into a single buffer.

Parameters
p_cChThe characters from the XML document.
iStart- The start position in the array.
iLength- The number of characters to read from the array.
Exceptions
SAXExceptionshouldn't.
void sortie.tools.parfileupdater.OldParFileParser.endDocument ( ) throws SAXException

Called when the end of the document is reached.

Exceptions
SAXExceptionif any leftover data cannot be assigned.
void sortie.tools.parfileupdater.OldParFileParser.endElement ( String  sURI,
String  sLocalName,
String  sQName 
) throws SAXException

Called at the end of an XML tag.

If this was a data tag, the accumulated data in the StringBuffer m_sBuf is passed. If the tag appears in the tag hierarchy stack for ParseReader, this lets it know that it needs to be popped by incrementing the pop counter.

Parameters
sURIthe Namespace URI (ignored)
sLocalNamethe local name (what this function looks at)
sQNamethe qualified (prefixed) name (ignored)
Exceptions
SAXExceptionif there were problems assigning the data.
void sortie.tools.parfileupdater.OldParFileParser.startElement ( String  sURI,
String  sLocalName,
String  sQName,
Attributes  oAttributes 
) throws SAXException

Function called when an opening tag is encountered.

This captures the tag's attributes and initializes our StringBuffer to hold the tag's character data. It will also pass data for the last tag if it was a parent, and puts a new tag in ParseReader's tag stack queue. It does not pass data tags to ParseReader - this is because if we pass data tags here instead of in endElement the very last tag will not get passed. It DOES pass parents here to ensure the parent tag is passed before its child tags.

Parameters
sURIthe Namespace URI (ignored)
sLocalNamethe local name (what this function looks at)
sQNamethe qualified (prefixed) name (ignored)
oAttributesThe tag's attributes
Exceptions
SAXExceptionif there are any problems.

Member Data Documentation

boolean sortie.tools.parfileupdater.OldParFileParser.m_bParsingGrid = false
private

Whether or not we're parsing grid data.

boolean sortie.tools.parfileupdater.OldParFileParser.m_bParsingOutput = false
private

Whether or not we're parsing output data.

ArrayList<String> sortie.tools.parfileupdater.OldParFileParser.m_jClosedParentTagStack = new ArrayList<String>()
private
Stack<String> sortie.tools.parfileupdater.OldParFileParser.m_jParentTagStack = new Stack<String>()
private
AttributesImpl sortie.tools.parfileupdater.OldParFileParser.m_oAttributes
private

Place to stash attributes of a tag.

Behavior sortie.tools.parfileupdater.OldParFileParser.m_oOutput
private
ParseReader sortie.tools.parfileupdater.OldParFileParser.m_oParseReader
private

Object that will take care of the data parsed out.

StringBuffer sortie.tools.parfileupdater.OldParFileParser.m_sBuf = new StringBuffer()
protected

String buffer to collect data in our parser.

String sortie.tools.parfileupdater.OldParFileParser.m_sTagName = ""
private

Where we'll store the tag name of the element being parsed.


The documentation for this class was generated from the following file: