DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: XML Help

  1. #1
    Join Date
    Mar 2010

    XML Help


    Its my first year at uni and my exams are coming up soon. My teacher gave us a list of questions (like a mock exam) to study over the holiday which will prepare us for the exam. I am stuck with this question. Any help is appreciated. I just need to know some ideas of how to do it. (not asking you to do it for me because there is no point, I want to understand how! lol).

    The question is: Construct a sample XML document which is valid according to the external DTD given below. This describes information an Estate Agent might wish to store about a house. Your document should be su±ciently complex to test your implementation of the DTD (e.g., it should contain information on at least two houses).

    <!ELEMENT houses (house*)>
    <!ELEMENT house (room+)>
    <!ELEMENT room (dimensions, windows, furniture*)>
    <!ELEMENT dimensions (width, length)>
    <!ELEMENT windows (window*)>
    <!ELEMENT window (elevation, width, height)>
    <!ELEMENT furniture (#PCDATA)>
    <!ELEMENT width (#PCDATA)>
    <!ELEMENT length (#PCDATA)>
    <!ELEMENT height (#PCDATA)>
    <!ELEMENT elevation EMPTY>
    <!ATTLIST room name ID #REQUIRED
    colour IDREF #IMPLIED>
    <!ATTLIST elevation facing (north | south | east | west) #REQUIRED>
    Your XML document start with:
    <?xml version="1.0"?>
    <!DOCTYPE employees SYSTEM
    Thanks a lot.

  2. #2
    Join Date
    Mar 2010
    You first need to understand how a DTD is set up and then from there create the shell of the XML. I'm only going to start this for you since this is for school and it's better that you understand how this works.

    Note the root node of the DTD is always the top node and the rest of the XML reads from the top to the bottom, but not necessarily all the time. Also note what is in parenthesis in the houses node. It's telling you about the child node house. So what does the * means? What does + mean? Note the child nodes after room and the order they appear. What does #PCDATA mean? How does effect the data that gets stored in the node? What does ATTLIST mean? One thing I have noticed in this DTD is that he is kinda tricking you here. Remember what I said above that DTD's can read from top to bottom but not all the time. Well the ATTLIST room information is actually out of place so to speak. It works where it is at but he purposely placed it out of context to fool you a little. This is to make sure you understand that a ATTLIST can be defined out of order. Also what does IDREF and #IMPLIED means when it comes the attribute colour?

    The last ATTLIST is interesting but not hard. When you read that line replace the pipe symbol with the word "or" and that should help you.

    Good luck!

Similar Threads

  1. Try XML Junction
    By Tim in forum xml.announcements
    Replies: 0
    Last Post: 10-11-2001, 04:00 PM
  2. XML Startkabel Updates
    By xmlstartkabel in forum XML
    Replies: 0
    Last Post: 10-10-2001, 04:07 AM
  3. Data Junction Announces XML Junction 7.51
    By Tim Frost in forum xml.announcements
    Replies: 0
    Last Post: 04-02-2001, 10:53 AM
  4. Check out Turbo XML: Free trial download
    By Extensibility in forum web.announcements
    Replies: 0
    Last Post: 07-20-2000, 06:20 PM
  5. Check out Turbo XML
    By Sales in forum xml.announcements
    Replies: 0
    Last Post: 07-20-2000, 06:18 PM

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center