SlideShare una empresa de Scribd logo
1 de 39
 
XML: Extensible Mark-up Language T.Srinath  Vidya Sagar Seema
XML :  XML is a standard technology protocol proposed by W3C.Current version of XML is 1.0. XML stands for Extensible Mark Up Language .XML is a platform independent, language independent firewall friendly database.. The XML is text representation of data between mark ups. XML document’s extension is .xml.
XML document are of two types. 1.Well formed XML documents. 2.Validated XML documents.
1.Well-formed XML Document: Any XML document is called a well-formed XML documents if it satisfies the following rules *It should contain only one root element. *Tag sensitive. *case sensitive.
2.Validated XML Documents : If the XML documents is satisfying all the rules specified in the referred DTD , then it is called as validated XML documents.
DTD :(Document Type Definition) This specification is used to validate and to define the rules for the XML documents.
Rules of DTD : *What elements an XML document can contain. *Number of occurrences of an element. *Sequence of elements. *The attributes of an element. *Custom entities which can be used in XML document.
DTDs can be of 2 types : Internal DTDs-If the XML document contains the DTD inside in it, then it is called as internal DTD. External DTDs-If the XML document doesn't contains the DTD inside it but the DTD is referred from other DTD file the extension for DTD file is .dtd.
XML Processors or  Parsers
What is parsing? Parsing is the process of reading an XML document and reporting its content to a client application while checking the document for well-formedness. The specific class that implements this interface varies from parser to parser.
Purpose of parsers : *The processor must check the basic syntax of the document for well-formedness. *the processor must replace all references to entities in an XML document by their definitions.
*DTDs and XML schemas can specify that certain values in an XML document during processing. *When a DTD or an XML schema is specified and the processor includes a validating parser,the structure of the XML document must be checked to ensure that its structure is legitimate.
*Parsers allow interpretation of XML documents. *Parsers allow processing of XML data in the XML documents. *To build XML parsers, we can use either DOM specification or SAX specification.
*DOM specification is given by W3C, SAX is given by SUN Micro Systems. *All the parsers that are built according to the DOM specification are called as DOM parsers, and the parsers that are built according to the SAX specification are called as SAX parsers.
DOM Parser (Document Object Model) : The XML DOM defines a standard way for accessing and manipulating XML document the DOM presents an XML document as a tree structure. The DOM is a W3C standard ie “World Wide Web Consortium”.
DOM Parser:
Structure of the DOM tree : *The DOM tree is composed of Node objects. *Node is an interface -some of the more important sub  interfaces are Element,Attr,and Text. -An element node may have children. -Attribute and Text nodes are leaves. -Additional types are Document,  comment,Entity,CDATA,Processing.
*The XML DOM uses an XML doc as tree structure the tree structure is called a node tree. All nodes can be accessed through the tree. The contents can be modified or deleted and new elements can be created. *The node tree shows the set of nodes and the connection between them. The tree starts at root node.
*The tree starts at root node and branches out to the text nodes at the lowest level of tree. In a node tree the top node is called the root -Every node except the root has exactly one parent node. -A node can have any number of children. -A leaf is node with no children. -Siblings are nodes with a same parent.
XML DOM:Node Tree
SAX   parser Simple API for XML SAX :-
Usage:- ,[object Object],[object Object],[object Object],Performance:- ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Events generated by SAX:- ,[object Object],[object Object],[object Object],[object Object],Example to demonstrate parsing of xml document throw SAX parser: <?xml version=“1.0”?> <root element param1=24> <first element>hello</first element> <second element>world</second element> </root element>
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
5.Xml element end tag </first element> 6. Xml element start tag called <second element> 7.Xml text is ‘world’. 8.Xml element end tag</second element> 9.Xml element end tag </root element>
Advantages :- ,[object Object],[object Object],[object Object],[object Object]
Disadvantages ,[object Object],[object Object]
No structure manipulation :  Because only a portion of the XML  document is in memory at any one time, it  is difficult to add or edit nodes using SAX.  If this functionality is required, then DOM  should be considered.
Only works with fully formed XML documents :  SAX can only work with a fully formed XML  document. It cannot be used to process partial  XML documents.   ,[object Object],[object Object]
[object Object]
When Should we use SAX ,[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object]
Difference between SAX and DOM   SAX DOM 1.Import javax.xml.parser.*; import org.xml.sax.*; import org.xml.sax.helper.*; 1.Import javax.xml.parser.*; import org.w3c.dom.*; 2.Parses node by node. 2.Storesthe entire xml document into memory before processing. 3.Does not store the xml in  memory. 3.Occupies more memory. 4.We can’t insert or delete a node. 4. 4.We can insert or delete a node. 5.Top to bottom traversing. 5.Traverse in any direction.
6.SAX is an event based parser. 6.DOM is a tree model parser. 7.SAX doesn’t preserve comments. 7.DOM preserves comments. 8.SAX parser serves the client applications always only with pieces of the document. 8.DOM parser always serves the client application with the entire document.
SAX Parser:
Thank You

