Package org.geotools.xml

Examples of org.geotools.xml.Parser


        configuration = new org.geotools.wfs.v1_1.WFSConfiguration();
    }

    @Test
    public void testParseGetCapabilities() throws Exception {
        Parser parser = new Parser(configuration);
        WFSCapabilitiesType caps = (WFSCapabilitiesType) parser.parse(getClass()
                .getResourceAsStream("geoserver-GetCapabilities.xml"));

        assertNotNull(caps);
        assertEquals("1.1.0", caps.getVersion());
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.1.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

                    DefaultResourceLocator locator = new DefaultResourceLocator();
                    locator.setSourceUrl(surl);
                    container.registerComponentInstance(ResourceLocator.class, locator);
                };
            };
            Parser parser = new Parser(configuration);

            StyledLayerDescriptor sld = (StyledLayerDescriptor) parser.parse(surl.openStream());
           
            for (int i = 0; i < sld.getStyledLayers().length; i++) {
                Style[] styles = null;
               
                if (sld.getStyledLayers()[i] instanceof NamedLayer) {
View Full Code Here

        assertEquals("testString", propertyName.getFirstChild().getNodeValue());
        assertEquals("2", literal.getFirstChild().getNodeValue());
    }

    public void testParse() throws Exception {
        Parser parser = new Parser(new OGCConfiguration());
        InputStream in = getClass().getResourceAsStream("test1.xml");

        if (in == null) {
            throw new FileNotFoundException(getClass().getResource("test1.xml").toExternalForm());
        }

        Object thing = parser.parse(in);
        assertEquals(0, parser.getValidationErrors().size());

        assertNotNull(thing);
        assertTrue(thing instanceof PropertyIsEqualTo);

        PropertyIsEqualTo equal = (PropertyIsEqualTo) thing;
View Full Code Here

           "</Filter>";
       
        OGCConfiguration configuration = new OGCConfiguration();
        configuration.getProperties().add(Properties.IGNORE_SCHEMA_LOCATION);

        Parser parser = new Parser(configuration);
        DWithin filter = (DWithin) parser.parse(new ByteArrayInputStream(xml.getBytes()));
        assertNotNull(filter);
       
        //Asserting the Property Name
        assertNotNull(filter.getExpression1());
        PropertyName propName = (PropertyName) filter.getExpression1();
View Full Code Here

                     "<gml:upperCorner>42.50936100000001 -87.507889</gml:upperCorner>"
                   "</gml:Envelope>" +
                 "</ogc:BBOX>" +
               "</ogc:Filter>";

        Parser p = new Parser(new OGCConfiguration());
        p.validate(new StringReader(xml));

        assertTrue(p.getValidationErrors().isEmpty());
    }
View Full Code Here

        assertEquals(Double.class, t.getDescriptor("TrailLength").getType().getBinding());
        assertEquals(Integer.class, t.getDescriptor("ElevationGain").getType().getBinding());
    }

    SimpleFeature parseSamples() throws Exception {
        Parser p = new Parser(createConfiguration());
        SimpleFeature doc =
            (SimpleFeature) p.parse(getClass().getResourceAsStream("KML_Samples.kml"));
        return doc;
    }
View Full Code Here

* @source $URL$
*/
public class KMLParsingTest extends TestCase {
   
   public void testParse() throws Exception {
        Parser parser = new Parser(new KMLConfiguration());
        SimpleFeature f = (SimpleFeature) parser.parse(getClass().getResourceAsStream("states.kml"));
        assertNotNull(f);

        assertEquals("topp:states", f.getAttribute("name"));

        Collection placemarks = (Collection) f.getAttribute("Feature");
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.