www.webdeveloper.com
Results 1 to 2 of 2

Thread: XML - single tag, multiple values?

  1. #1
    Join Date
    Apr 2009
    Posts
    1

    Question XML - single tag, multiple values?

    Hi guys,

    I'm a bit stuck, just wondering if anyone could help me. It's for a final year assignment at university, to create a costume searching system for a made up sci-fi TV show (in case you were wondering!). We've been given this DTD:

    <!ELEMENT costumeCatalogue (supplier, costume+)>
    <!ELEMENT supplier (name, email)>
    <!ELEMENT costume (characterType, gender, size+)>
    <!ELEMENT characterType (species, caste?)>
    <!ELEMENT size (top, bottom)>

    <!ELEMENT name (#PCDATA)>
    <!ELEMENT email (#PCDATA)>
    <!ELEMENT gender (#PCDATA)>
    <!ELEMENT species (#PCDATA)>
    <!ELEMENT caste (#PCDATA)>
    <!ELEMENT top (#PCDATA)>
    <!ELEMENT bottom (#PCDATA)>

    And this was some example data to go in our xml file (I've cut it down to the important bit!):

    Sizes:
    top - large, medium
    bottom - large, medium

    I was unsure how to implement this, whether to do it like so:

    <size>
    <top>Large</top>
    <top>Medium</top>
    <bottom>Large</bottom>
    <bottom>Medium</bottom>
    </size>

    Or simply to do it like this:

    <size>
    <top>Large, Medium</top>
    <bottom>Large, Medium</bottom>
    </size>

    I asked my lecturer, he said he couldn't say how to do it, all he could say was that it was 'neither' of those two ways. Is there any other way to do it?

    Thanks, Zoe

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Your second try is valid in the XML sense of the word, but not what the lecturer has in mind. The "+" in
    Code:
    <!ELEMENT costume (characterType, gender, size+)>
    means that a costume must have one or more size elements.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles