Package org.geotools.xml

Examples of org.geotools.xml.Parser.validate()


    }
   
    List<Exception> validateSLD() {
        Parser parser = new Parser(new SLDConfiguration());
        try {
            parser.validate( new ByteArrayInputStream(editor.getInput().getBytes()) );
        } catch( Exception e ) {
            return Arrays.asList( e );
        }
       
        return parser.getValidationErrors();
View Full Code Here


                   "</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

    }
   
    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

   
    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

   
    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();
    }
   
    public void testParseSldWithExternalEntities() throws Exception {
        // this SLD file references as external entity a file on the local filesystem
View Full Code Here

     */
    protected void validate(MockHttpServletResponse response) throws Exception {
        GSSConfiguration configuration = (GSSConfiguration) applicationContext
                .getBean("gssXmlConfiguration");
        Parser parser = new Parser(configuration);
        parser.validate(new StringReader(response.getOutputStreamContent()));
        if (parser.getValidationErrors().size() > 0) {
            for (Iterator it = parser.getValidationErrors().iterator(); it.hasNext();) {
                SAXParseException se = (SAXParseException) it.next();
                System.out.println(se);
            }
View Full Code Here

   
    List<Exception> validateSLD() {
        Parser parser = new Parser(new SLDConfiguration());
        try {
            final String sld = editor.getInput();
            parser.validate( new ByteArrayInputStream(sld.getBytes()) );
        } catch( Exception e ) {
            return Arrays.asList( e );
        }
       
        return parser.getValidationErrors();
View Full Code Here

    }

    List<Exception> validate11(Object input, EntityResolver entityResolver) throws IOException {
        Parser p = createSld11Parser(input, null, null);
        try {
            p.validate(toReader(input));
            return p.getValidationErrors();
        }
        catch(Exception e) {
            throw new IOException(e);
        }
View Full Code Here

    }

    @Override
    public Object decode(InputStream input) throws Exception {
        Parser p = new Parser(config);
        p.validate(input);
       
        if (!p.getValidationErrors().isEmpty()) {
            throw new ServiceException("Errors were encountered while parsing GeoPackage contents: " + p.getValidationErrors());       
        }
       
View Full Code Here

    @Test
    public void testValidCapabilitiesDocument() throws Exception {
        InputStream in = get("wfs?service=WFS&version=2.0.0&request=getCapabilities");
        Parser p = new Parser(new WFSConfiguration());
        p.setValidating(true);
        p.validate(in);
       
        for (Exception e : (List<Exception>)p.getValidationErrors()) {
            System.out.println(e.getLocalizedMessage());
        }
        assertTrue(p.getValidationErrors().isEmpty());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.