SlideShare a Scribd company logo
Department of Information Technology 1Data base Technologies (ITB4201)
Introduction to XML
Dr. C.V. Suresh Babu
Professor
Department of IT
Hindustan Institute of Science & Technology
Department of Information Technology 2Data base Technologies (ITB4201)
Action Plan
 What is XML?
 Syntax of XML Document
 DTD (Document Type Definition)
 XML Query Language
 XML Databases
 XML Schema
 Oracle JDBC
 Quiz
Department of Information Technology 3Data base Technologies (ITB4201)
Introduction to XML
 XML stands for EXtensible Markup Language
 XML was designed to describe data.
 XML tags are not predefined unlike HTML
 XML DTD and XML Schema define rules to describe data
 XML example of semi structured data
Department of Information Technology 4Data base Technologies (ITB4201)
The Difference Between XML and HTML
XML and HTML were designed with different goals:
• XML was designed to carry data - with focus on what data is
• HTML was designed to display data - with focus on how data
looks
• XML tags are not predefined like HTML tags are
4
Department of Information Technology 5Data base Technologies (ITB4201)
XML Does Not Use Predefined Tags
• The XML language has no predefined tags.
• The tags in the example above (like <to> and <from>) are not
defined in any XML standard. These tags are "invented" by the
author of the XML document.
• HTML works with predefined tags like <p>, <h1>, <table>, etc.
• With XML, the author must define both the tags and the
document structure.
5
Department of Information Technology 6Data base Technologies (ITB4201)
Building Blocks of XML
• Elements (Tags) are the primary components of XML
documents.
<AUTHOR id = 123>
<FNAME> JAMES</FNAME>
<LNAME> RUSSEL</LNAME>
</AUTHOR>
<!- I am comment ->
Element FNAME nested inside
element Author.
 Attributes provide additional information about Elements.
Values of the Attributes are set inside the Elements
Element Author
with Attr id
 Comments stats with <!- and end with ->
Department of Information Technology 7Data base Technologies (ITB4201)
XML DTD (Document Type Definition)
 A DTD is a set of rules that allow us to specify our own set of
elements and attributes.
 DTD is grammar to indicate what tags are legal in XML
documents.
 XML Document is valid if it has an attached DTD and
