SlideShare a Scribd company logo
1 of 25
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 (20)

Xslt
XsltXslt
Xslt
 
Xml
XmlXml
Xml
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLT
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
DITA, Semantics, Content Management, Dynamic Documents, and Linked Data – A M...
DITA, Semantics, Content Management, Dynamic Documents, and Linked Data – A M...DITA, Semantics, Content Management, Dynamic Documents, and Linked Data – A M...
DITA, Semantics, Content Management, Dynamic Documents, and Linked Data – A M...
 
XSLT
XSLTXSLT
XSLT
 
Xml 215-presentation
Xml 215-presentationXml 215-presentation
Xml 215-presentation
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examples
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Introduction to pig & pig latin
Introduction to pig & pig latinIntroduction to pig & pig latin
Introduction to pig & pig latin
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
XML DTD and Schema
XML DTD and SchemaXML DTD and Schema
XML DTD and Schema
 
Introduction to the Semantic Web
Introduction to the Semantic WebIntroduction to the Semantic Web
Introduction to the Semantic Web
 
Python programming : Inheritance and polymorphism
Python programming : Inheritance and polymorphismPython programming : Inheritance and polymorphism
Python programming : Inheritance and polymorphism
 
XML Databases
XML DatabasesXML Databases
XML Databases
 
XML - Data Modeling
XML - Data ModelingXML - Data Modeling
XML - Data Modeling
 
Json
JsonJson
Json
 
XML Schema
XML SchemaXML Schema
XML Schema
 

Similar to Introduction to XML

advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptxIreneGetzi
 
IT6801-Service Oriented Architecture
IT6801-Service Oriented ArchitectureIT6801-Service Oriented Architecture
IT6801-Service Oriented ArchitectureMadhu Amarnath
 
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).pptcareerPointBasti
 
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 managementsathiyabcsbs
 
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
 
Dev Sql Beyond Relational
Dev Sql Beyond RelationalDev Sql Beyond Relational
Dev Sql Beyond Relationalrsnarayanan
 
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, XML Databases and MPEG-7
XML, XML Databases and MPEG-7XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7Deniz Kılınç
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1Sudharsan S
 
Introduction to Oracle Database
Introduction to Oracle DatabaseIntroduction to Oracle Database
Introduction to Oracle Databasepuja_dhar
 

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
 
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
XmlXml
Xml
 
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 (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

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 

Recently uploaded (20)

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 

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