XML Structure of XML Data XML Document Schema Querying and Transformation Application Program Interfaces to XML Storage of XML Data XML Applications Database System Concepts-5th Edition,Aug 22,2005. 10.2 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 10.2 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. XML Structure of XML Data XML Document Schema Querying and Transformation Application Program Interfaces to XML Storage of XML Data XML Applications
Introduction XML:Extensible Markup Language Defined by the WW Consortium(W3C) Derived from SGML(Standard Generalized Markup Language),but simpler to use than SGML Documents have tags giving extra information about sections of the document E.g.XML Introduction... Extensible,unlike HTML Users can add new tags,and separately specify how the tag should be handled for display Database System Concepts-5th Edition,Aug 22,2005. 10.3 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.3 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Introduction XML: Extensible Markup Language Defined by the WWW Consortium (W3C) Derived from SGML (Standard Generalized Markup Language), but simpler to use than SGML Documents have tags giving extra information about sections of the document E.g. XML Introduction … Extensible, unlike HTML Users can add new tags, and separately specify how the tag should be handled for display
XML Introduction (Cont.) The ability to specify new tags,and to create nested tag structures make XML a great way to exchange data,not just documents. Much of the use of XML has been in data exchange applications,not as a replacement for HTML Tags make data(relatively)self-documenting E.g. A-101 Downtown 500 A-101 Johnson Database System Concepts-5th Edition,Aug 22,2005. 10.4 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.4 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. XML Introduction (Cont.) The ability to specify new tags, and to create nested tag structures make XML a great way to exchange data, not just documents. Much of the use of XML has been in data exchange applications, not as a replacement for HTML Tags make data (relatively) self-documenting E.g. A-101 Downtown 500 A-101 Johnson
XML:Motivation Data interchange is critical in today's networked world Examples: Banking:funds transfer Order processing (especially inter-company orders) Scientific data -Chemistry:ChemML,... -Genetics:BSML (Bio-Sequence Markup Language),... Paper flow of information between organizations is being replaced by electronic flow of information Each application area has its own set of standards for representing information XML has become the basis for all new generation data interchange formats Database System Concepts-5th Edition,Aug 22,2005. 10.5 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.5 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. XML: Motivation Data interchange is critical in today’s networked world Examples: Banking: funds transfer Order processing (especially inter-company orders) Scientific data – Chemistry: ChemML, … – Genetics: BSML (Bio-Sequence Markup Language), … Paper flow of information between organizations is being replaced by electronic flow of information Each application area has its own set of standards for representing information XML has become the basis for all new generation data interchange formats
XML Motivation (Cont.) Earlier generation formats were based on plain text with line headers indicating the meaning of fields Similar in concept to email headers Does not allow for nested structures,no standard"type"language Tied too closely to low level document structure(lines,spaces,etc) Each XML based standard defines what are valid elements,using XML type specification languages to specify the syntax DTD(Document Type Descriptors) XML Schema Plus textual descriptions of the semantics XML allows new tags to be defined as required However,this may be constrained by DTDs A wide variety of tools is available for parsing,browsing and querying XML documents/data Database System Concepts-5th Edition,Aug 22,2005. 10.6 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.6 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. XML Motivation (Cont.) Earlier generation formats were based on plain text with line headers indicating the meaning of fields Similar in concept to email headers Does not allow for nested structures, no standard “type” language Tied too closely to low level document structure (lines, spaces, etc) Each XML based standard defines what are valid elements, using XML type specification languages to specify the syntax DTD (Document Type Descriptors) XML Schema Plus textual descriptions of the semantics XML allows new tags to be defined as required However, this may be constrained by DTDs A wide variety of tools is available for parsing, browsing and querying XML documents/data
Comparison with Relational Data Inefficient:tags,which in effect represent schema information,are repeated Better than relational tuples as a data-exchange format Unlike relational tuples,XML data is self-documenting due to presence of tags Non-rigid format:tags can be added Allows nested structures Wide acceptance,not only in database systems,but also in browsers,tools,and applications Database System Concepts-5th Edition,Aug 22,2005. 10.7 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.7 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Comparison with Relational Data Inefficient: tags, which in effect represent schema information, are repeated Better than relational tuples as a data-exchange format Unlike relational tuples, XML data is self-documenting due to presence of tags Non-rigid format: tags can be added Allows nested structures Wide acceptance, not only in database systems, but also in browsers, tools, and applications
Structure of XML Data Tag:label for a section of data Element:section of data beginning with and ending with matching Elements must be properly nested Proper nesting ....... Improper nesting ....... Formally:every start tag must have a unique matching end tag, that is in the context of the same parent element. Every document must have a single top-level element Database System Concepts-5th Edition,Aug 22,2005. 10.8 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 10.8 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Structure of XML Data Tag: label for a section of data Element: section of data beginning with and ending with matching Elements must be properly nested Proper nesting … …. Improper nesting … …. Formally: every start tag must have a unique matching end tag, that is in the context of the same parent element. Every document must have a single top-level element
Example of Nested Elements Hayes Main Harrison A-102 Perryridge 400 Database System Concepts-5th Edition,Aug 22,2005. 10.9 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.9 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Example of Nested Elements Hayes Main Harrison A-102 Perryridge 400 … .
Motivation for Nesting Nesting of data is useful in data transfer Example:elements representing customer id,customer name,and address nested within an order element Nesting is not supported,or discouraged,in relational databases With multiple orders,customer name and address are stored redundantly normalization replaces nested structures in each order by foreign key into table storing customer name and address information Nesting is supported in object-relational databases But nesting is appropriate when transferring data External application does not have direct access to data referenced by a foreign key Database System Concepts-5th Edition,Aug 22,2005. 10.10 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.10 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Motivation for Nesting Nesting of data is useful in data transfer Example: elements representing customer_id, customer_name, and address nested within an order element Nesting is not supported, or discouraged, in relational databases With multiple orders, customer name and address are stored redundantly normalization replaces nested structures in each order by foreign key into table storing customer name and address information Nesting is supported in object-relational databases But nesting is appropriate when transferring data External application does not have direct access to data referenced by a foreign key
Structure of XML Data (Cont.) Mixture of text with sub-elements is legal in XML. Example: This account is seldom used any more. A-102 Perryridge 400 Useful for document markup,but discouraged for data representation Database System Concepts-5th Edition,Aug 22,2005. 10.11 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 10.11 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Structure of XML Data (Cont.) Mixture of text with sub-elements is legal in XML. Example: This account is seldom used any more. A-102 Perryridge 400 Useful for document markup, but discouraged for data representation