You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Stefan Lecho <St...@iconmedialab.com> on 2001/03/23 09:44:58 UTC

DTD and schema in XML document

Hi,

I want to define a DTD reference as well as a schema reference in
the XML document. An example is included beneath. 
This is useful to avoid too much user frustration - 
changing all the existing documents containing DTD references - 
and to be backwards compatible.

Trying this multiple definition with the distributed
data/personal-schema.xml
example, xerces generates the stack trace shown underneath.

Is it at all possible to include a DTD and a schema in the same document ?
And if the answer is 'yes', what is causing the error to be generated ?

Regards, Stefan.

Document header:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE personnel SYSTEM 'personal.dtd'>
<personnel xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
	   xsi:noNamespaceSchemaLocation='personal.xsd'>

Stack trace:
java.lang.ClassCastException: org.apache.xerces.validators.dtd.DTDGrammar
	at
org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(XMLVal
idator.java:2409)
	at
org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndA
ttributes(XMLValidator.java:2325)
	at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidat
or.java:921)
	at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanne
r.java:1858)
	at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:1001)
	at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:381)
	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:952)
	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:991)
	at dom.wrappers.DOMParser.parse(DOMParser.java:111)
	at dom.DOMCount.count(DOMCount.java:138)
	at dom.DOMCount.main(DOMCount.java:334)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stefan Lecho
  Internet Application Developer
  Wireless Technical Contact
  IconMedialab, Brussels +32.2.506.23.31
http://www.iconmedialab.com


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org