document is structured according to rules defined in DTD.
Department of Information Technology 8Data base Technologies (ITB4201)
DTD Example
<BOOKLIST>
<BOOK GENRE = “Science”
FORMAT = “Hardcover”>
<AUTHOR>
<FIRSTNAME> RICHRD
</FIRSTNAME>
<LASTNAME> KARTER
</LASTNAME>
</AUTHOR>
</BOOK>
</BOOKS>
<!DOCTYPE BOOKLIST[
<!ELEMENT BOOKLIST(BOOK)*>
<!ELEMENT BOOK(AUTHOR)>
<!ELEMENT
AUTHOR(FIRSTNAME,LASTNAM
E)>
<!ELEMENT
FIRSTNAME(#PCDATA)>
<!ELEMENT>LASTNAME(#PCDATA)
>
<!ATTLIST BOOK GENRE
(Science|Fiction)#REQUIRED>
<!ATTLIST BOOK FORMAT
(Paperback|Hardcover)
“PaperBack”>]>
Xml Document And
Corresponding DTD
Department of Information Technology 9Data base Technologies (ITB4201)
XML Schema
 Serves same purpose as database schema
 Schemas are written in XML
 Set of pre-defined simple types (such as string, integer)
 Allows creation of user-defined complex types
Department of Information Technology 10Data base Technologies (ITB4201)
XML Schema
• RDBMS Schema (s_id integer, s_name string, s_status string)
<Students>
<Student id=“p1”>
<Name>Allan</Name>
<Age>62</Age>
<Email>allan@abc.com
</Email>
</Student>
</Students>
 XMLSchema
<xs:schema>
<xs:complexType name = “StudnetType”>
<xs:attribute name=“id” type=“xs:string” />
<xs:element name=“Name” type=“xs:string />
<xs:element name=“Age” type=“xs:integer” />
<xs:element name=“Email” type=“xs:string” />
</xs:complexType>
<xs:element name=“Student”
type=“StudentType” />
</xs:schema>XML Document and Schema
Department of Information Technology 11Data base Technologies (ITB4201)
XML Query Languages
• Requirement
Same functionality as database query languages (such as SQL)
to process Web data
• Advantages
• Query selective portions of the document (no need to
transport entire document)
• Smaller data size mean lesser communication cost
Department of Information Technology 12Data base Technologies (ITB4201)
XQuery
• XQuery to XML is same as SQL to RDBMS
• Most databases supports XQuery
• XQuery is built on XPath operators
(XPath is a language that defines path expressions to locate
document data)
Department of Information Technology 13Data base Technologies (ITB4201)
XPath Example
<Student id=“s1”>
<Name>John</Name>
<Age>22</Age>
<Email>jhn@xyz.com</Email>
</Student>
XPath: /Student[Name=“John”]/Email
Extracts: <Email> element with value “jhn@xyz.com”
Department of Information Technology 14Data base Technologies (ITB4201)
Oracle and XML
• XML Support in Oracle
XDK (XML Developer Kit)
XML Parser for PL/SQL
XPath
XSLT
Department of Information Technology 15Data base Technologies (ITB4201)
Oracle and XML
• XML documents are stored as XML Type ( data type for
XML ) in Oracle
 Internally CLOB is used to store XML
 To store XML in database create table with one
XMLType column
 Each row will contain one of XML records from XML
document
 Database Table: XML Document
 Database Row : XML Record
Department of Information Technology 16Data base Technologies (ITB4201)
Examples
<Patients>
<Patient id=“p1”>
<Name>John</Name>
<Address>
<Street>120 Northwestern Ave</Street>
</Address>
</Patient>
<Patient id=“p2”>
<Name>Paul</Name>
<Address>
<Street>120 N. Salisbury</Street>
</Address>
</Patient>
</Patients>
Department of Information Technology 17Data base Technologies (ITB4201)
Example
• Create table prTable(patientRecord XMLType);
• DECLARE
• prXML CLOB;
• BEGIN
• -- Store Patient Record XML in the CLOB variable
• prXML := '<Patient id=“p1">
• <Name>John</Name>
• <Address>
• <Street>120 Northwestern Ave</Street>
• </Address>
• </Patient>‘ ;
• -- Now Insert this Patient Record XML into an XMLType column
• INSERT INTO prTable (patientRecord) VALUES (XMLTYPE(prXML));
• END;
Department of Information Technology 18Data base Technologies (ITB4201)
Example
TO PRINT PATIENT ID of ALL PATIENTS
SELECT
EXTRACT(p.patientRecord,
'/Patient/@id').getStringVal()
FROM prTable p;
USE XPATH
Department of Information Technology 19Data base Technologies (ITB4201)
Oracle JDBC
 JDBC an API used for database connectivity
 Creates Portable Applications
 Basic Steps to develop JDBC Application
 Import JDBC classes (java.sql.*).
 Load JDBC drivers
 Connect and Interact with database
 Disconnect from database
Department of Information Technology 20Data base Technologies (ITB4201)
Oracle JDBC
• DriverManager provides basic services to manage set of JDBC
drivers
 Connection object sends queries to database server after a
connection is set up
 JDBC provides following three classes for sending SQL statements
to server
 Statement SQL statements without parameters
 PreparedStatement SQL statements to be executed multiple times with different
parameters
 CallableStatement Used for stored procedures
Department of Information Technology 21Data base Technologies (ITB4201)
Oracle JDBC
• SQL query can be executed using any of the objects.
(Statement,PreparedStatement,CallableStatement)
 Syntax (Statement Object )
Public abstract ResultSet executeQuery(String sql) throws SQLException
 Syntax (PreparedStatement,CallableStatement Object )
Public abstract ResultSet executeQuery() throws SQLException
 Method executes SQL statement that returns ResultSet object
(ResultSet maintains cursor pointing to its current row of data. )
Department of Information Technology 22Data base Technologies (ITB4201)
XML Simplifies Things
• It simplifies data sharing
• It simplifies data transport
• It simplifies platform changes
• It simplifies data availability
Department of Information Technology 23Data base Technologies (ITB4201)
Summary
• Many computer systems contain data in incompatible formats. Exchanging data
between incompatible systems (or upgraded systems) is a time-consuming task
for web developers. Large amounts of data must be converted, and incompatible
data is often lost.
• XML stores data in plain text format. This provides a software- and hardware-
independent way of storing, transporting, and sharing data.
• XML also makes it easier to expand or upgrade to new operating systems, new
applications, or new browsers, without losing data.
• With XML, data can be available to all kinds of "reading machines" like people,
computers, voice machines, news feeds, etc.
Department of Information Technology 24Data base Technologies (ITB4201)
Test Yourself
1. What does XML stand for?
A. eXtra Modern Link B. eXtensible Markup Language
C. Example Markup Language D. X-Markup Language
2. Which statement is true?
A. All the statements are true B. All XML elements must have a closing tag
C. All XML elements must be lower case D. All XML documents must have a DTD
3. What does DTD stand for?
A. Direct Type Definition B. Document Type Definition
C. Do The Dance D. Dynamic Type Definition
4. Disadvantages of DTD are
(i)DTDs are not extensible
(ii)DTDs are not in to support for namespaces
(iii)there is no provision for inheritance from one DTDs to another
A. (i) is correct
B. (i),(ii) are correct
C. (ii),(iii) are correct
D. (i),(ii),(iii) are correct
5. A schema describes
(i) grammer
(ii) vocabulary
(iii) structure
(iv) datatype of XML document
A. (i) & (ii) are correct
B. (i),(iii) ,(iv) are correct
C. (i),(ii),(iv) are correct
D. (i),(ii),(iii),(iv) are correct
Department of Information Technology 25Data base Technologies (ITB4201)
Answers
1. What does XML stand for?
A. eXtra Modern Link B. eXtensible Markup Language
C. Example Markup Language D. X-Markup Language
2. Which statement is true?
A. All the statements are true B. All XML elements must have a closing tag
C. All XML elements must be lower case D. All XML documents must have a DTD
3. What does DTD stand for?
A. Direct Type Definition B. Document Type Definition
C. Do The Dance D. Dynamic Type Definition
4. Disadvantages of DTD are
(i)DTDs are not extensible
(ii)DTDs are not in to support for namespaces
(iii)there is no provision for inheritance from one DTDs to another
A. (i) is correct
B. (i),(ii) are correct
C. (ii),(iii) are correct
D. (i),(ii),(iii) are correct
5. A schema describes
(i) grammer
(ii) vocabulary
(iii) structure
(iv) datatype of XML document
A. (i) & (ii) are correct
B. (i),(iii) ,(iv) are correct
C. (i),(ii),(iv) are correct
D. (i),(ii),(iii),(iv) are correct

More Related Content

What's hot

XML
XMLXML
Xml
XmlXml
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
yht4ever
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
Gtu Booker
 
XML
XMLXML
XSLT
XSLTXSLT
Xml
Xml Xml
Xml presentation
Xml presentationXml presentation
Xml presentation
Miguel Angel Teheran Garcia
 
Xpath presentation
Xpath presentationXpath presentation
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
Pradeep Rapolu
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
Dr.Saranya K.G
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLT
Malintha Adikari
 
XML Schema
XML SchemaXML Schema
XML Schema
yht4ever
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
Shivalik college of engineering
 
XML
XMLXML
XML Introduction
XML IntroductionXML Introduction
XML Introduction
Bikash chhetri
 
HTML AND XML ppt.pptx
HTML AND XML ppt.pptxHTML AND XML ppt.pptx
HTML AND XML ppt.pptx
SRIRAM763018
 
XSLT.ppt
XSLT.pptXSLT.ppt
XSLT.ppt
KGSCSEPSGCT
 
XML Schemas
XML SchemasXML Schemas
XML Schemas
People Strategists
 
Xml namespace
Xml namespaceXml namespace
Xml namespace
GayathriS578276
 

What's hot (20)

XML
XMLXML
XML
 
Xml
XmlXml
Xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
XML
XMLXML
XML
 
XSLT
XSLTXSLT
XSLT
 
Xml
Xml Xml
Xml
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLT
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
XML
XMLXML
XML
 
XML Introduction
XML IntroductionXML Introduction
XML Introduction
 
HTML AND XML ppt.pptx
HTML AND XML ppt.pptxHTML AND XML ppt.pptx
HTML AND XML ppt.pptx
 
XSLT.ppt
XSLT.pptXSLT.ppt
XSLT.ppt
 
XML Schemas
XML SchemasXML Schemas
XML Schemas
 
Xml namespace
Xml namespaceXml namespace
Xml namespace
 

Similar to Introduction to XML

advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
IreneGetzi
 
IT6801-Service Oriented Architecture
IT6801-Service Oriented ArchitectureIT6801-Service Oriented Architecture
IT6801-Service Oriented Architecture
Madhu Amarnath
 
XML-Unit 1.ppt
XML-Unit 1.pptXML-Unit 1.ppt
XML-Unit 1.ppt
ssuseree7dcd
 
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).pptDATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
careerPointBasti
 
unit_5_XML data integration database management
unit_5_XML data integration database managementunit_5_XML data integration database management
unit_5_XML data integration database management
sathiyabcsbs
 
Xml sasidhar
Xml  sasidharXml  sasidhar
Xml sasidhar
Sasidhar Kothuru
 
Xml
XmlXml
Xml schema
Xml schemaXml schema
Xml schema
Akshaya Akshaya
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Marco Gralike
 
Xml session
Xml sessionXml session
Xml session
Farag Zakaria
 
Dev Sql Beyond Relational
Dev Sql Beyond RelationalDev Sql Beyond Relational
Dev Sql Beyond Relational
rsnarayanan
 
Xml
XmlXml
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
IJERD Editor
 
XML External Entity (XXE)
XML External Entity (XXE)XML External Entity (XXE)
XML External Entity (XXE)
Jay Thakker
 
XML Prep
XML PrepXML Prep
XML Prep
Nitin Marwal
 
XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7
Deniz Kılınç
 
Xml11
Xml11Xml11
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
Sudharsan S
 
Introduction to Oracle Database
Introduction to Oracle DatabaseIntroduction to Oracle Database
Introduction to Oracle Database
puja_dhar
 
Full xml
Full xmlFull xml

Similar to Introduction to XML (20)

advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
 
IT6801-Service Oriented Architecture
IT6801-Service Oriented ArchitectureIT6801-Service Oriented Architecture
IT6801-Service Oriented Architecture
 
XML-Unit 1.ppt
XML-Unit 1.pptXML-Unit 1.ppt
XML-Unit 1.ppt
 
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).pptDATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
 
