dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Multimedia student- need help with xml assignment

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Posts
    1

    Unhappy Multimedia student- need help with xml assignment

    hi, i'm having trouble with some of an assignment. I have been required to design a xml schema for the following problem:

    A travel company wants you to design a new XML language using an XML
    Schema as the definition. They have the following requirements: The XML
    documents are about vacations and should contain customer details and resort
    details. Customers have customer numbers as well as names and addresses.
    They also have a number in party (adults and children).
    Resorts have addresses, descriptions and facilities. Whilst the addresses and
    descriptions are mandatory, it is recognised that not all resorts will have the
    same facilities.
    Facilities in typical resorts include: beach (inc. distance from resort), golf (total
    number of holes: 18, 36, etc), swimming pool(s), gymnasium, crèche.

    So far this is what I have come up with:

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="vacations">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="customer_details">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="customer_number" type="xs:integer"/>
    <xs:element name="customer_name" type="xs:string"/>
    <xs:element name="customer_address" type="xs:string"/>
    <xs:element name="number_in_party">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="adults" type="xs:integer"/>
    <xs:element name="children" type="xs:integer"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="resort_details">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="addresses" type="xs:string"/>
    <xs:element name="descriptions" type="xs:string"/>
    <xs:element name="facilities">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="beach" type="xs:string"/>
    <xs:element name="golf" type="xs:string"/>
    <xs:element name="swimming_pool" type="xs:string"/>
    <xs:element name="gymnasium" type="xs:string"/>
    <xs:element name="creche" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>

    I'm abit confused on the part where it say not all resorts will have the same facilities and think i am required to show this in my scheme? how do i go about doing that?

  2. #2
    Join Date
    Aug 2011
    Posts
    23
    HTML Code:
    <note>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>
    <body>Don't forget me this weekend!</body>
    </note>
    HTML Code:
    <html>
    <body>
    
    <script type="text/javascript">
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.open("GET","cd_catalog.xml",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML; 
    
    document.write("<table border='1'>");
    var x=xmlDoc.getElementsByTagName("CD");
    for (i=0;i<x.length;i++)
      { 
      document.write("<tr><td>");
      document.write(x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
      document.write("</td><td>");
      document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
      document.write("</td></tr>");
      }
    document.write("</table>");
    </script>
    
    </body>
    </html>

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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