SORTIE Java Interface
1
|
SAX parameter file parse handler. More...
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. | |
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
Edit history:
---------------—
June 28, 2012: Created (LEM)
sortie.tools.parfileupdater.OldParFileParser.OldParFileParser | ( | BufferedWriter | jOut | ) | throws IOException |
Constructor.
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.
p_cCh | The characters from the XML document. |
iStart | - The start position in the array. |
iLength | - The number of characters to read from the array. |
SAXException | shouldn't. |
void sortie.tools.parfileupdater.OldParFileParser.endDocument | ( | ) | throws SAXException |
Called when the end of the document is reached.
SAXException | if 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.
sURI | the Namespace URI (ignored) |
sLocalName | the local name (what this function looks at) |
sQName | the qualified (prefixed) name (ignored) |
SAXException | if 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.
sURI | the Namespace URI (ignored) |
sLocalName | the local name (what this function looks at) |
sQName | the qualified (prefixed) name (ignored) |
oAttributes | The tag's attributes |
SAXException | if there are any problems. |
|
private |
Whether or not we're parsing grid data.
|
private |
Whether or not we're parsing output data.
|
private |
|
private |
|
private |
Place to stash attributes of a tag.
|
private |
|
private |
Object that will take care of the data parsed out.
|
protected |
String buffer to collect data in our parser.
|
private |
Where we'll store the tag name of the element being parsed.