First, thank you to all the developers who have made Xerces possible and
available under open source. The following does not represent a complaint,
just an attempt to get more information.
I've been trying to learn how to use XML, XML Schemas and Xerces-J 1.0.3.
I read through the xerces-dev mailing list archives and saw George
T. Joseph's Mar 9 report:
> Subject: Last change to XMLParser.java broke Schema validation
> From: George T. Joseph ([EMAIL PROTECTED])
> Date: Thu Mar 09 2000 - 22:49:24 MET
> Defaulting fNamespacesEnabled to 'true' in XMLParser causes namespaces
> to be enabled for DOMParser as well as SAXParser. This causes Schema
> validation (which uses the DOMParser) to choke with "Attribute "xmlns"
> must be declared for element..." plus a "must be declared" error for
> every element and attribute. Try the personal-schema.xml with either
> "SAXCount -v" or "DOMCount". Plain DOMParser DTD validation also
> chokes.
> To set the new SAX2 default, you might want to call setNamespaces(true)
> in the SAXParser constructor rather than setting the field in
> XMLParser.
and Jeffrey Rodriguez's reply:
> Subject: Re: Last change to XMLParser.java broke Schema validation
> From: Jeffrey Rodriguez ([EMAIL PROTECTED])
> Date: Fri Mar 10 2000 - 01:15:42 MET
> Yes, that sounds like a screw up. The change was supposed to be done in
> the SAXParser not the XMLParser.
> It is a bug.
I attempted to follow George Joseph's suggested fix, but I don't think I got
it right (I'm still only learning Java). However, I do seem to have gotten
Schema parsing to happen simply by setting
parser.setFeature("http://xml.org/sax/features/validation", true);
However, it appears that the Feb 2000 version of XML Schemas somehow is not
parsed by Xerces. I'm encountering the following problems:
1) It appears that the <include schemaLocation="..."> facility is not
implemented; is this true?
2) Schema parsing fails on complexType if the complexType contains an
attribute definition like
<complexType name="foo">
<attribute name="a" type="integer"/>
<element name="bar" type="string"/>
</complexType>
You get errors of this form:
"The content of element type "complexType" must match
"(annotation?,((minInclusive|minExclusive|(maxInclusive|maxExclusive)|precision|scale|pattern|enumeration|length|maxlength|minlength|encoding|period)*|((element|all|choice|sequence|group|any)*,(attribute|attributeGroup)*,anyAttribute?)))".
I gather that XML Schemas are not entirely implemented yet, or at least not
for the Feb 2000 spec. Is there a subset that will work? If so, what is
that subset?
--
Mike Hucka, Ph.D. -- [EMAIL PROTECTED] -- ph: 626.395.6818
Postdoctoral researcher, software developer, systems administrator
GENESIS Development Group, Division of Biology 216-76, Caltech