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

Re: DTD to Schema converter

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 3 Dec 2001 19:28:07 +0000
Message-ID: <1943105024.20011203192807@jenitennison.com>
To: Stanley Guan <Stanley.Guan@oracle.com>
CC: xmlschema-dev@w3.org
Hi Stanley,

> 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>

You missed off the mixed attribute from xs:complexType - it needs to
be mixed to allow character data as well as element children. Also,
technically ANY permits *any* elements as children, not just ones in
the target namespace of the schema (since DTDs don't have a concept of
target namespaces). So I'd say it was:

<xs:element name="abc">
  <xs:complexType mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:any />
    </xs:sequence>
  </xs:complexType>
</xs:element>

(Using the slightly shorter syntax rather than an explicit restriction
of xs:anyType.)

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

See http://puvogel.informatik.med.uni-giessen.de/dtd2xs/. There may be
others - this was just from a quick look at the XML Schema page at
W3C: http://www.w3.org/XML/Schema.html.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Monday, 3 December 2001 14:28:08 GMT

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