3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xmlns:test="http://www.geotools.org/test" xsi:schemaLocation="http://www.geotools.org/test test.xsd"> <gml:featureMember> <test:TestFeature fid="0"> ... </test:TestFeature> </gml:featureMember> <gml:featureMember> <test:TestFeature fid="1"> ... </test:TestFeature> </gml:featureMember> <gml:featureMember> <test:TestFeature fid="2"> .... </test:TestFeature> </gml:featureMember> </test:TestFeatureCollection> And suppose we want to stream back each feature as it is parsed.
1. Element Name
Objects are streamed back when an element of a particular name has been parsed.
Configuration configuration = new GMLConfiguration(); QName elementName = new QName( "http://www.geotools.org/test", "TestFeature" ); StreamingParser parser = new StreamingParser( configuration, elementName ); Feature f = null; while ( ( f = parser.parse() ) != null ) { ... }
2. Type
Objects are streamed back when an element has been parsed into an object of a particular type.
Configuration configuration = new GMLConfiguration(); StreamingParser parser = new StreamingParser( configuration, Feature.class ); Feature f = null; while ( ( f = parser.parse() ) != null ) { ... }
3. Xpath Expression
Objects are streamed back when an element has been parsed which matches a particular xpath expression.
Configuration configuration = new GMLConfiguration(); String xpath = "//TestFeature"; StreamingParser parser = new StreamingParser( configuration, xpath ); Feature f = null; while ( ( f = parser.parse() ) != null ) { ... }
@author Justin Deoliveira, The Open Planning Project
@deprecated {@link PullParser} is meant as a better replacement.
@source $URL$