Package org.geotools.xml

Examples of org.geotools.xml.Parser


    public SimpleFeatureCollection decodeFeatureCollection(InputStream in) throws IOException,
            SAXException, ParserConfigurationException {
        if (Version.GML2 == version || Version.WFS1_0 == version || Version.GML2 == version
                || Version.GML3 == version || Version.WFS1_0 == version
                || Version.WFS1_1 == version) {
            Parser parser = new Parser(gmlConfiguration);
            Object obj = parser.parse(in);
            SimpleFeatureCollection collection = toFeatureCollection(obj);
            return collection;
        }
        return null;
    }
View Full Code Here


        return true;
    }

    public void testCompositeCurve() throws Exception {
        GMLConfiguration gml = new GMLConfiguration(true);
        Parser p = new Parser(gml);
        Object compositeCurve = p.parse(getClass().getResourceAsStream("v3_2/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

                + "  xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd\">"
                + "</WFS_Capabilities>";

        configuration = new org.geotools.wfs.v1_0.WFSCapabilitiesConfiguration();

        Parser parser = new Parser(configuration);
        Object parsed = parser.parse(new ByteArrayInputStream(xml.getBytes()));
        assertNotNull(parsed);
        assertTrue(parsed.getClass().getName(), parsed instanceof WFSCapabilitiesType);
        WFSCapabilitiesType caps = (WFSCapabilitiesType) parsed;

        assertNotNull(caps);
View Full Code Here

        }
    }
   
    protected Object parse(String filename) throws Exception {
        SEConfiguration se = new SEConfiguration();
        Parser p = new Parser(se);
        return p.parse(getClass().getResourceAsStream(filename));
    }
View Full Code Here

        return p.parse(getClass().getResourceAsStream(filename));
    }
   
    protected List validate(String filename) throws Exception {
        SEConfiguration se = new SEConfiguration();
        Parser p = new Parser(se);
        p.validate(getClass().getResourceAsStream(filename));
        return p.getValidationErrors();
    }
View Full Code Here

* @source $URL$
*/
public class SLDTest extends TestCase {
   
    public void test() throws Exception {
        Parser parser = new Parser(new SLDConfiguration());

        StyledLayerDescriptor sld = (StyledLayerDescriptor) parser.parse(getClass()
                                                                             .getResourceAsStream("example-sld.xml"));

        assertEquals(1, sld.getStyledLayers().length);

        NamedLayer layer = (NamedLayer) sld.getStyledLayers()[0];
View Full Code Here

        assertEquals(Integer.parseInt("C3", 16), color.getGreen());
        assertEquals(Integer.parseInt("F5", 16), color.getBlue());
    }
   
    public void testValidateTransformation() throws Exception {
        Parser parser = new Parser(new SLDConfiguration());

        // if a validato error occurs it will blow up with an exception
        parser.validate(getClass().getResourceAsStream("gcontours.sld"));
    }
View Full Code Here

    Parser parser;
    Encoder encoder;
   
    @Before
    public void setup() {
        parser = new Parser(new CSWConfiguration());
        encoder = new Encoder(new CSWConfiguration());
        encoder.getNamespaces().declarePrefix("csw", CSW.NAMESPACE);
        encoder.getNamespaces().declarePrefix("dc", DC.NAMESPACE);
        encoder.getNamespaces().declarePrefix("dct", DCT.NAMESPACE);
        encoder.getNamespaces().declarePrefix("ows", OWS.NAMESPACE);
View Full Code Here

        spf.setNamespaceAware(true);

        Configuration configuration = new GMLConfiguration();

        parser = new Parser(configuration, getClass().getResourceAsStream("geometry.xml"));
    }
View Full Code Here

    }
   
    Object parse(String filename) throws Exception {
        SLDConfiguration sld = new SLDConfiguration();
        InputStream location = getClass().getResourceAsStream(filename);
        return new Parser(sld).parse(location);
    }
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.