Skip to main content

JAXP-validation of complex schema fails

1 reply [Last post]
Joined: 2003-06-15

Hi all,
I have developed a quite complex modular schema consisting of about 20 .xsd-files. Instance documents are to be signed with XML DSig, so I have to import this schema. To be able to work with local copies of W3C files, I use a catalog.
Although my development environment (Eclipse with Web Tools Plugin) seems to validate my documents, I can't get SAX to validate the Signature element in documents; all I ever get is the infamous "Failed to read schema document '', because..." error message.
What do I do wrong?
A broken-down version of my project looks like the following listings:

Listing 1: Basic schema
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

I just define a bogus namespace for my application; I include one other module and import XML DSig. I define an element with name Security containing - within its own namespace - the element Signature from XML DSig. The attribute definition for the element Data is only introduced to use my external module.

Listing 2: external Module
<?xml version="1.0" encoding="UTF-8"?>

Nothing fancy here. The include works, based on my catalog.

Listing 3: Document instance of this schema
<?xml version="1.0" encoding="UTF-8"?>

This is just plain text.

I use both namespaces here, my own and the namespace of DSig.

Listing 4: catalog file
<?xml version="1.0" encoding="UTF-8"?>

The catalog is configured by a file and is used by the SAX-Parser, as its output shows (verbosity is up to 10):

Parse catalog: file:/C:/projekte/Utilities/bin/TestCatalog.xml
Loading catalog: file:/C:/projekte/Utilities/bin/TestCatalog.xml
Default BASE: file:/C:/projekte/Utilities/bin/TestCatalog.xml
Resolved system:
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document [...]

Any suggestions are welcome.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-15

Hi all,

I solved this one by myself. The basic problem was my catalog file: for use by a standalone application, it must contain an entry for XML Schema:

publicId="-//W3C//DTD XMLSchema 200102//EN"
uri="file:///C:/projekte/Utilities/docs/XMLSchema.dtd" />
The XML DSig needs this entry, as will lots of other Schema-related documents.
No example, tutorial or other source, either for XML DSig or Catalogs, ever mentioned that, and the error message of the SAX parser is grossly misleading.
Additionally, not only XMLSchema.dtd is needed locally, but also datatypes.dtd, which is included by XMLSchema.dtd and must be present at the same location.