Más contenido relacionado

La actualidad más candente (20)

Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scala
 
Sax parser
Sax parserSax parser
Sax parser
 
DOM and SAX
DOM and SAXDOM and SAX
DOM and SAX
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
Xml dom
Xml domXml dom
Xml dom
 
Day Of Dot Net Ann Arbor 2007
Day Of Dot Net Ann Arbor 2007Day Of Dot Net Ann Arbor 2007
Day Of Dot Net Ann Arbor 2007
 
Understanding XML DOM
Understanding XML DOMUnderstanding XML DOM
Understanding XML DOM
 
Building XML Based Applications
Building XML Based ApplicationsBuilding XML Based Applications
Building XML Based Applications
 
Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
5 xml parsing
5   xml parsing5   xml parsing
5 xml parsing
 
Querring xml with xpath
Querring xml with xpath Querring xml with xpath
Querring xml with xpath
 
XML
XMLXML
XML
 
Chapter 18
Chapter 18Chapter 18
Chapter 18
 
Session x(ado.net)
Session x(ado.net)Session x(ado.net)
Session x(ado.net)
 
XML Document Object Model (DOM)
XML Document Object Model (DOM)XML Document Object Model (DOM)
XML Document Object Model (DOM)
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
 
XSLT
XSLTXSLT
XSLT
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Intro to XML in libraries
Intro to XML in librariesIntro to XML in libraries
Intro to XML in libraries
 
Linq to xml
Linq to xmlLinq to xml
Linq to xml
 

Similar a XML (20)

Xml and xml processor
Xml and xml processorXml and xml processor
Xml and xml processor
 
Xml and xml processor
Xml and xml processorXml and xml processor
Xml and xml processor
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
 
Xml3
Xml3Xml3
Xml3
 
Xml
XmlXml
Xml
 
Applied xml programming for microsoft
Applied xml programming for microsoftApplied xml programming for microsoft
Applied xml programming for microsoft
 
XMl
XMlXMl
XMl
 
Xml3
Xml3Xml3
Xml3
 
Oracle soa xml faq
Oracle soa xml faqOracle soa xml faq
Oracle soa xml faq
 
XML Presentation-2
XML Presentation-2XML Presentation-2
XML Presentation-2
 
Xml
XmlXml
Xml
 
XML
XMLXML
XML
 
Xml viva questions
Xml viva questionsXml viva questions
Xml viva questions
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
Xml
XmlXml
Xml
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)eXtensible Markup Language (By Dr.Hatem Mohamed)
eXtensible Markup Language (By Dr.Hatem Mohamed)
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 

Último

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
“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
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
_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
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 

