XML AND DATABASE DESIGN Jason Moon CS 8630, Summer 2004
XML Basics <ul><li>What is XML? </li></ul><ul><ul><li>eXtensible Markup Language </li></ul></ul><ul><ul><li>Created to ove...
XML Basics cont. <ul><li>Advantages of XML </li></ul><ul><ul><li>XML adopts a very strict syntax so browsers do not need t...
Other XML Technologies <ul><li>APIs </li></ul><ul><ul><li>DOM </li></ul></ul><ul><ul><li>SAX </li></ul></ul><ul><li>Style ...
Project Summary <ul><li>The purpose of the project was to create a simple database system for Pleasant Valley South Baptis...
E-R Diagram Person Belongs To Sunday School Class Work Group Works In N 1 N N E-R DIAGRAM
Relational Schema
XML Data Example <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> </li></ul><ul><li><?xml:stylesheet hre...
XSL Example  <ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&...
XSL Example cont <ul><li><xsl:for-each select=&quot;person&quot;> </li></ul><ul><li><xsl:sort select=&quot;lname&quot; ord...
Output Using XSL
Form Example
Example of SQL Query <ul><li>SQL> SELECT PID, LNAME, FNAME, C.CLASSNAME FROM PERSONS P, CLASSES C WHERE P.CLASSID = C.CLAS...
Search JavaScript Code <ul><li>function testResults(form) </li></ul><ul><li>{ </li></ul><ul><li>var TestVar = form.inputbo...
Code cont. <ul><li>// write rows </li></ul><ul><li>for(var i=0; i< lnames.length; i++) </li></ul><ul><li>{ </li></ul><ul><...
Problems Encountered <ul><li>Adding/Removing Nodes </li></ul><ul><ul><li>Two commands </li></ul></ul><ul><ul><ul><li>appen...
Conclusion <ul><li>Any Questions??? </li></ul>
Upcoming SlideShare
Loading in...5
×

MoonXML.ppt

611

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
611
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MoonXML.ppt

  1. 1. XML AND DATABASE DESIGN Jason Moon CS 8630, Summer 2004
  2. 2. XML Basics <ul><li>What is XML? </li></ul><ul><ul><li>eXtensible Markup Language </li></ul></ul><ul><ul><li>Created to overcome the limitations found in HTML </li></ul></ul><ul><ul><li>A cross-platform technology </li></ul></ul><ul><ul><li>Developed by the World Wide Web Consortium (W3C) </li></ul></ul>
  3. 3. XML Basics cont. <ul><li>Advantages of XML </li></ul><ul><ul><li>XML adopts a very strict syntax so browsers do not need to include any tolerance code </li></ul></ul><ul><ul><ul><li>This leads to faster and smaller browsers </li></ul></ul></ul><ul><ul><li>XML does not use predefined tags </li></ul></ul><ul><ul><ul><li>This allows you to create your own custom markup tags and define how they are used </li></ul></ul></ul>
  4. 4. Other XML Technologies <ul><li>APIs </li></ul><ul><ul><li>DOM </li></ul></ul><ul><ul><li>SAX </li></ul></ul><ul><li>Style Sheets </li></ul><ul><ul><li>XSL </li></ul></ul><ul><ul><li>XSLT </li></ul></ul><ul><li>Query Languages </li></ul><ul><ul><li>XQuery </li></ul></ul><ul><ul><li>XPath </li></ul></ul><ul><li>Linking Language </li></ul><ul><ul><li>XLink </li></ul></ul><ul><li>Schemas </li></ul><ul><ul><li>DTD </li></ul></ul><ul><ul><li>XMLSchema </li></ul></ul>
  5. 5. Project Summary <ul><li>The purpose of the project was to create a simple database system for Pleasant Valley South Baptist Church </li></ul><ul><ul><li>The church wanted a way to keep track of all members, Sunday School records, and jobs within the church </li></ul></ul><ul><li>I “started” this project my senior year in college. </li></ul><ul><li>The project is still a work in progress </li></ul><ul><ul><li>More knowledge is needed to finish the final product </li></ul></ul>
  6. 6. E-R Diagram Person Belongs To Sunday School Class Work Group Works In N 1 N N E-R DIAGRAM
  7. 7. Relational Schema
  8. 8. XML Data Example <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> </li></ul><ul><li><?xml:stylesheet href=&quot;persons5.xsl&quot; type=&quot;text/xsl&quot;?> </li></ul><ul><li><persons </li></ul><ul><li>xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;persons.xsd&quot;> </li></ul><ul><li><person> </li></ul><ul><li><pid>0001</pid> </li></ul><ul><li><lname>Moon</lname> </li></ul><ul><li><fname>Jason</fname> </li></ul><ul><li><mname>Daniel</mname> </li></ul><ul><li><phone>555-5555</phone> </li></ul><ul><li><email>aol.com</email> </li></ul><ul><li><address>224 South Road</address> </li></ul><ul><li><city>Rome</city> </li></ul><ul><li><state>Georgia</state> </li></ul><ul><li><zip>30165</zip> </li></ul><ul><li><classID>45</classID> </li></ul><ul><li></person> </li></ul>
  9. 9. XSL Example <ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;> </li></ul><ul><li><xsl:template match=&quot;/&quot;> </li></ul><ul><li><html> <head> <title>Members Output</title> </head> </li></ul><ul><li><body> <xsl:apply-templates /> </body> </html> </li></ul><ul><li></xsl:template> </li></ul><ul><li><xsl:template match=&quot;persons&quot;> </li></ul><ul><li><table width=&quot;100%&quot; boarder=&quot;2&quot;> </li></ul><ul><li><tr bgcolor=&quot;silver&quot;> </li></ul><ul><li><td>Pid</td> </li></ul><ul><li><td>Last Name</td> </li></ul><ul><li><td>First Name</td> </li></ul><ul><li><td>Middle Name</td> </li></ul><ul><li><td>Phone</td> </li></ul><ul><li><td>Email</td> </li></ul><ul><li><td>Address</td> </li></ul><ul><li><td>City</td> </li></ul><ul><li><td>State</td> </li></ul><ul><li><td>Zip</td> </li></ul><ul><li><td>ClassID</td> </li></ul><ul><li></tr> </li></ul>
  10. 10. XSL Example cont <ul><li><xsl:for-each select=&quot;person&quot;> </li></ul><ul><li><xsl:sort select=&quot;lname&quot; order=&quot;ascending&quot; data-type=&quot;text&quot;/> </li></ul><ul><li><tr> </li></ul><ul><li><td><xsl:value-of select=&quot;pid&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;lname&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;fname&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;mname&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;phone&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;email&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;address&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;city&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;state&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;zip&quot;/></td> </li></ul><ul><li><td><xsl:value-of select=&quot;classID&quot;/></td> </li></ul><ul><li></tr> </li></ul><ul><li></xsl:for-each> </li></ul><ul><li></table> </li></ul><ul><li></xsl:template> </li></ul><ul><li></xsl:stylesheet> </li></ul>
  11. 11. Output Using XSL
  12. 12. Form Example
  13. 13. Example of SQL Query <ul><li>SQL> SELECT PID, LNAME, FNAME, C.CLASSNAME FROM PERSONS P, CLASSES C WHERE P.CLASSID = C.CLASSID; </li></ul><ul><li>PID LNAME FNAME CLASSNAME </li></ul><ul><li>---------- ------------- -------------------- -------------------- </li></ul><ul><li>1 Moon Jason College </li></ul><ul><li>2 Smith John College </li></ul><ul><li>3 Morris Janet Singles </li></ul><ul><li>4 Franks John High School </li></ul><ul><li>5 Stevens Shannon Middle School </li></ul>
  14. 14. Search JavaScript Code <ul><li>function testResults(form) </li></ul><ul><li>{ </li></ul><ul><li>var TestVar = form.inputbox.value; </li></ul><ul><li>var str = &quot;Search Results&quot;; </li></ul><ul><li>var test; </li></ul><ul><li>var count = 0; </li></ul><ul><li>var message = &quot;No Results Found&quot;; </li></ul><ul><li>var list=&quot;<caption>&quot;+str+&quot; List</caption>&quot;; </li></ul><ul><li>// write make & model column headers </li></ul><ul><li>list+=&quot;<table width='390px' border='1px' cellspacing='0px'>&quot;; </li></ul><ul><li>list+=&quot;<tr><th>First Name</th><th>Last Name</th>&quot;; </li></ul>
  15. 15. Code cont. <ul><li>// write rows </li></ul><ul><li>for(var i=0; i< lnames.length; i++) </li></ul><ul><li>{ </li></ul><ul><li>test = getFname(i); </li></ul><ul><li>if(test == TestVar) </li></ul><ul><li>{ </li></ul><ul><li>// toggle row background colour </li></ul><ul><li>list+=(((i+1)%2)==0)? &quot;<tr style='background:silver'>&quot;:&quot;<tr style='background:white'>&quot;; </li></ul><ul><li>// write make & model cells </li></ul><ul><li>list+=&quot;<td>&quot;+getFname(i)+&quot;</td><td>&quot;+getLname(i)+&quot;</td>&quot;; </li></ul><ul><li>count = count + 1; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>list+=&quot;</table>&quot;; </li></ul><ul><li>// output the table </li></ul><ul><li>sho.innerHTML=list; </li></ul><ul><li>if(count == 0) </li></ul><ul><li>{ </li></ul><ul><li>sho.innerHTML=message; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  16. 16. Problems Encountered <ul><li>Adding/Removing Nodes </li></ul><ul><ul><li>Two commands </li></ul></ul><ul><ul><ul><li>appendChild </li></ul></ul></ul><ul><ul><ul><li>removeChild </li></ul></ul></ul><ul><li>Working with XML data online </li></ul><ul><ul><li>PHP </li></ul></ul><ul><ul><li>ASP </li></ul></ul><ul><li>More advanced querying </li></ul><ul><ul><li>XQuery </li></ul></ul>
  17. 17. Conclusion <ul><li>Any Questions??? </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×