W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Re: DTD to Schema converter

From: Stanley Guan <Stanley.Guan@oracle.com>
Date: Mon, 03 Dec 2001 11:16:17 -0800
Message-ID: <3C0BCF81.FF17869E@oracle.com>
To: xmlschema-dev@w3.org
Jeni,

So, the conversion from DTD to Schema for the following statement
   <!ELEMENT abc ANY>
should be
    <xs:element name="abc">
      <xs:complexType>
        <xs:complexContent>
          <xs:restriction base="xs:anyType">
             <xs:sequence minOccurs=0 maxOccurs="unbounded">
               <any namespace="##local"/>
             </xs:sequence>
             <!-- any declared attributes for "abc" comes here -->
          </xs:restriction>
        </xs:complexContent>
      </xs:complexType>
    </xs:element>

BTW, does anyone have already implemented the mentioned DTD
to Schema converter?  Any paper discusses all the rules for the
conversion?

Thx,

-Stanley


Jeni Tennison wrote:

> Hi Stanley,
>
> > I am working on a converter to convert DTD declarations to Schema
> > declarations. After reading the XML spec., I am still not clear
> > what's the expected result for the following DTD declarations:
> >    <!ELEMENT abc ANY>
> > For this declaration, it does NOT have associated attribute type
> > declarations with element type "abc".
> >
> > For a validating processor, does this mean:
> >     1) element "abc" can have any attributes (i.e. wildcard attributes
> > in Schema), or
> >     2) element "abc" cannot have any attributes?
>
> It means that element 'abc' cannot have any attributes. Element
> declarations in DTDs only talk about the *content* of elements, unlike
> complex type definitions that also talk about attributes. ANY content
> is equivalent to a mixed complex type with a sequence of xs:any
> wildcards that can occur any number of times.
>
> > Note that the only thing I read in XML spec. is:
> > All attributes for which no declaration has been read should be
> > treated by a non-validating processor as if declared CDATA.
>
> That's about the stuff that gets reported by non-validating processors
> - ones that don't look at the DTD. DTDs don't support an 'any
> attribute' wildcard.
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.com/
Received on Monday, 3 December 2001 14:16:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:25 GMT