|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.vividsolutions.jump.io.GMLReader
public class GMLReader
GMLReader is a JUMPReader specialized to read GML files.
DataProperties for the JCSReader load(DataProperties) interface:
| Parameter | Meaning |
|---|---|
| File or DefaultValue | File name for the input .xml file |
| InputTemplateFile | Filename for the GMLInputTemplate .xml file |
| CompressedFile | File name (a .zip or .gz) with a .jml/.xml/.gml inside (specified by File) |
| CompressedFileTemplate | File name (.zip or .gz) with the input template in (specified by InputTemplateFile) |
gmlReader = new GMLReader();
gmlReader.load( DriverProperties) ; // has InputFile and InputTemplate
or:
gmlReader.setInputTemplate( GMLInputTemplate);
gmlReader.load( , );
0 -----> 1
|
| Collection start Tag
|
-->2----------------> FINISH
\ | End Collection tag
End Feature tag \ |
\|
4<-------->3
Geometry start/end
example of double GCs: START geometry ->move to state 4 START TAG: multi* -> move to state 1000, geometry = recursivegeometry[0]Most of the work is done in the endTag method!-> added to geometry -> added to geometry START TAG: multi* -> move to state 1001, geometry = recursivegeometry[1] -> added to geometry -> added to geometry END TAG: multi -> move to state 1000, build geometry in recursivegeometry[1], add to recursivegeometry[0], geometry = recursivegeometry[0] -> added to geometry END TAG: multi -> move to state 4, build geometry in recursivegeometry[0] (thats the result) and put it in finalGeometry END geometry -> add to feature collection example of simple geometry: START geometry ->move to state 4 BEGIN polygon ->clear out inner ring accumulator BEGIN outerboundary BEGIN linearring END linearring -> put points in linearRing END outerboundary -> put linearRing in outerBoundary BEGIN innerboundary BEGIN linearring END linearring -> put points in linearRing END innerboundary -> add linearRing to innerBoundary list END polygon -> build polygon (put in geometry, which is recursivegeometry[0] END geometry => add to feature collection
| Field Summary | |
|---|---|
boolean |
multiItemsAsLists
true => for 'OBJECT' types, if you find more than 1 item, make a list and store all the results |
boolean |
parseSRID
|
| Constructor Summary | |
|---|---|
GMLReader()
Constructor - make a SAXParser and have this GMLReader be its ContentHandler and ErrorHandler. |
|
| Method Summary | |
|---|---|
void |
acceptSRID(boolean parseTheSRID)
parse SRID information in geometry tags |
void |
characters(char[] ch,
int start,
int length)
SAX handler - store and accumulate tag bodies |
void |
endDocument()
SAX HANDLER - move to state 0 |
void |
endElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName)
SAX handler - handle state information and transitions based on ending elements Most of the work of the parser is done here. |
void |
error(org.xml.sax.SAXParseException exception)
|
void |
fatalError(org.xml.sax.SAXParseException exception)
|
void |
processMultiItems(boolean accept)
Added slightly better support for type=OBJECT. |
FeatureCollection |
read(DriverProperties dp)
Main Entry - load in a GML file |
FeatureCollection |
read(java.io.Reader r)
Helper function - calls read(java.io.Reader r,String readerName) with the readerName "Unknown Stream". |
FeatureCollection |
read(java.io.Reader r,
java.lang.String readerName)
Main function to read a GML file. |
void |
setInputTemplate(GMLInputTemplate template)
Attach a GMLInputTemplate information class. |
void |
startDocument()
SAX handler - move to state 1 |
void |
startElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName,
org.xml.sax.Attributes atts)
SAX handler. |
void |
warning(org.xml.sax.SAXParseException exception)
|
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public boolean parseSRID
public boolean multiItemsAsLists
| Constructor Detail |
|---|
public GMLReader()
| Method Detail |
|---|
public void acceptSRID(boolean parseTheSRID)
parseTheSRID - true = parsepublic void processMultiItems(boolean accept)
public void setInputTemplate(GMLInputTemplate template)
template - The new inputTemplate value
public 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.DefaultHandlerch - Description of the Parameterstart - Description of the Parameterlength - Description of the Parameter
org.xml.sax.SAXException - Description of the Exceptionpublic void endDocument()
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandler
public 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.DefaultHandleruri - Description of the Parametername - Description of the ParameterqName - Description of the Parameter
org.xml.sax.SAXException - Description of the Exception
public 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.SAXException
public 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.SAXException
public FeatureCollection read(DriverProperties dp)
throws IllegalParametersException,
java.lang.Exception
read in interface JUMPReaderdp - Description of the Parameter
IllegalParametersException - Description of the Exception
java.lang.Exception - Description of the Exception
public FeatureCollection read(java.io.Reader r)
throws java.lang.Exception
r - reader to read the GML File from
java.lang.Exception - Description of the Exception
public FeatureCollection read(java.io.Reader r,
java.lang.String readerName)
throws java.lang.Exception
r - reader to read the GML File fromreaderName - what to call the reader for error reporting
java.lang.Exception - Description of the Exceptionpublic void startDocument()
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandler
public 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.DefaultHandleruri - Description of the Parametername - Description of the ParameterqName - Description of the Parameteratts - Description of the Parameter
org.xml.sax.SAXException - Description of the Exception
public 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.SAXException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||