How do you get hold of the parser. If you use jaxp1.2 apis xerces
behaviour is as per specified in the jaxp1.2 spec.

As per the jaxp1.2 spec if schema language property is set the document
will only be validated against a schema and never against a dtd.

thanks,
Vinay

-----Original Message-----
From: Peter C. Chapin [mailto:[EMAIL PROTECTED]
Sent: Friday, July 11, 2003 11:13 PM
To: [EMAIL PROTECTED]
Subject: Problem validating schema based document with a <!DOCTYPE>
declaration.



Hello!

I have a document that starts out like this

---- cut here ----
<?xml version="1.0"?>

<!DOCTYPE observation-set [
  <!ENTITY copy  "&#169;">
]>

<observation-set
 xmlns="http://www.ecet.vtc.edu/~pchapin/AOML_0.0";
 xmlns:xhtml="http://www.w3.org/1999/xhtml";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://www.ecet.vtc.edu/~pchapin/AOML_0.0
   AOML.xsd">

 <!-- etc -->
</observation-set>

---- cut here ----

The document is controlled by an XML Schema but I wanted to
introduce a few useful entities so I needed a <!DOCTYPE>
declaration to create a place to declare those entities.

This document validates fine with MSXML (XMLSpy) and with XSV.
However, Xerces-J (v2.4.0 and v2.3.0) complains saying that
"observation-set" is undeclared. In fact, it says that every
element in my document is undeclared. Xerces is fine with the
document if I remove the <!DOCTYPE> and the internal DTD
subset (and any relevant entity references, of course). It
seems like Xerces sees the DOCTYPE and becomes convinced that
the document is fully described by a DTD. Since no DTD is
present to declare any of the elements, Xerces complains. The
fact that there is an XML Schema for the document goes
unnoticed.

Is this an issue with Xerces or my document? If it's an issue
with my document, then how does on go about declaring and
using entities in documents that are based on a Schema?

In case it matters, I'm running Xerces using one of the sample
programs with the following batch file (this is under Win2k):

---- cut here ----
java sax.Counter -n -np -v -s -f %1
---- cut here ----

TIA,
Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to