XML and DatabasesTopicSemi-Structured DataMore on XMLAdvantagesAdvantages (cont’d)Slide 7DisadvantagesWhat Makes Up an XML Document?Document Type Definition (DTD)XML APIsSlide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Lessons LearnedConclusionLoad for OracleSlide 39XML and DatabasesXML and DatabasesCS 8630 Database Systems Final CS 8630 Database Systems Final ProjectProjectBy Roger S. Huff7/19/2004TopicTopicXML. Read Chapter 29. Implement XML. Read Chapter 29. Implement an application that queries an XML an application that queries an XML database and an SQL database. database and an SQL database. Compare both of them. Compare both of them.Semi-Structured DataSemi-Structured DataFoundation for Extensive Markup Foundation for Extensive Markup Language (XML)Language (XML)Schema definition included with the data.Schema definition included with the data.Useful for:Useful for:–When WEB sources are treated like a database When WEB sources are treated like a database and it is not possible to constrain the sources and it is not possible to constrain the sources with a schema.with a schema.–Flexible format for data exchange between Flexible format for data exchange between databases.databases.–XML is becoming a popular standard.XML is becoming a popular standard.More on XMLMore on XMLSGMLSGML–XML is Derived form Standard Generalized Markup Language XML is Derived form Standard Generalized Markup Language (SGML)(SGML)Standard for over a decade Standard for over a decade Defining structured document typesDefining structured document typesAllows separation of document (two types)Allows separation of document (two types)–Structure of the documentStructure of the document–Document textDocument textDocument Type Definition (DTD)Document Type Definition (DTD)–Powerful document management systemPowerful document management system–Not widely adopted because of complexityNot widely adopted because of complexityXMLXML–Restricted version of SGMLRestricted version of SGML–Similar functions, but simplerSimilar functions, but simpler–Extensibility, structure, and validationExtensibility, structure, and validation–Will not replace SGML or HTML, but compliment them (Web Will not replace SGML or HTML, but compliment them (Web data exchange)data exchange)–Replacing Electronic Data Interchange (EDI)Replacing Electronic Data Interchange (EDI)AdvantagesAdvantagesSimplicitySimplicity–Simple standard < 50 pagesSimple standard < 50 pages–Text-based languageText-based language–Human legibleHuman legible–Reasonably clear Reasonably clear Open Standard and Platform/Vendor-Open Standard and Platform/Vendor-Independent (…almost)Independent (…almost)–Mostly Platform/Vendor Independent (Oracle?)Mostly Platform/Vendor Independent (Oracle?)–Restricted form of SGML, an ISO standardRestricted form of SGML, an ISO standard–Based on Unicode character sets so supports the Based on Unicode character sets so supports the worlds alphabets (ISO 10646)worlds alphabets (ISO 10646)ExtensibilityExtensibility–Allows users to define their own tagsAllows users to define their own tagsAdvantages (cont’d)Advantages (cont’d)Reuse Reuse –Tags built once can be reused by many applicationsTags built once can be reused by many applicationsSeparation of content and presentationSeparation of content and presentation–Document contentDocument content–Presentation of dataPresentation of data–Referred as “Write once, publish anywhere”Referred as “Write once, publish anywhere”Load balancingLoad balancing–Improved by data delivered to desktop for local Improved by data delivered to desktop for local computation allowing server resources to be computation allowing server resources to be allocated to other requests.allocated to other requests.Advantages (cont’d)Advantages (cont’d)Multiple Source Integration SupportMultiple Source Integration Support–Data combined easilyData combined easilyApplicable Data DescriptionApplicable Data Description–Self describingSelf describing–User-Defined Tags.User-Defined Tags.More Advanced Search EnginesMore Advanced Search Engines–Search engines will parse description-tags Search engines will parse description-tags for information instead of using meta-tagsfor information instead of using meta-tagsNew OpportunitiesNew OpportunitiesSecuritySecurityLarge files become cumbersome Large files become cumbersome because of the tags.because of the tags.DisadvantagesDisadvantagesWhat Makes Up an XML What Makes Up an XML Document?Document?<?xml version=”1.0” encoding=UTF-8” standalone=”yes”?><?xml version=”1.0” encoding=UTF-8” standalone=”yes”?><?xml:stylesheet type = “text/sxl” href = “staff_list.xsl:?><?xml:stylesheet type = “text/sxl” href = “staff_list.xsl:?><!DOCTYPE STAFFLIST SYSTEM “staff_list.dtd”><!DOCTYPE STAFFLIST SYSTEM “staff_list.dtd”><STAFFLIST><STAFFLIST><STAFF branchNo = “B005”><STAFF branchNo = “B005”><STAFFNO>SL21</STAFFNO><STAFFNO>SL21</STAFFNO><NAME><NAME><FNAMW>John</FNAME><LNAMW>White</LNAME><FNAMW>John</FNAME><LNAMW>White</LNAME></NAME></NAME><POSITION>Manager</POSITION><POSITION>Manager</POSITION><DOB>1-Oct-45</DOB><DOB>1-Oct-45</DOB><SALARY>30000</SALARY><SALARY>30000</SALARY></STAFF></STAFF><STAFF> branchNo = “B003”><STAFF> branchNo = “B003”><STAFFNO>SG37</STAFFNO><STAFFNO>SG37</STAFFNO><NAME><NAME><FNAME>Ann</FNAME><LNAME>Beech</LNAME><FNAME>Ann</FNAME><LNAME>Beech</LNAME></NAME></NAME><POSITION>Assistant</POSITION><POSITION>Assistant</POSITION><SALARY>12000</SALARY><SALARY>12000</SALARY></STAFF></STAFF></STAFFLIST></STAFFLIST>Declaration SectionROOT TAGAttributeContentEnd TagStart TagDocument Type Definition Document Type Definition (DTD)(DTD)Defines the valid syntax of an XML DocumentDefines the valid syntax of an XML Document–Element type declarationsElement type declarations–Attribute-list declarationsAttribute-list declarations–Entity declarationsEntity declarations–Notation declarationsNotation declarations–Processing InstructionsProcessing Instructions–CommentsComments–Parameter entity referencesParameter entity referencesDTD Example<!ELEMENT STAFFLIST (STAFF)*><!ELEMENT STAFF (NAME, POSITION, DOB?,SALARY)><!ELEMENT NAME (FNAME,
View Full Document