Package org.geotools.xml

Examples of org.geotools.xml.Parser


    }
   
    List validate(String filename) throws Exception {
        SLDConfiguration sld = new SLDConfiguration();
        InputStream location = getClass().getResourceAsStream(filename);
        Parser p = new Parser(sld);
        p.validate(location);
        return p.getValidationErrors();
    }
View Full Code Here


   
    public void testParseSldWithExternalEntities() throws Exception {
        // this SLD file references as external entity a file on the local filesystem
        String file = "../example-textsymbolizer-externalentities.xml";
       
        Parser parser = new Parser(new SLDConfiguration());
       
        try {
            InputStream location = getClass().getResourceAsStream(file);
            parser.parse(location);
            fail("parsing should fail with a FileNotFoundException because the parser try to access a file that doesn't exist");
        } catch (FileNotFoundException e) {
        }
       
        // set an entity resolver to prevent access to the local file system
        parser.setEntityResolver(new EntityResolver() {
            @Override
            public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                return new InputSource();
            }     
        });
       
        try {
            InputStream location = getClass().getResourceAsStream(file);
            parser.parse(location);
            fail("parsing should fail with a MalformedURLException because the EntityResolver blocked entity resolution");
        } catch (MalformedURLException e) {
        }       
    }
View Full Code Here

        assertEquals("Working really hard here", psNode.getTextContent());
    }


    public void testParserDelegateNamespaces() throws Exception {
        Parser p = new Parser(new WPSConfiguration());
        ExecuteType exec = (ExecuteType)
            p.parse(getClass().getResourceAsStream("wpsExecute_inlineGetFeature_request.xml"));
        assertNotNull(exec);
        assertEquals(1, exec.getDataInputs().getInput().size());

        InputType in = (InputType) exec.getDataInputs().getInput().get(0);
        InputReferenceType ref = in.getReference();
View Full Code Here

        assertEquals("states", typeName.getLocalPart());
        assertEquals("http://usa.org", typeName.getNamespaceURI());
    }
   
    public void testFilterParserDelegate() throws Exception {
        Parser p = new Parser(new WPSConfiguration());
        ExecuteType exec = (ExecuteType)
            p.parse(getClass().getResourceAsStream("wpsExecuteFilterInline.xml"));
        assertNotNull(exec);
        assertEquals(1, exec.getDataInputs().getInput().size());

        InputType in = (InputType) exec.getDataInputs().getInput().get(0);
        ComplexDataType cd = in.getData().getComplexData();
View Full Code Here

*/
public class GetCapabilitiesTest extends TestCase {

    public void testParse() throws Exception {
        WPSConfiguration wps = new WPSConfiguration();
        Parser parser = new Parser( wps );
       
        Object o = parser.parse( getClass().getResourceAsStream( "20_wpsGetCapabilities_response.xml"));
        assertTrue( o instanceof WPSCapabilitiesType);
       
        WPSCapabilitiesType caps = (WPSCapabilitiesType) o;
        assertServiceIdentification( caps.getServiceIdentification() );
        assertServiceProvider( caps.getServiceProvider() );
View Full Code Here

            else
            {
                url = TestData.url(this, "referenceProcessDescriptions.xml");
            }

            Parser parser = new Parser(config);
            in = new BufferedReader(new InputStreamReader(url.openStream()));
            object = parser.parse(in);

            ProcessDescriptionsType processDesc = (ProcessDescriptionsType) object;
            assertNotNull(processDesc);
        }
        finally
View Full Code Here

            Configuration config = new WPSConfiguration();

            URL url;
            url = TestData.url(this, "deegree3Capabilities.xml");

            Parser parser = new Parser(config);
            in = new BufferedReader(new InputStreamReader(url.openStream()));
            object = parser.parse(in);

            assertNotNull("parsed", object);

            WPSCapabilitiesType capabiliites = (WPSCapabilitiesType) object;
            assertEquals("1.0.0", capabiliites.getVersion());
View Full Code Here

            Configuration config = new WPSConfiguration();

            URL url;
            url = TestData.url(this, "geoserverCapabilities.xml");

            Parser parser = new Parser(config);
            in = new BufferedReader(new InputStreamReader(url.openStream()));
            object = parser.parse(in);

            assertNotNull("parsed", object);

            WPSCapabilitiesType capabiliites = (WPSCapabilitiesType) object;
            assertEquals("1.0.0", capabiliites.getVersion());
View Full Code Here

            Configuration config = new WPSConfiguration();

            URL url;
            url = TestData.url(this, "deegree3ProcessDescriptions.xml");

            Parser parser = new Parser(config);
            in = new BufferedReader(new InputStreamReader(url.openStream()));
            object = parser.parse(in);

            ProcessDescriptionsType processDesc = (ProcessDescriptionsType) object;
            assertNotNull(processDesc);
        }
        finally
View Full Code Here

        }

        File file = TestData.file(this, "LiteralDataTypeTestFile.xml");
        BufferedReader in = new BufferedReader(new FileReader(file));
        Configuration config = new WPSConfiguration();
        Parser parser = new Parser(config);

        Object object = parser.parse(in);

        // try casting the response
        ExecuteResponseType exeResponse = null;
        if (object instanceof ExecuteResponseType)
        {
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.