01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.xml;
17:
18: import java.io.IOException;
19: import java.net.URI;
20: import java.net.URISyntaxException;
21: import java.net.URL;
22: import java.util.logging.Level;
23:
24: import javax.xml.parsers.ParserConfigurationException;
25: import javax.xml.parsers.SAXParser;
26: import javax.xml.parsers.SAXParserFactory;
27:
28: import org.xml.sax.SAXException;
29:
30: import junit.framework.TestCase;
31:
32: /**
33: *
34: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/test/java/org/geotools/xml/SLDParserTest.java $
35: */
36: public class SLDParserTest extends TestCase {
37:
38: public void testRemoteSLD() throws ParserConfigurationException,
39: SAXException, URISyntaxException, IOException {
40: URL example = new URL(
41: "http://schemas.opengis.net/sld/1.0.20/example-sld.xml");
42:
43: SAXParserFactory spf = SAXParserFactory.newInstance();
44: spf.setNamespaceAware(true);
45: spf.setValidating(false);
46:
47: SAXParser parser = spf.newSAXParser();
48:
49: XMLSAXHandler xmlContentHandler = new XMLSAXHandler(new URI(
50: example.toString()), null);
51: XMLSAXHandler.setLogLevel(Level.FINEST);
52: XSISAXHandler.setLogLevel(Level.FINEST);
53: XMLElementHandler.setLogLevel(Level.FINEST);
54: XSIElementHandler.setLogLevel(Level.FINEST);
55:
56: // fails
57: // parser.parse(example.openStream(), xmlContentHandler);
58: //
59: // Object doc = xmlContentHandler.getDocument();
60: // assertNotNull("Document missing", doc);
61: }
62: }
|