Último (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
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
 
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🔝
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
“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...
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
_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
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 

XML

  • 1.  
  • 2. XML: Extensible Mark-up Language T.Srinath Vidya Sagar Seema
  • 3. XML : XML is a standard technology protocol proposed by W3C.Current version of XML is 1.0. XML stands for Extensible Mark Up Language .XML is a platform independent, language independent firewall friendly database.. The XML is text representation of data between mark ups. XML document’s extension is .xml.
  • 4. XML document are of two types. 1.Well formed XML documents. 2.Validated XML documents.
  • 5. 1.Well-formed XML Document: Any XML document is called a well-formed XML documents if it satisfies the following rules *It should contain only one root element. *Tag sensitive. *case sensitive.
  • 6. 2.Validated XML Documents : If the XML documents is satisfying all the rules specified in the referred DTD , then it is called as validated XML documents.
  • 7. DTD :(Document Type Definition) This specification is used to validate and to define the rules for the XML documents.
  • 8. Rules of DTD : *What elements an XML document can contain. *Number of occurrences of an element. *Sequence of elements. *The attributes of an element. *Custom entities which can be used in XML document.
  • 9. DTDs can be of 2 types : Internal DTDs-If the XML document contains the DTD inside in it, then it is called as internal DTD. External DTDs-If the XML document doesn't contains the DTD inside it but the DTD is referred from other DTD file the extension for DTD file is .dtd.
  • 10. XML Processors or Parsers
  • 11. What is parsing? Parsing is the process of reading an XML document and reporting its content to a client application while checking the document for well-formedness. The specific class that implements this interface varies from parser to parser.
  • 12. Purpose of parsers : *The processor must check the basic syntax of the document for well-formedness. *the processor must replace all references to entities in an XML document by their definitions.
  • 13. *DTDs and XML schemas can specify that certain values in an XML document during processing. *When a DTD or an XML schema is specified and the processor includes a validating parser,the structure of the XML document must be checked to ensure that its structure is legitimate.
  • 14. *Parsers allow interpretation of XML documents. *Parsers allow processing of XML data in the XML documents. *To build XML parsers, we can use either DOM specification or SAX specification.
  • 15. *DOM specification is given by W3C, SAX is given by SUN Micro Systems. *All the parsers that are built according to the DOM specification are called as DOM parsers, and the parsers that are built according to the SAX specification are called as SAX parsers.
  • 16. DOM Parser (Document Object Model) : The XML DOM defines a standard way for accessing and manipulating XML document the DOM presents an XML document as a tree structure. The DOM is a W3C standard ie “World Wide Web Consortium”.
  • 18. Structure of the DOM tree : *The DOM tree is composed of Node objects. *Node is an interface -some of the more important sub interfaces are Element,Attr,and Text. -An element node may have children. -Attribute and Text nodes are leaves. -Additional types are Document, comment,Entity,CDATA,Processing.
  • 19. *The XML DOM uses an XML doc as tree structure the tree structure is called a node tree. All nodes can be accessed through the tree. The contents can be modified or deleted and new elements can be created. *The node tree shows the set of nodes and the connection between them. The tree starts at root node.
  • 20. *The tree starts at root node and branches out to the text nodes at the lowest level of tree. In a node tree the top node is called the root -Every node except the root has exactly one parent node. -A node can have any number of children. -A leaf is node with no children. -Siblings are nodes with a same parent.
  • 22. SAX parser Simple API for XML SAX :-
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. 5.Xml element end tag </first element> 6. Xml element start tag called <second element> 7.Xml text is ‘world’. 8.Xml element end tag</second element> 9.Xml element end tag </root element>
  • 28.
  • 29.
  • 30. No structure manipulation : Because only a portion of the XML document is in memory at any one time, it is difficult to add or edit nodes using SAX. If this functionality is required, then DOM should be considered.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. Difference between SAX and DOM SAX DOM 1.Import javax.xml.parser.*; import org.xml.sax.*; import org.xml.sax.helper.*; 1.Import javax.xml.parser.*; import org.w3c.dom.*; 2.Parses node by node. 2.Storesthe entire xml document into memory before processing. 3.Does not store the xml in memory. 3.Occupies more memory. 4.We can’t insert or delete a node. 4. 4.We can insert or delete a node. 5.Top to bottom traversing. 5.Traverse in any direction.
  • 37. 6.SAX is an event based parser. 6.DOM is a tree model parser. 7.SAX doesn’t preserve comments. 7.DOM preserves comments. 8.SAX parser serves the client applications always only with pieces of the document. 8.DOM parser always serves the client application with the entire document.