itapplications xml module

7
1/7 ITApplications ITApplications XML Module XML Module Session 8: Session 8: Introduction to Programming Introduction to Programming with XML with XML

Upload: varana

Post on 05-Jan-2016

28 views

Category:

Documents


4 download

DESCRIPTION

ITApplications XML Module. Session 8: Introduction to Programming with XML. Introduction – Programming with XML. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: ITApplications  XML Module

1/7

ITApplications ITApplications XML ModuleXML Module

Session 8:Session 8:Introduction to Programming with XMLIntroduction to Programming with XML

Page 2: ITApplications  XML Module

2/7

Introduction – Programming with XMLIntroduction – Programming with XML

XML documents, when parsed, are XML documents, when parsed, are represented as a hierarchical tree represented as a hierarchical tree structure.structure.This structure can be accessed by a This structure can be accessed by a programming tool via an API. programming tool via an API. SAX and DOM are two dramatically SAX and DOM are two dramatically different APIs for accessing information in different APIs for accessing information in XML documents. XML documents.

Page 3: ITApplications  XML Module

3/7

Event-driven programming with Simple API for XML Event-driven programming with Simple API for XML (SAX)(SAX)

SAX was developed by the W3C and released in 1998. SAX was developed by the W3C and released in 1998. SAX-based parsers invoke methods when markup (e.g. SAX-based parsers invoke methods when markup (e.g. a start tag, an end tag, etc.) is encountered. No tree a start tag, an end tag, etc.) is encountered. No tree structure is created - data is passed to the application structure is created - data is passed to the application from the XML document as it is found. SAX parsers are from the XML document as it is found. SAX parsers are typically used for reading XML documents that will not be typically used for reading XML documents that will not be modified. modified.

SAX-based parsers are available for a variety of SAX-based parsers are available for a variety of programming languages; C++, Java, and Perl being the programming languages; C++, Java, and Perl being the most popular. SAX is based on an event-driven model most popular. SAX is based on an event-driven model using call-backs to handle processing. using call-backs to handle processing.

Page 4: ITApplications  XML Module

4/7

What an event-driven program can do:What an event-driven program can do: Search a document for an element containing a Search a document for an element containing a

keyword keyword Print out formatted content Print out formatted content Modify an XML document by making small changes, Modify an XML document by making small changes,

such as fixing spelling and renaming elements such as fixing spelling and renaming elements Read data to build a complex data structure Read data to build a complex data structure

What an event-driven program can't do: What an event-driven program can't do: Re-order the elements in a document Re-order the elements in a document Resolve cross-references between elements Resolve cross-references between elements Verify ID-IDREF links Verify ID-IDREF links Validate an XML document Validate an XML document

Page 5: ITApplications  XML Module

5/7

Event-driven programming with Document Object Event-driven programming with Document Object

Model (DOM)Model (DOM) The W3C provides a standard recommendation The W3C provides a standard recommendation

for building a tree structure in memory for XML for building a tree structure in memory for XML documents called the XML documents called the XML Document Object Document Object ModelModel (DOM). A DOM-based parser (DOM). A DOM-based parser exposesexposes (i.e. makes available) a library, called the DOM (i.e. makes available) a library, called the DOM Application Programming InterfaceApplication Programming Interface (API), that (API), that allows data in an XML document to be accessed allows data in an XML document to be accessed and modified by manipulating the nodes in a and modified by manipulating the nodes in a DOM tree. DOM tree.

Page 6: ITApplications  XML Module

6/7

Event-driven programming with Asynchronous Event-driven programming with Asynchronous JavaScript and XML (Ajax)JavaScript and XML (Ajax)

Ajax is a web development technique that Ajax is a web development technique that makes use of a combination of:makes use of a combination of: HTML/XHTML and stylesheets (CSS) for data HTML/XHTML and stylesheets (CSS) for data

presentation.presentation. The DOM is programmed using Javascript for The DOM is programmed using Javascript for

dynamically displaying data.dynamically displaying data. An XMLHttpRequest object is used to An XMLHttpRequest object is used to

exchange XML data asynchronously between exchange XML data asynchronously between a browser and a web server.a browser and a web server.

Page 7: ITApplications  XML Module

7/7

Concluding Remarks and Coursework AssignmentConcluding Remarks and Coursework Assignment

Let’s read the FMA assignment and clarify Let’s read the FMA assignment and clarify any questions you may have.any questions you may have.

Any Final QuestionsAny Final Questions

??????