Package org.geotools.xml

Examples of org.geotools.xml.Parser


      } else if (filterVersion.equals(FilterCapabilities.VERSION_110)) {
          config = FILTER_1_1_0;
      } else {
          throw new IllegalArgumentException("UnsupportFilterVersion: "+filterVersion);
      }
      return new Parser(config);
    }
View Full Code Here


            }
        }


        private SimpleFeatureCollection parseGml3(final String gmlData) throws IOException {
            Parser gmlV3Parser = new Parser(GML_3_PARSER);
            gmlV3Parser.setStrict(false);
            gmlV3Parser.setRootElementType(new QName("http://www.opengis.net/wfs", "FeatureCollection"));
            try {
                final Object featureCollection = gmlV3Parser.parse(new StringReader(gmlData));
                if (featureCollection != null) {
                    return (SimpleFeatureCollection) featureCollection;
                }
            } catch (SAXException e) {
                // do nothing try to load as gml2
View Full Code Here

            }
            return parseGml2(gmlData);
        }

        private SimpleFeatureCollection parseGml2(final String gmlData) throws IOException {
            Parser gmlV2Parser = new Parser(GML_2_PARSER);
            gmlV2Parser.setStrict(false);
            gmlV2Parser.setRootElementType(new QName("http://www.opengis.net/wfs", "FeatureCollection"));
            try {
                final Object featureCollection = gmlV2Parser.parse(new StringReader(gmlData));
                if (featureCollection != null) {
                    return (SimpleFeatureCollection) featureCollection;
                }
            } catch (SAXException e) {
                // do nothing try to load as gml32
View Full Code Here

            }
            return parseGml32(gmlData);
        }

        private SimpleFeatureCollection parseGml32(final String gmlData) throws IOException {
            Parser gmlV32Parser = new Parser(GML_32_PARSER);
            gmlV32Parser.setStrict(false);
            gmlV32Parser.setRootElementType(new QName("http://www.opengis.net/wfs/2.0", "FeatureCollection"));
            try {
                final Object featureCollection = gmlV32Parser.parse(new StringReader(gmlData));
                if (featureCollection != null) {
                    return (SimpleFeatureCollection) featureCollection;
                } else {
                    throw new RuntimeException("unable to parse gml: \n\n" + gmlData);
                }
View Full Code Here

    @Test
    public void testParseGetCapabilities() throws Exception {
        configuration = new org.geotools.wfs.v1_0.WFSCapabilitiesConfiguration();

        Parser parser = new Parser(configuration);
        Object parsed = parser.parse(getClass().getResourceAsStream(
                "geoserver-GetCapabilities.xml"));

        assertNotNull(parsed);
        assertTrue(parsed.getClass().getName(), parsed instanceof WFSCapabilitiesType);
        WFSCapabilitiesType caps = (WFSCapabilitiesType) parsed;
View Full Code Here

     * TODO: fix me
     *
     * @throws Exception
     */
    public void _testParseGetCapabilitiesDeegree() throws Exception {
        Parser parser = new Parser(configuration);
        WFSCapabilitiesType caps = (WFSCapabilitiesType) parser.parse(getClass()
                .getResourceAsStream("deegree-GetCapabilities.xml"));

        assertNotNull(caps);
        assertEquals("1.0.0", caps.getVersion());

View Full Code Here

        Transformer tx = TransformerFactory.newInstance().newTransformer();
        tx.transform(new DOMSource(doc), new StreamResult(tmp));

        in = new FileInputStream(tmp);

        Parser parser = new Parser(configuration);
        FeatureCollectionType fc = (FeatureCollectionType) parser.parse(in);
        assertNotNull(fc);

        List featureCollections = fc.getFeature();
        assertEquals(1, featureCollections.size());
View Full Code Here

        assertEquals(5, n);
    }
       
    @Test
    public void testParseTransactionResponse() throws IOException, SAXException, ParserConfigurationException{
        Parser parser = new Parser(configuration);
        Object parsed = parser.parse(getClass().getResourceAsStream("transactionResponse.xml"));

        assertNotNull(parsed);
        assertTrue(parsed.getClass().getName(), parsed instanceof TransactionResponseType);
       
        TransactionResponseType response = (TransactionResponseType) parsed;
       
        InsertResultsType insert = response.getInsertResults();
       
        assertEquals(0, insert.getFeature().size());
       
        parsed = parser.parse(getClass().getResourceAsStream("transactionResponse2.xml"));

        assertNotNull(parsed);
        assertTrue(parsed.getClass().getName(), parsed instanceof TransactionResponseType);
       
        response = (TransactionResponseType) parsed;
View Full Code Here

        }

        TestConfiguration configuration = new TestConfiguration();

        //first parse in test data
        Parser parser = new Parser(configuration);
        SimpleFeatureCollection fc = (SimpleFeatureCollection) parser.parse(TestConfiguration.class
                .getResourceAsStream("test.xml"));
        assertNotNull(fc);

        XSDSchema schema = TEST.getInstance().getSchema();
        assertNotNull(schema);
View Full Code Here

        ApplicationSchemaConfiguration configuration = new ApplicationSchemaConfiguration(TEST.NAMESPACE,
                schemaLocation);

        //first parse in test data
        Parser parser = new Parser(configuration);
        SimpleFeatureCollection fc = (SimpleFeatureCollection) parser.parse(TestConfiguration.class
                .getResourceAsStream("test.xml"));
        assertNotNull(fc);

        XSDSchema schema = TEST.getInstance().getSchema();
        assertNotNull(schema);
View Full Code Here

TOP

Related Classes of org.geotools.xml.Parser

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.