public class GMLInputTemplate
extends org.xml.sax.helpers.DefaultHandler
GMLReader) will know what to do with different tags.
| Modifier and Type | Field and Description |
|---|---|
boolean |
loaded |
| Constructor and Description |
|---|
GMLInputTemplate()
constructor - makes a new org.apache.xerces.parser and makes this class be the SAX
content and error handler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length)
SAX handler for characters - just store and accumulate for later use
|
java.lang.String |
columnName(int index)
Returns the column name for the 'index'th column.
|
void |
endDocument()
SAX endDocument handler - null
|
void |
endElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName)
SAX endElement handler - the main working function
handles the following tags in the appropriate manner: GeometryElement : sets the name of the document's geometry tag CollectionElement : sets the name of the document's collection tag FeatureElement : sets the name of the document's feature tag type : sets a column type (to be used when a column ends) valueelement : sets information about what element a column is associated with valuelocation : set information about where a column's value is stored in the document column : takes the accumlated information about a column and constructs a ColumnDescription object |
void |
error(org.xml.sax.SAXParseException exception) |
void |
fatalError(org.xml.sax.SAXParseException exception) |
java.lang.Object |
getColumnValue(int index,
java.lang.String tagBody,
org.xml.sax.Attributes xmlAtts)
Given a ColumnDescription index, the XML tagBody, and the tag's attributes, return the
actual value (it could be an attribute or the tag's body).
|
java.lang.String |
getFeatureCollectionElementName()
Get the name of the FeatureCollectionElement tag
|
java.lang.String |
getFeatureElementName()
Get the name of the FeatureElement tag
|
boolean |
isGeometryElement(java.lang.String tag)
Function to help the GMLParser - is this tag name the Geometry Element tag name?
|
void |
load(java.io.Reader r)
Helper function - load a GMLInputTemplate file with the stream name "Unknown Stream"
|
void |
load(java.io.Reader r,
java.lang.String readerName)
Main function - load in an XML file.
|
int |
match(java.lang.String XMLtagName,
org.xml.sax.Attributes xmlAtts)
Given a tag name and its XML attributes, find the index of the column it belongs to.
|
void |
startDocument()
SAX startDocument handler - null
|
void |
startElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName,
org.xml.sax.Attributes atts)
SAX startElement handler
Basically just records the tag name and its attributes since all the smarts are in the endElement handler. |
FeatureSchema |
toFeatureSchema()
Converts this GMLInputTemplate to a feature schema.
|
void |
warning(org.xml.sax.SAXParseException exception) |
public GMLInputTemplate()
public java.lang.String columnName(int index)
throws ParseException
index - 0=firstParseExceptionpublic FeatureSchema toFeatureSchema() throws ParseException
ParseExceptionpublic boolean isGeometryElement(java.lang.String tag)
tag - an XML tag namepublic void load(java.io.Reader r)
throws ParseException,
java.io.IOException
ParseExceptionjava.io.IOExceptionpublic void load(java.io.Reader r,
java.lang.String readerName)
throws ParseException,
java.io.IOException
r - where to read the XML file fromreaderName - name of the stream for error reportingParseExceptionjava.io.IOExceptionpublic java.lang.String getFeatureCollectionElementName()
throws ParseException
ParseExceptionpublic java.lang.String getFeatureElementName()
throws ParseException
ParseExceptionpublic int match(java.lang.String XMLtagName,
org.xml.sax.Attributes xmlAtts)
throws ParseException
XMLtagName - the tag name found in the xmlxmlAtts - the attributes associated with the xmlParseExceptionpublic java.lang.Object getColumnValue(int index,
java.lang.String tagBody,
org.xml.sax.Attributes xmlAtts)
throws ParseException
index - index number of the column descriptiontagBody - value of the XML tag bodyxmlAtts - key/values of the XML tag's attributesParseExceptionpublic void warning(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
warning in interface org.xml.sax.ErrorHandlerwarning in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void error(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
error in interface org.xml.sax.ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void fatalError(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
fatalError in interface org.xml.sax.ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void startDocument()
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerpublic void endDocument()
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerpublic void startElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void endElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException