Changeset 22962 in osm for applications/editors


Ignore:
Timestamp:
2010-09-03T01:43:46+02:00 (14 years ago)
Author:
yellowbkpk
Message:

Setting the XML parser to ignore schema and DTD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/AddWMSLayerPanel.java

    r22942 r22962  
    5353import org.w3c.dom.Node;
    5454import org.w3c.dom.NodeList;
     55import org.xml.sax.EntityResolver;
    5556import org.xml.sax.InputSource;
    5657import org.xml.sax.SAXException;
     
    255256        try {
    256257            DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
     258            builderFactory.setValidating(false);
    257259            builderFactory.setNamespaceAware(true);
    258260            DocumentBuilder builder = builderFactory.newDocumentBuilder();
     261            builder.setEntityResolver(new EntityResolver() {
     262                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
     263                    System.out.println("Ignoring DTD " + publicId + ", " + systemId);
     264                    return new InputSource(new StringReader(""));
     265                }
     266            });
    259267            document = builder.parse(new InputSource(new StringReader(incomingData)));
    260268        } catch (ParserConfigurationException e) {
Note: See TracChangeset for help on using the changeset viewer.