Re: [XML Schema 1.1] The <restriction> element is not declared in the DTD for XML Schema 1.1

On 3 Jul 2009, at 06:35 , Costello, Roger L. wrote:

>
> Hi Michael,
>
> In the datatypes specification I see the ELEMENT declaration for the  
> restriction element used in simpleTypes.
>
> But I don't see in the structures specification a declaration for  
> the restriction element used in derive-by-restriction.
>
> They shouldn't be declared the same way, right?

DTDs don't have context-dependent declarations (or 'local
GI - declaration bindings' if one prefers to think of it
that way).  So (as the comment immediately following the
declaration in datatypes.dtd mentions) the same declaration
must handle both simple type restriction and complex
type restriction.

> Can you provide me the declaration for the restriction element used  
> in derive-by-restriction? I want to incorporate it into the tutorial  
> I am creating.


The declaration reads

     <!ELEMENT %restriction; ((%annotation;)?,
                              (%restriction1; |
                               ((%simpleType;)?,(%facet;)*)),
                              (%attrDecls;))>

Expanding the parameter entities for the generic identifiers
(aka 'element type names') of the elements, assuming
a namespace prefix of xsd, and removing some now-extraneous
parentheses, this is

     <!ELEMENT xsd:restriction (xsd:annotation?,
                                (%restriction1; |
                                 (xsd:simpleType?, xsd:facet*)
                                ),
                                (%attrDecls;))>

The parameter entities attrDecls and restriction1 are
declared in XMLSchema.dtd.  Expanding them to get the effective
declaration of the restrction element, and reformatting to
make the structure a little easier to read, yields:

     <!ELEMENT xsd:restriction
         ( xsd:annotation?,
           (
             (xsd:all | xsd:choice | xsd:sequence | xsd:group)?
           |
             (xsd:simpleType?, xsd:facet*)
           ),
           (xsd:attribute | xsd:attributeGroup)*,
           xsd:anyAttribute?
         )>

I hope this helps.  If you want to have a DTD formulation
of the content model used when restriction is a child of
complexContent, you'll need to eliminate the simpleType
branch (or transcribe a content model from the schema for
schema documents), which I will leave as an exercise for
the reader.

-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************

Received on Friday, 3 July 2009 15:03:26 UTC