DTD to XML Schema

Discussion in 'XML' started by NSB, Dec 9, 2005.

  1. NSB

    NSB Guest

    Hi all!

    I've two questions about converting a DTD to a XML schema

    Is the following conversion correct:
    DTD (source):
    <!ELEMENT uug-query:search-term (#PCDATA)>

    Schema:
    <xs:complexType name="search-term" type="general">
    <xs:choise minOccurs="0" maxOccures="unbound"/>
    </xs:complexType>
    <xs:ekement name="search-term" type="search-term"/>

    I've a hugh number of DTD elements with attribut lists looking like
    this sample:
    <!ELEMENT abc:xyz EMPTY>
    <!ATTLIST abc:xyz parameter CDATA #IMPLIED>

    How can I convert this structures correctly? Specifically EMPTY and
    #IMPLIED.

    Thanks in advance!

    Best regards,
    Nico
     
    NSB, Dec 9, 2005
    #1
    1. Advertising

  2. NSB writes:

    > Is the following conversion correct:
    > DTD (source):
    > <!ELEMENT uug-query:search-term (#PCDATA)>
    >
    > Schema:
    > <xs:complexType name="search-term" type="general">
    > <xs:choise minOccurs="0" maxOccures="unbound"/>
    > </xs:complexType>
    > <xs:ekement name="search-term" type="search-term"/>


    For this you want

    <xs:complexType name="search-term" mixed="true"/>

    or simply say

    <xs:element name="search-term" type="xs:anySimpleType"/>


    > I've a hugh number of DTD elements with attribut lists looking like
    > this sample:
    > <!ELEMENT abc:xyz EMPTY>
    > <!ATTLIST abc:xyz parameter CDATA #IMPLIED>
    >
    > How can I convert this structures correctly? Specifically EMPTY and
    > #IMPLIED.


    <xs:element name="xyz" type="xyz"/>
    <xs:complexType name="xyz">
    <xs:attribute name="parameter"/>
    </xs:complexType>

    Since no content model, must be EMPTY.
    Attribute defaults to optional==#IMPLIED and
    type="xs:anySimpleType"==CDATA.

    Suggest you read the XML Schema primer [1].

    ht

    [1] http://www.w3.org/TR/xmlschema-0/
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Dec 9, 2005
    #2
    1. Advertising

  3. NSB

    JAPISoft Guest

    <xsd:element name="xyz">
    <xsd:complexType>
    <xsl:attribute name="parameter" type="xsd:string"/>
    </xsd:complexType>
    </xsd:element>

    Best regards,

    A.Brillant
    EditiX - XML Editor and XSLT Debugger
    http://www.editix.com


    NSB wrote:
    > Hi all!
    >
    > I've two questions about converting a DTD to a XML schema
    >
    > Is the following conversion correct:
    > DTD (source):
    > <!ELEMENT uug-query:search-term (#PCDATA)>
    >
    > Schema:
    > <xs:complexType name="search-term" type="general">
    > <xs:choise minOccurs="0" maxOccures="unbound"/>
    > </xs:complexType>
    > <xs:ekement name="search-term" type="search-term"/>
    >
    > I've a hugh number of DTD elements with attribut lists looking like
    > this sample:
    > <!ELEMENT abc:xyz EMPTY>
    > <!ATTLIST abc:xyz parameter CDATA #IMPLIED>
    >
    > How can I convert this structures correctly? Specifically EMPTY and
    > #IMPLIED.
    >
    > Thanks in advance!
    >
    > Best regards,
    > Nico
    >
     
    JAPISoft, Dec 12, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page