I am trying to validate a schema for which I do not have a minimally valid
instance. I have pulled xmlSchema.xml, xmlSchema.dtd and datatypes.dtd down
from the w3 site and stashed them locally. It seems to me that I should be
able to edit the schema document root attributes to include
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
 xsi:schemaLocation="foo xmlSchema.xml"
where xmlSchema.xml resolves to my local copy of xmlSchema.xml.  However,
when I try this (and similarly when I insert a <!DOCTYPE> directive
referring to XMLSchema.dtd) I get a long list of errors from xerces, along
the lines of

Element type "xsd:schema" must be declared.
Attribute "targetNamespace" must be declared for element type "xsd:schema".
Attribute "elementFormDefault" must be declared for element type
"xsd:schema".
Element type "xsd:element" must be declared.
Attribute "name" must be declared for element type "xsd:element".
Element type "xsd:complexType" must be declared.
Element type "xsd:sequence" must be declared.


For example, here are the first few lines of my schema (note the <!DOCTYPE>
directive inserted on the second line)

<?xml version="1.0" encoding="UTF8"?>
<!DOCTYPE xsd:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN"
                            "XMLSchema.dtd">
<xsd:schema elementFormDefault="qualified"
  targetNamespace="http://www.bar.org"; xmlns="http://www.bar.org"; xmlns:xs
"http://www.w3.org/2001/XMLSchema";>
  <xsd:element name="Bar">

My resolver for the schema-validating parse consists of one line:
  return new InputSource(new java.net.URL(systemId).openStream());
which takes care of both XMLSchema.dtd and datatypes.dtd.  The input schema
is valid (i double checked using xsd). 

Surely there must be some way to massage a schema so that it can be
validated against either xmlSchema.xml or xmlSchema.dtd using xerces-j v.1.
Any pointers would be much appreciated.

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

Reply via email to