unit_5_XML data integration database management
unit_5_XML data integration database managementunit_5_XML data integration database management
unit_5_XML data integration database management
 
Xml sasidhar
Xml  sasidharXml  sasidhar
Xml sasidhar
 
Xml
XmlXml
Xml
 
Xml schema
Xml schemaXml schema
Xml schema
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
Xml session
Xml sessionXml session
Xml session
 
Dev Sql Beyond Relational
Dev Sql Beyond RelationalDev Sql Beyond Relational
Dev Sql Beyond Relational
 
Xml
XmlXml
Xml
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
 
XML External Entity (XXE)
XML External Entity (XXE)XML External Entity (XXE)
XML External Entity (XXE)
 
XML Prep
XML PrepXML Prep
XML Prep
 
XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7
 
Xml11
Xml11Xml11
Xml11
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
 
Introduction to Oracle Database
Introduction to Oracle DatabaseIntroduction to Oracle Database
Introduction to Oracle Database
 
Full xml
Full xmlFull xml
Full xml
 

More from Dr. C.V. Suresh Babu

Data analytics with R
Data analytics with RData analytics with R
Data analytics with R
Dr. C.V. Suresh Babu
 
Association rules
Association rulesAssociation rules
Association rules
Dr. C.V. Suresh Babu
 
