
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture slide is very easy to understand and very helpful to built a concept about the foundation of computers and Database Design.The key points in these slides are:Xml Documents, Relational Data Model, Xpath, Xquery, Extensible Markup Language, Manipulate Data Elements, Standard Generalized Markup Language, Standard Generalized Markup Language, Types of Xml Databases, Internal Model
Typology: Slides
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















Define XML
XML model vs. relational model
XML Documents
Xpath
XQuery
Going from XML to the relational model
One of the main reasons that XML was developed was to allow the
exchange of semi-structured documents, like invoices, order forms,
applications, etc., over the internet.
Using a database system to store XML documents allows users to be
able to better access information.
XML is also very flexible
Data is maintained in a self-describing format to accommodate a
variety of ever-evolving business needs.
There are two major types of XML databases:
XML-enabled. These map all XML to a traditional database (such as a
database), accepting XML as input and rendering XML as output.
Native XML (NXD) The internal model of such databases depends on
XML and uses XML documents as the fundamental unit of storage.
Simply a database that stored XML Documents
Order of rows is not guaranteed unless the ORDER clause is
used in one or more columns
Relations (tables)
Data is represented in n-ary relations.
Has a domain that represents a set of values
Attributes (columns)
Strict schema
Restrictive
The strict schema insures data integrity
The XML Model is hierarchical format Data is represented in trees structures There's nodes Relationships between the node
The schema provides flexibility
Easily modified format
XML documents must be well formated, meaning that every opening tag
needs a closing tag (ex.
It allows users to define their own tags (unlike HTML)
The XML tags need to be properly nested.
The XML and xml tags are reserved for XML tags only.
You can use <-- XXX --> symbols for comments
XML is case sensitive so,
Two types of XML documents commonly used, Document Type Definition
(DTD) or an XML Schema Definitions (XSD)
DTDs can be declared inline of the XML code or can reference an
external file
It provides the composition of the database's logical model and
defines the syntax rules or valid tags for each type of XML document.
A DTD is a file that has a .dtd extension.
This file describes XML elements.
Example of a DTD on next slide.......
The XML Schema is an advance definition language that is used to describe the structure (elements, data types, relationships types, ranges, and default values)
It is an alternative to DTD
Since data types are allowed data validation is possible and easier to
do.
A XSD file has a .xsd extension
Example of a XSD on next slide.......
<xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element>
</xs:schema>
Xpath is a language used to extract parts of an XML document.
XPath uses path expressions to navigate in XML documents
Xpath has 7 kinds of nodes:
Element Attribute Text Namespace Processing-Instruction Comment Document(root)
Document node
Element node
Attribute node
Example of an XPath expressions:
/bookstore Will select the root element bookstore /bookstore/book Selects all book elements that are children of bookstore
Example of an XQuery expressions:
doc("books.xml")/bookstore/book/title
Will return:
for: Iterates through a sequence, bind variable to items let: binds a variable to a sequence where:eliminates items of the iteration order by: reorders items of the iteration return: constructs query results
Example of a XQuery expression:
for $x in doc("books.xml")/bookstore/book where $x/price> return $x/title
Will return: