Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Examples CSC 436 – Fall 2005 Slides to be used in conjunction with class notes.

Similar presentations


Presentation on theme: "XML Examples CSC 436 – Fall 2005 Slides to be used in conjunction with class notes."— Presentation transcript:

1 XML Examples CSC 436 – Fall 2005 Slides to be used in conjunction with class notes

2 Example Toy Store Fischer-Price 2 Main Street 401-555-3344 Farm House 0001 14.00 Truck 0002 12.00 … …

3 Example: An Address Book MacNiel, John Dr. John MacNiel 1234 Huron Street Rome, OH 98765 (321) 786 2543 jm@abc.com Exactly one name At most one greeting As many address lines as needed (in order) Mixed telephones and faxes As many as needed

4 A DTD for the address book <!DOCTYPE addressbook [ <!ELEMENT person (name, greet?, address*, (fax | tel)*, email*)> ]>

5 Example Project Database projects: title budget managedBy employees: name ssn age

6 Two DTDs for the Project DB <!DOCTYPE db [... ]> <!DOCTYPE db [... ]>

7 Specifying ID and IDREF attributes <!DOCTYPE family [ <!ATTLIST person id ID #REQUIRED mother IDREF #IMPLIED father IDREF #IMPLIED children IDREFS #IMPLIED> ]>

8 Some conforming data Jane Doe John Doe Mary Doe Jack Doe

9 An alternative specification <!DOCTYPE family [ ]>

10 The revised data Jane Doe John Doe...

11 Bank DTD <!DOCTYPE bank [ ]>

12 Bank DTD with Attributes Bank DTD with ID and IDREF attribute types. <!DOCTYPE bank-2[ <!ATTLIST account account-number ID # REQUIRED owners IDREFS # REQUIRED> <!ELEMENT customer(customer-name, customer-street, customer- city)> <!ATTLIST customer customer-id ID # REQUIRED accounts IDREFS # REQUIRED> … declarations for branch, balance, customer-name, customer-street and customer-city ]>

13 XML data with ID and IDREF attributes Downtown 500 Joe Monroe Madison Mary Erin Newark

14 XML Schema Version of Bank DTD http://www.w3.org/2001/XMLSchema ….. definitions of customer and depositor ….

15 TOY_NUM NAME MSRP TOY MAN_TIME MAKES MANUF MAN_ID NAME LOCATION ORDERS DATE_ORD CUST_NUM DATE_DELIV CUSTOMER NUM_CHILD NAME LNAME FNAME PARENT AGE_GRP CHILD NAME BDATE SOLD_YTD IN_STOCK 1 N N M 1 N ADDRESS PHONE CONTACT EMAIL NAME QUANTITY Toy ER Diagram

16 Hierarchy with Toy as Root TOY_NUM NAME MSRP TOY MAN_TIME MANUF MAN_ID NAME LOCATION DATE_ORD CUST_NUM DATE_DELIV CUSTOMER NUM_CHILD NAME LNAME FNAME AGE_GRP CHILD NAME BDATE SOLD_YTD IN_STOCK ADDRESS PHONE CONTACT EMAIL NAME QUANTITY 1 N 1 1 1 N

17 Toy XML Schema http://www.w3.org/2001/XMLSchema … …


Download ppt "XML Examples CSC 436 – Fall 2005 Slides to be used in conjunction with class notes."

Similar presentations


Ads by Google