Clustering
ClusteringClustering
Classification
ClassificationClassification
Classification
Dr. C.V. Suresh Babu
 
Blue property assumptions.
Blue property assumptions.Blue property assumptions.
Blue property assumptions.
Dr. C.V. Suresh Babu
 
Introduction to regression
Introduction to regressionIntroduction to regression
Introduction to regression
Dr. C.V. Suresh Babu
 
DART
DARTDART
Mycin
MycinMycin
Expert systems
Expert systemsExpert systems
Expert systems
Dr. C.V. Suresh Babu
 
Dempster shafer theory
Dempster shafer theoryDempster shafer theory
Dempster shafer theory
Dr. C.V. Suresh Babu
 
Bayes network
Bayes networkBayes network
Bayes network
Dr. C.V. Suresh Babu
 
Bayes' theorem
Bayes' theoremBayes' theorem
Bayes' theorem
Dr. C.V. Suresh Babu
 
Knowledge based agents
Knowledge based agentsKnowledge based agents
Knowledge based agents
Dr. C.V. Suresh Babu
 
Rule based system
Rule based systemRule based system
Rule based system
Dr. C.V. Suresh Babu
 
Formal Logic in AI
Formal Logic in AIFormal Logic in AI
Formal Logic in AI
Dr. C.V. Suresh Babu
 
