Class GMLInputTemplate
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.vividsolutions.jump.io.GMLInputTemplate
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Reads an XML file that starts with a 'JCSGMLInputTemplate'.
Will abort read at the end of the 'JCSGMLInputTemplate' tag.
Constructs a description of the Columns and geometry tag so the
actual GML parser (
This is a SAX Handler.
Will abort read at the end of the 'JCSGMLInputTemplate' tag.
Constructs a description of the Columns and geometry tag so the
actual GML parser (
GMLReader) will know what to do with different tags.
This is a SAX Handler.
-
Constructor Summary
ConstructorsConstructorDescriptionconstructor - makes a new org.apache.xerces.parser and makes this class be the SAX content and error handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) SAX handler for characters - just store and accumulate for later usecolumnName(int index) Returns the column name for the 'index'th column.voidSAX endDocument handler - nullvoidendElement(String uri, String name, 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 objectvoiderror(SAXParseException exception) voidfatalError(SAXParseException exception) getColumnValue(int index, String tagBody, 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).Get the name of the FeatureCollectionElement tagGet the name of the FeatureElement tagbooleanisGeometryElement(String tag) Function to help the GMLParser - is this tag name the Geometry Element tag name?voidload(InputStream is) Helper function - load a GMLInputTemplate file with the stream name "Unknown Stream"voidDeprecated.use load(InputStream is, String readerName) insteadvoidMain function - load in an XML file.intmatch(String XMLtagName, Attributes xmlAtts) Given a tag name and its XML attributes, find the index of the column it belongs to.
Returns -1 if it doesnt match any of the columns.voidSAX startDocument handler - nullvoidstartElement(String uri, String name, String qName, Attributes atts) SAX startElement handler
Basically just records the tag name and its attributes since all the smarts are in the endElement handler.Converts this GMLInputTemplate to a feature schema.voidwarning(SAXParseException exception) /////////////////////////////////////////////////////////////////Methods inherited from class DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDeclMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Constructor Details
-
GMLInputTemplate
public GMLInputTemplate()constructor - makes a new org.apache.xerces.parser and makes this class be the SAX content and error handler.
-
-
Method Details
-
columnName
Returns the column name for the 'index'th column.- Parameters:
index- 0=first- Throws:
ParseException
-
toFeatureSchema
Converts this GMLInputTemplate to a feature schema.- Throws:
ParseException
-
isGeometryElement
Function to help the GMLParser - is this tag name the Geometry Element tag name?- Parameters:
tag- an XML tag name
-
load
Deprecated.use load(InputStream is, String readerName) insteadprevious method to parse a file- Throws:
ParseExceptionIOException
-
load
Helper function - load a GMLInputTemplate file with the stream name "Unknown Stream"- Throws:
ParseExceptionIOException
-
load
Main function - load in an XML file.
Error handling/reporting also done here.- Parameters:
o- inputStream where to read the XML file fromreaderName- name of the stream for error reporting- Throws:
ParseExceptionIOException
-
getFeatureCollectionElementName
Get the name of the FeatureCollectionElement tag- Throws:
ParseException
-
getFeatureElementName
Get the name of the FeatureElement tag- Throws:
ParseException
-
match
Given a tag name and its XML attributes, find the index of the column it belongs to.
Returns -1 if it doesnt match any of the columns.- Parameters:
XMLtagName- the tag name found in the xmlxmlAtts- the attributes associated with the xml- Throws:
ParseException
-
getColumnValue
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). You probably got the index from the match() function.- Parameters:
index- index number of the column descriptiontagBody- value of the XML tag bodyxmlAtts- key/values of the XML tag's attributes- Throws:
ParseException
-
warning
/////////////////////////////////////////////////////////////////- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Throws:
SAXException
-
error
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
fatalError
- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Throws:
SAXException
-
startDocument
public void startDocument()SAX startDocument handler - null- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler
-
endDocument
public void endDocument()SAX endDocument handler - null- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler
-
startElement
public void startElement(String uri, String name, String qName, Attributes atts) throws SAXException SAX startElement handler
Basically just records the tag name and its attributes since all the smarts are in the endElement handler.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
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- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
characters
SAX handler for characters - just store and accumulate for later use- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-