Package org.geotools.xml

Examples of org.geotools.xml.Parser$Properties


    Parser p;

    @Override
    protected void setUp() throws Exception {
        XSConfiguration xs = new XSConfiguration();
        p = new Parser(xs);
    }
View Full Code Here


        ByteArrayOutputStream out = new ByteArrayOutputStream();
        TransformerFactory.newInstance().newTransformer().transform(
            new DOMSource( dom ), new StreamResult( out ) );
       
        GMLConfiguration config = new GMLConfiguration();
        Parser p = new Parser( config );
        Object o = p.parse( new ByteArrayInputStream( out.toByteArray() ) );
        assertTrue( o instanceof FeatureCollection );
       
        FeatureCollection features = (FeatureCollection) o;
        assertEquals( 3, features.size() );
       
View Full Code Here

     *
     * @param srsName the srsName attribute on the gml:Point
     * @return the parsed CoordinateReferenceSystem
     */
    private static CoordinateReferenceSystem parsePointSrsname(String srsName) {
        Parser parser = new Parser(new GMLConfiguration());
        String text = "<gml:Point " //
                + "xmlns:gml=\"http://www.opengis.net/gml/3.2\" " //
                + "srsName=\"" + srsName + "\">" //
                + "<gml:pos>1 2</gml:pos>" //
                + "</gml:Point>";
        try {
            Point point = (Point) parser.parse(new StringReader(text));
            return (CoordinateReferenceSystem) point.getUserData();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

public class GML32CompositeCurveParsingTest extends GML32TestSupport {

    public void testCompositeCurve() throws Exception {
        GMLConfiguration gml = new GMLConfiguration(true);
        Parser p = new Parser(gml);
        Object compositeCurve = p.parse(getClass().getResourceAsStream("gml_compositecurve_1.xml"));
        assertFalse(compositeCurve instanceof String);
        System.out.println(compositeCurve);
        assertTrue("wrong element type", compositeCurve instanceof Geometry);
        Geometry geom =(Geometry)compositeCurve;
        assertEquals("LINESTRING (353148.991 5530600.811, 353151.478 5530602.263)", geom.toText());
View Full Code Here

public class GML32SurfaceParsingTest extends GML32TestSupport {

    public void testMultiSurface() throws Exception {
        GMLConfiguration gml = new GMLConfiguration(true);
        Parser p = new Parser(gml);
        Object multiSurface = p.parse(getClass().getResourceAsStream("multisurface.xml"));
        assertTrue(multiSurface instanceof MultiPolygon);
        MultiPolygon mp = (MultiPolygon) multiSurface;
        assertEquals(1, mp.getNumGeometries());
        Polygon poly = (Polygon) mp.getGeometryN(0);
        assertTrue(poly.getExteriorRing() instanceof CompoundRing);
View Full Code Here

     * @return a {@link WFSException} containing the server returned exception report messages
     * @see WFSResponseParser#parse(WFSProtocol, WFSResponse)
     */
    public Object parse(WFS_1_1_0_DataStore wfs, WFSResponse response) {
        WFSConfiguration configuration = new WFSConfiguration();
        Parser parser = new Parser(configuration);
        InputStream responseStream = response.getInputStream();
        Charset responseCharset = response.getCharacterEncoding();
        Reader reader = new InputStreamReader(responseStream, responseCharset);
        Object parsed;
        try {
            parsed = parser.parse(reader);
            if (!(parsed instanceof net.opengis.ows10.ExceptionReportType)) {
                return new IOException("Unrecognized server error");
            }
        } catch (Exception e) {
            return new WFSException("Exception parsing server exception report", e);
View Full Code Here

        Object parsed;
        try {
            WFSStrategy strategy = originatingRequest.getStrategy();
            Configuration wfsConfiguration = strategy.getWfsConfiguration();
            Parser parser = new Parser(wfsConfiguration);
            InputStream input = response.getResponseStream();
            parsed = parser.parse(input);
        } catch (SAXException e) {
            throw new IOException(e);
        } catch (ParserConfigurationException e) {
            throw new IOException(e);
        } finally {
View Full Code Here

    }

    protected WFSCapabilitiesType parseCapabilities(InputStream capabilitiesReader)
            throws IOException {
        final Configuration wfsConfig = strategy.getWfsConfiguration();
        final Parser parser = new Parser(wfsConfig);
        final Object parsed;
        try {
            parsed = parser.parse(capabilitiesReader);
        } catch (SAXException e) {
            throw new DataSourceException("Exception parsing WFS 1.1.0 capabilities", e);
        } catch (ParserConfigurationException e) {
            throw new DataSourceException("WFS 1.1.0 parsing configuration error", e);
        }
View Full Code Here

        assertNull("FEATUREID and FILTER are mutually exclusive", kvp.get("FEATUREID"));

        String encodedFilter = kvp.get("FILTER");
        assertNotNull(encodedFilter);
        Parser filterParser = new Parser(new OGCConfiguration());
        Filter parsed = (Filter) filterParser.parse(new StringReader(encodedFilter));
        assertTrue(parsed instanceof PropertyIsEqualTo);
    }
View Full Code Here

     * Parses GML3 without specifying a schema location.
     */
    public static void parseGML3() throws Exception {
        InputStream in = GMLParsing.class.getResourceAsStream( "states.xml");
        GMLConfiguration gml = new GMLConfiguration();
        Parser parser = new Parser(gml);
        parser.setStrict(false);
       
        FeatureCollection features = (FeatureCollection) parser.parse(in);
        FeatureIterator i = features.features();
       
        int nfeatures = 0;
        while( i.hasNext() ) {
            SimpleFeature f = (SimpleFeature) i.next();
View Full Code Here

TOP

Related Classes of org.geotools.xml.Parser$Properties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.