Production based system
Production based systemProduction based system
Production based system
Dr. C.V. Suresh Babu
 
Game playing in AI
Game playing in AIGame playing in AI
Game playing in AI
Dr. C.V. Suresh Babu
 
Diagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AIDiagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AI
Dr. C.V. Suresh Babu
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
Dr. C.V. Suresh Babu
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
Dr. C.V. Suresh Babu
 

More from Dr. C.V. Suresh Babu (20)

Data analytics with R
Data analytics with RData analytics with R
Data analytics with R
 
Association rules
Association rulesAssociation rules
Association rules
 
Clustering
ClusteringClustering
Clustering
 
Classification
ClassificationClassification
Classification
 
Blue property assumptions.
Blue property assumptions.Blue property assumptions.
Blue property assumptions.
 
Introduction to regression
Introduction to regressionIntroduction to regression
Introduction to regression
 
DART
DARTDART
DART
 
Mycin
MycinMycin
Mycin
 
Expert systems
Expert systemsExpert systems
Expert systems
 
Dempster shafer theory
Dempster shafer theoryDempster shafer theory
Dempster shafer theory
 
Bayes network
Bayes networkBayes network
Bayes network
 
Bayes' theorem
Bayes' theoremBayes' theorem
Bayes' theorem
 
Knowledge based agents
Knowledge based agentsKnowledge based agents
Knowledge based agents
 
Rule based system
Rule based systemRule based system
Rule based system
 
Formal Logic in AI
Formal Logic in AIFormal Logic in AI
Formal Logic in AI
 
Production based system
Production based systemProduction based system
Production based system
 
Game playing in AI
Game playing in AIGame playing in AI
Game playing in AI
 
Diagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AIDiagnosis test of diabetics and hypertension by AI
Diagnosis test of diabetics and hypertension by AI
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
 
A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”A study on “impact of artificial intelligence in covid19 diagnosis”
A study on “impact of artificial intelligence in covid19 diagnosis”
 

Recently uploaded

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 

Recently uploaded (20)

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 

