dtd newbie

Discussion in 'XML' started by Larry, Mar 25, 2005.

  1. Larry

    Larry Guest

    Hi all,

    I'm quite a XML/XSL/DTD newbie, is this DOCTYPE correct? thanks

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="stile.xsl"?>
    <!DOCTYPE catalog
    [
    <!ELEMENT catalog (cd+)>
    <!ELEMENT cd (title,artist,country,company,price,year)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT artist (#PCDATA)>
    <!ELEMENT country (#PCDATA)>
    <!ELEMENT company (#PCDATA)>
    <!ELEMENT price (#PCDATA)>
    <!ELEMENT year (#PCDATA)>
    ]>

    <catalog>
    <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
    </cd>
    <cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
    </cd>
    </catalog>
     
    Larry, Mar 25, 2005
    #1
    1. Advertising

  2. Larry wrote:


    > I'm quite a XML/XSL/DTD newbie, is this DOCTYPE correct? thanks
    >
    > <?xml version="1.0" encoding="ISO-8859-1"?>
    > <?xml-stylesheet type="text/xsl" href="stile.xsl"?>
    > <!DOCTYPE catalog
    > [
    > <!ELEMENT catalog (cd+)>
    > <!ELEMENT cd (title,artist,country,company,price,year)>
    > <!ELEMENT title (#PCDATA)>
    > <!ELEMENT artist (#PCDATA)>
    > <!ELEMENT country (#PCDATA)>
    > <!ELEMENT company (#PCDATA)>
    > <!ELEMENT price (#PCDATA)>
    > <!ELEMENT year (#PCDATA)>
    > ]>
    >
    > <catalog>
    > <cd>
    > <title>Empire Burlesque</title>
    > <artist>Bob Dylan</artist>
    > <country>USA</country>
    > <company>Columbia</company>
    > <price>10.90</price>
    > <year>1985</year>
    > </cd>


    Technically the DTD you have written is fine for the XML instance
    document, the DTD is syntatically correct and its semantics models the
    structure of the XML instance.

    As for modelling a CD list however there might be more complex
    scenarios, what happends if there is a CD done by multiple artists for
    instance. And what currency is the price value for?

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 25, 2005
    #2
    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.
Similar Threads
  1. Joseph Tilian
    Replies:
    0
    Views:
    362
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,772
    Ronald Fischer
    Mar 17, 2005
  3. Ghee
    Replies:
    0
    Views:
    363
  4. Andreas

    newbie: xsd or dtd?

    Andreas, Feb 14, 2005, in forum: XML
    Replies:
    14
    Views:
    699
    Peter Flynn
    Feb 19, 2005
  5. test
    Replies:
    2
    Views:
    2,094
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page