You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Michael Hucka <mh...@bbb.caltech.edu> on 2000/03/19 06:58:53 UTC

How much of Schema parsing is really implemented in 1.0.3?

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 (gtj@peakin.com)
    > 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 (jeffreyr_97@hotmail.com)
    > 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.   --    mhucka@caltech.edu    --    ph: 626.395.6818
  Postdoctoral researcher, software developer, systems administrator
    GENESIS Development Group, Division of Biology 216-76, Caltech

Re: How much of Schema parsing is really implemented in 1.0.3?

Posted by Mike Pogue <mp...@apache.org>.
Two points:

1) The subset that Xerces implements is described in the documentation (hint, hint!)
2) The Schema Spec itself is complex, and still moving quite a bit, so expect much change over the
next couple of months! 

Mike

Michael Hucka wrote:
> 
> 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 (gtj@peakin.com)
>     > 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 (jeffreyr_97@hotmail.com)
>     > 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.   --    mhucka@caltech.edu    --    ph: 626.395.6818
>   Postdoctoral researcher, software developer, systems administrator
>     GENESIS Development Group, Division of Biology 216-76, Caltech

RE: How much of Schema parsing is really implemented in 1.0.3?

Posted by Tom Watson <to...@adjunga.com>.
Michael,

A couple other points about Schema... the current release is in synch with
the 12/17 spec and is a subset.  It only allows you to specify a schema file
on the root element using the xmlns attribute.  This is not the way the way
it will stay.  Also, use type and dataType, not complexType and simpleType.
Refer to the personal-schema sample in the data directory of the release for
more details.

The next release of schema support will be in synch with the 2/25 (or maybe
even a bit later) spec.  It will have complexType and simpleType.  However,
releases for a while (here at xml.apache) will be moving towards this
target.  So it may take a few weeks before it's all there.  Features coming
soon are inheritance of simple and complex types, forward references,
schemaLocation, import and include and schemas across namespaces.  Anys
(wildcards) will be trailing a bit and unique and keys will be at the tail
end.

Also, the spec is still moving and not candidate release, so we will have to
track these changes for the next couple to few months until it settles.
Stay tuned!

Tom Watson
rtwatson@us.ibm.com
tom@adjunga.com


> -----Original Message-----
> From: Michael Hucka [mailto:mhucka@bbb.caltech.edu]
> Sent: Saturday, March 18, 2000 9:59 PM
> To: Xerces Developer's Mailing List
> Subject: How much of Schema parsing is really implemented in 1.0.3?
>
>
> 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 (gtj@peakin.com)
>     > 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 (jeffreyr_97@hotmail.com)
>     > 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|maxExclusi
> ve)|precision|scale|pattern|enumeration|length|maxlength|minlength
> |encoding|period)*|((element|all|choice|sequence|group|any)*,(attr
> ibute|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.   --    mhucka@caltech.edu    --    ph: 626.395.6818
>   Postdoctoral researcher, software developer, systems administrator
>     GENESIS Development Group, Division of Biology 216-76, Caltech
>


RE: How much of Schema parsing is really implemented in 1.0.3?

Posted by "George T. Joseph" <gt...@peakin.com>.
Michael,

The bug I was reporting was introduced (and fixed) after the Xerces-J 1.0.3
snapshot was taken.  If you downloaded the binary 1.0.3 distribution you
shouldn't have a problem.  Using setFeature() as you describe is all you need.

Schema support is still at the 12/17/1999 level.  If complexType were supported,
I think elements must come before attributes in your sample.

george


-----Original Message-----
From: Michael Hucka [mailto:mhucka@bbb.caltech.edu]
Sent: Sunday, March 19, 2000 00:59
To: Xerces Developer's Mailing List
Subject: How much of Schema parsing is really implemented in 1.0.3?


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 (gtj@peakin.com)
    > 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 (jeffreyr_97@hotmail.com)
    > 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.   --    mhucka@caltech.edu    --    ph: 626.395.6818
  Postdoctoral researcher, software developer, systems administrator
    GENESIS Development Group, Division of Biology 216-76, Caltech