Introduction to XML

  • 1. Department of Information Technology 1Data base Technologies (ITB4201) Introduction to XML Dr. C.V. Suresh Babu Professor Department of IT Hindustan Institute of Science & Technology
  • 2. Department of Information Technology 2Data base Technologies (ITB4201) Action Plan  What is XML?  Syntax of XML Document  DTD (Document Type Definition)  XML Query Language  XML Databases  XML Schema  Oracle JDBC  Quiz
  • 3. Department of Information Technology 3Data base Technologies (ITB4201) Introduction to XML  XML stands for EXtensible Markup Language  XML was designed to describe data.  XML tags are not predefined unlike HTML  XML DTD and XML Schema define rules to describe data  XML example of semi structured data
  • 4. Department of Information Technology 4Data base Technologies (ITB4201) The Difference Between XML and HTML XML and HTML were designed with different goals: • XML was designed to carry data - with focus on what data is • HTML was designed to display data - with focus on how data looks • XML tags are not predefined like HTML tags are 4
  • 5. Department of Information Technology 5Data base Technologies (ITB4201) XML Does Not Use Predefined Tags • The XML language has no predefined tags. • The tags in the example above (like <to> and <from>) are not defined in any XML standard. These tags are "invented" by the author of the XML document. • HTML works with predefined tags like <p>, <h1>, <table>, etc. • With XML, the author must define both the tags and the document structure. 5
  • 6. Department of Information Technology 6Data base Technologies (ITB4201) Building Blocks of XML • Elements (Tags) are the primary components of XML documents. <AUTHOR id = 123> <FNAME> JAMES</FNAME> <LNAME> RUSSEL</LNAME> </AUTHOR> <!- I am comment -> Element FNAME nested inside element Author.  Attributes provide additional information about Elements. Values of the Attributes are set inside the Elements Element Author with Attr id  Comments stats with <!- and end with ->
  • 7. Department of Information Technology 7Data base Technologies (ITB4201) XML DTD (Document Type Definition)  A DTD is a set of rules that allow us to specify our own set of elements and attributes.  DTD is grammar to indicate what tags are legal in XML documents.  XML Document is valid if it has an attached DTD and document is structured according to rules defined in DTD.
  • 8. Department of Information Technology 8Data base Technologies (ITB4201) DTD Example <BOOKLIST> <BOOK GENRE = “Science” FORMAT = “Hardcover”> <AUTHOR> <FIRSTNAME> RICHRD </FIRSTNAME> <LASTNAME> KARTER </LASTNAME> </AUTHOR> </BOOK> </BOOKS> <!DOCTYPE BOOKLIST[ <!ELEMENT BOOKLIST(BOOK)*> <!ELEMENT BOOK(AUTHOR)> <!ELEMENT AUTHOR(FIRSTNAME,LASTNAM E)> <!ELEMENT FIRSTNAME(#PCDATA)> <!ELEMENT>LASTNAME(#PCDATA) > <!ATTLIST BOOK GENRE (Science|Fiction)#REQUIRED> <!ATTLIST BOOK FORMAT (Paperback|Hardcover) “PaperBack”>]> Xml Document And Corresponding DTD
  • 9. Department of Information Technology 9Data base Technologies (ITB4201) XML Schema  Serves same purpose as database schema  Schemas are written in XML  Set of pre-defined simple types (such as string, integer)  Allows creation of user-defined complex types
  • 10. Department of Information Technology 10Data base Technologies (ITB4201) XML Schema • RDBMS Schema (s_id integer, s_name string, s_status string) <Students> <Student id=“p1”> <Name>Allan</Name> <Age>62</Age> <Email>allan@abc.com </Email> </Student> </Students>  XMLSchema <xs:schema> <xs:complexType name = “StudnetType”> <xs:attribute name=“id” type=“xs:string” /> <xs:element name=“Name” type=“xs:string /> <xs:element name=“Age” type=“xs:integer” /> <xs:element name=“Email” type=“xs:string” /> </xs:complexType> <xs:element name=“Student” type=“StudentType” /> </xs:schema>XML Document and Schema
  • 11. Department of Information Technology 11Data base Technologies (ITB4201) XML Query Languages • Requirement Same functionality as database query languages (such as SQL) to process Web data • Advantages • Query selective portions of the document (no need to transport entire document) • Smaller data size mean lesser communication cost
  • 12. Department of Information Technology 12Data base Technologies (ITB4201) XQuery • XQuery to XML is same as SQL to RDBMS • Most databases supports XQuery • XQuery is built on XPath operators (XPath is a language that defines path expressions to locate document data)
  • 13. Department of Information Technology 13Data base Technologies (ITB4201) XPath Example <Student id=“s1”> <Name>John</Name> <Age>22</Age> <Email>jhn@xyz.com</Email> </Student> XPath: /Student[Name=“John”]/Email Extracts: <Email> element with value “jhn@xyz.com”
  • 14. Department of Information Technology 14Data base Technologies (ITB4201) Oracle and XML • XML Support in Oracle XDK (XML Developer Kit) XML Parser for PL/SQL XPath XSLT
  • 15. Department of Information Technology 15Data base Technologies (ITB4201) Oracle and XML • XML documents are stored as XML Type ( data type for XML ) in Oracle  Internally CLOB is used to store XML  To store XML in database create table with one XMLType column  Each row will contain one of XML records from XML document  Database Table: XML Document  Database Row : XML Record
  • 16. Department of Information Technology 16Data base Technologies (ITB4201) Examples <Patients> <Patient id=“p1”> <Name>John</Name> <Address> <Street>120 Northwestern Ave</Street> </Address> </Patient> <Patient id=“p2”> <Name>Paul</Name> <Address> <Street>120 N. Salisbury</Street> </Address> </Patient> </Patients>
  • 17. Department of Information Technology 17Data base Technologies (ITB4201) Example • Create table prTable(patientRecord XMLType); • DECLARE • prXML CLOB; • BEGIN • -- Store Patient Record XML in the CLOB variable • prXML := '<Patient id=“p1"> • <Name>John</Name> • <Address> • <Street>120 Northwestern Ave</Street> • </Address> • </Patient>‘ ; • -- Now Insert this Patient Record XML into an XMLType column • INSERT INTO prTable (patientRecord) VALUES (XMLTYPE(prXML)); • END;
  • 18. Department of Information Technology 18Data base Technologies (ITB4201) Example TO PRINT PATIENT ID of ALL PATIENTS SELECT EXTRACT(p.patientRecord, '/Patient/@id').getStringVal() FROM prTable p; USE XPATH
  • 19. Department of Information Technology 19Data base Technologies (ITB4201) Oracle JDBC  JDBC an API used for database connectivity  Creates Portable Applications  Basic Steps to develop JDBC Application  Import JDBC classes (java.sql.*).  Load JDBC drivers  Connect and Interact with database  Disconnect from database
  • 20. Department of Information Technology 20Data base Technologies (ITB4201) Oracle JDBC • DriverManager provides basic services to manage set of JDBC drivers  Connection object sends queries to database server after a connection is set up  JDBC provides following three classes for sending SQL statements to server  Statement SQL statements without parameters  PreparedStatement SQL statements to be executed multiple times with different parameters  CallableStatement Used for stored procedures
  • 21. Department of Information Technology 21Data base Technologies (ITB4201) Oracle JDBC • SQL query can be executed using any of the objects. (Statement,PreparedStatement,CallableStatement)  Syntax (Statement Object ) Public abstract ResultSet executeQuery(String sql) throws SQLException  Syntax (PreparedStatement,CallableStatement Object ) Public abstract ResultSet executeQuery() throws SQLException  Method executes SQL statement that returns ResultSet object (ResultSet maintains cursor pointing to its current row of data. )
  • 22. Department of Information Technology 22Data base Technologies (ITB4201) XML Simplifies Things • It simplifies data sharing • It simplifies data transport • It simplifies platform changes • It simplifies data availability
  • 23. Department of Information Technology 23Data base Technologies (ITB4201) Summary • Many computer systems contain data in incompatible formats. Exchanging data between incompatible systems (or upgraded systems) is a time-consuming task for web developers. Large amounts of data must be converted, and incompatible data is often lost. • XML stores data in plain text format. This provides a software- and hardware- independent way of storing, transporting, and sharing data. • XML also makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing data. • With XML, data can be available to all kinds of "reading machines" like people, computers, voice machines, news feeds, etc.
  • 24. Department of Information Technology 24Data base Technologies (ITB4201) Test Yourself 1. What does XML stand for? A. eXtra Modern Link B. eXtensible Markup Language C. Example Markup Language D. X-Markup Language 2. Which statement is true? A. All the statements are true B. All XML elements must have a closing tag C. All XML elements must be lower case D. All XML documents must have a DTD 3. What does DTD stand for? A. Direct Type Definition B. Document Type Definition C. Do The Dance D. Dynamic Type Definition 4. Disadvantages of DTD are (i)DTDs are not extensible (ii)DTDs are not in to support for namespaces (iii)there is no provision for inheritance from one DTDs to another A. (i) is correct B. (i),(ii) are correct C. (ii),(iii) are correct D. (i),(ii),(iii) are correct 5. A schema describes (i) grammer (ii) vocabulary (iii) structure (iv) datatype of XML document A. (i) & (ii) are correct B. (i),(iii) ,(iv) are correct C. (i),(ii),(iv) are correct D. (i),(ii),(iii),(iv) are correct
  • 25. Department of Information Technology 25Data base Technologies (ITB4201) Answers 1. What does XML stand for? A. eXtra Modern Link B. eXtensible Markup Language C. Example Markup Language D. X-Markup Language 2. Which statement is true? A. All the statements are true B. All XML elements must have a closing tag C. All XML elements must be lower case D. All XML documents must have a DTD 3. What does DTD stand for? A. Direct Type Definition B. Document Type Definition C. Do The Dance D. Dynamic Type Definition 4. Disadvantages of DTD are (i)DTDs are not extensible (ii)DTDs are not in to support for namespaces (iii)there is no provision for inheritance from one DTDs to another A. (i) is correct B. (i),(ii) are correct C. (ii),(iii) are correct D. (i),(ii),(iii) are correct 5. A schema describes (i) grammer (ii) vocabulary (iii) structure (iv) datatype of XML document A. (i) & (ii) are correct B. (i),(iii) ,(iv) are correct C. (i),(ii),(iv) are correct D. (i),(ii),(iii),(iv) are correct