XML Framework ignores internal DTD declarations

Description

All would be good if I could ignore VendorSpecificCapabilitie's child elements

In the Capabilities document:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE WMT_MS_Capabilities SYSTEM "capabilities_1_1_1.dtd"[
<!-- The following element specifies which species to display points and/or distribution models for -->
<!ELEMENT VendorSpecificCapabilities (ScientificName, MapExtras)>
<!ELEMENT ScientificName (#PCDATA)>
<!ELEMENT MapExtras EMPTY>
<!ATTLIST MapExtras
MapTitle (true|false) "false" >
]><WMT_MS_Capabilities version="1.1.1" updateSequence="0">
...

<VendorSpecificCapabilities>
<ScientificName>Client specified scientific name</ScientificName>
<MapExtras MapTitle="false"/>
</VendorSpecificCapabilities>

WARNING: org.xml.sax.SAXException: Could not find element handler for : ScientificName as a child of _ExtendedCapabilities.
9-Nov-2004 2:45:16 PM org.geotools.xml.XMLSAXHandler startElement
WARNING: Line 15 Col 23
org.xml.sax.SAXException: Could not find element handler for : ScientificName as a child of _ExtendedCapabilities.
at org.geotools.xml.handlers.ComplexElementHandler.getHandler(ComplexElementHandler.java:494)
at org.geotools.xml.XMLSAXHandler.startElement(XMLSAXHandler.java:291)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:176)
at org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:138)
at org.geotools.data.wms.WebMapServer.parseCapabilities(WebMapServer.java:416)
at org.geotools.data.wms.WebMapServer.negotiateVersion(WebMapServer.java:277)
at org.geotools.data.wms.WebMapServer.getCapabilities(WebMapServer.java:437)
at org.geotools.data.wms.WebMapServer.<init>(WebMapServer.java:162)
at org.geotools.data.wms.test.ServersTest.testServers(ServersTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: emperorkefka - Time: Tue, 9 Nov 2004 18:49:50 -0600
---------------------
In org.geotools.data.wms.test.ServersTest, uncomment the line following line and run.

servers[7] = new URL(&quot;<a href="http://www.lifemapper.org/Services/WMS/?Service=WMS&VERSION=1.1.1&request=getcapabilities">http://www.lifemapper.org/Services/WMS/?Service=WMS&amp;VERSION=1.1.1&amp;request=getcapabilities</a>&quot;

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: dzwiers - Time: Thu, 25 Nov 2004 14:31:17 -0600
---------------------
it still ignores the dtd&#39;s (wasn&#39;t designed for dtd&#39;s), but won&#39;t cop exceptions if it knows hoe to parse the doc (as in your case).

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: emperorkefka - Time: Wed, 15 Dec 2004 13:17:21 -0600
---------------------
It appears to be dying on the VendorSpecificCapabilities again. (Server is down right now so I was unable to test for myself)

Here&#39;s the capabilities request. Viewing the source xml shows the CubeSERV

element is &quot;defined&quot; inline in the DOCTYPE attrib.

<a href="http://mapserv2.esrin.esa.it/cubestor/cubeserv/cubeserv.cgi?REQUEST=GetCapab">http://mapserv2.esrin.esa.it/cubestor/cubeserv/cubeserv.cgi?REQUEST=GetCapab</a>

ilities&amp;VERSION=1.1.1&amp;SERVICE=WMS

Here&#39;s the offending element:

  • &lt;VendorSpecificCapabilities&gt;

  • &lt;CubeSERV version=&quot;3.0.5&quot;&gt;

  • &lt;MultibandLayers&gt;

&nbsp;&nbsp;&lt;MultibandLayer name=&quot;ASAR:MapAdmin&quot; numOfChannels=&quot;1&quot; /&gt;

&nbsp;&nbsp;&lt;MultibandLayer name=&quot;ASAR_WSM:MapAdmin&quot; numOfChannels=&quot;1&quot; /&gt;

&nbsp;&nbsp;&lt;/MultibandLayers&gt;

&nbsp;&nbsp;&lt;/CubeSERV&gt;

&nbsp;&nbsp;&lt;/VendorSpecificCapabilities&gt;

Here&#39;s the top of the exception trace:

org.xml.sax.SAXException: Could not find element handler for : CubeSERV as

a child of null.

at

org.geotools.xml.handlers.ComplexElementHandler.getHandler(ComplexElementHan

dler.java:539)

at

org.geotools.xml.XMLSAXHandler.startElement(XMLSAXHandler.java:302)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1672)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)

at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)

at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)

at

org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)

at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)

at javax.xml.parsers.SAXParser.parse(SAXParser.java:143)

at

org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:137)

at

org.geotools.data.wms.WebMapServer.parseCapabilities(WebMapServer.java:323)

at

org.geotools.data.wms.WebMapServer.negotiateVersion(WebMapServer.java:173)

at

org.geotools.data.wms.WebMapServer.getCapabilities(WebMapServer.java:338)

at org.geotools.data.wms.WebMapServer.&lt;init&gt;(WebMapServer.java:102)

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: bwoodward - Time: Thu, 6 Jan 2005 13:28:53 -0600
---------------------
Summary of changes:

WMSSchema.java: 1) added subclass WMSIgnoreType 2) Added reference to A WMSIgnoreType element instance in the WMSSchema&#39;s top level element list (note: somewhat kludgy: this reference must be last in list or everything that follows is also ignored)

WMSComplexTypes.java: 1) Modified _VendorSpecificCapabilitiesType to include a child element of type WMSIgnoreType

IgnoreHandler.java: 1) defined static NAME identifier 2) added constructor and accessor to accept/return the handler&#39;s element

ElementHandlerFactory.java 1) in createElementHandler method; check for an explicit reference to a IgnoreType element to trigger return of an instance of IgnoreHandler

ServersTest.java 1) added additional urls to servers w/ vendor specific capabilities for testing

codehaus
April 10, 2015, 3:25 PM

CodeHaus Comment From: emperorkefka - Time: Thu, 13 Jan 2005 16:24:04 -0600
---------------------
Fixed. Now parses all known servers. Thanks Bill

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

Affects versions

Priority

High
Configure