Re: DTD to Schema converter

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 UTC