Introduction to XML: Nhóm thực hiện
Introduction to XML: Nhóm thực hiện
XML Path
1 History of XML
2 What is XML?
5 Benefits of XML?
History of XML
By the World Wide Web Consortium’s (W3C) XML
1.0 specification.
Come from the Standard Generalized Markup
Language (SGML)
Enables users to define their own markup
data is.
HTML: display data, with focus on how data looks.
A XML document
<?xml version="1.0" encoding="ISO-8859-1"?>
<transaction>
<account>123456</account>
<buy shares = "100">
<ticker>WEBM</ticker>
</buy>
<sell shares = "30">
<ticker>INTC</ticker>
</sell>
</transaction>
A XML document(cont)
Tags: every tag represent one piece of data, can contain other
tags, simple text or a mixture of both
<ticker>WEBM</ticker>
Contents: information is represent by tags
<ticker>WEBM</ticker>
Attributes: supply more information about tag, has a name
and value.
<buy shares = "100">
Comments: add a comment to the document.
<!--This is a comment-->
XML syntax
xmlns:cust="http://www.northwindtraders.com/customer"
xmlns:book="http://www.northwindtraders.com/book"
OrderNo="1234">
◦ <OrderDate>2001-01-01</OrderDate>
◦ <cust:Customer>
<cust:Title>Mr.</cust:Title> <cust:FirstName>Graeme</cust:FirstName>
<cust:LastName>Malcolm</cust:LastName>
◦ </cust:Customer>
◦ <book:Book>
<book:Title>Treasure Island</book:Title>
<book:Author>Robert Louis Stevenson</book:Author>
◦ </book:Book>
</BookOrder>
Entity Rerferences
Some characters have a special meaning in XML.
< < less than
> > greater than
& & ampersand
' ' apostrophe
" " quotation mark
What can I do with XML?
or not.
Example
<?xml version="1.0"?>
<Order OrderNo="1047">
◦ <OrderDate>2002-03-26</OrderDate> <Customer>John
Costello</Customer>
<Item>
<Product ProductID="1" UnitPrice="70">Chair</Product>
<Quantity>6</Quantity>
</Item>
<Item>
<Product ProductID="2" UnitPrice="250">Desk</Product>
<Quantity>1</Quantity>
</Item>
</Order>
XML likes a tree towads XPATH
Absolute Location PATH
Begin with Context node=Root node
4 Xquery command
Xquery Langague
XQuery 1.0 is the W3C language designed
for querying XML data.
It is similar to SQL in many ways
XQuery is designed especially for querying
Result(SQL*plus):
XMLQUERY('FOR$IIN(1TO10)RETURN$I'RETURNINGCONTENT)
---------------------------------------------------
1 2 3 4 5 6 7 8 9 10
Oracle XQuery Extension Functions
Oracle XML DB adds some XQuery
functions to those provided in the
W3C standard.
These additional functions are in