Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "1/7 ITApplications XML Module Session 8: Introduction to Programming with XML."— Presentation transcript:

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

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

3 3/7 Event-driven programming with Simple API for XML (SAX) SAX was developed by the W3C and released in SAX-based parsers invoke methods when markup (e.g. a start tag, an end tag, etc.) is encountered. No tree structure is created - data is passed to the application from the XML document as it is found. SAX parsers are typically used for reading XML documents that will not be modified. SAX was developed by the W3C and released in SAX-based parsers invoke methods when markup (e.g. a start tag, an end tag, etc.) is encountered. No tree structure is created - data is passed to the application from the XML document as it is found. SAX parsers are typically used for reading XML documents that will not be modified. SAX-based parsers are available for a variety of programming languages; C++, Java, and Perl being the most popular. SAX is based on an event-driven model using call-backs to handle processing. SAX-based parsers are available for a variety of programming languages; C++, Java, and Perl being the most popular. SAX is based on an event-driven model using call-backs to handle processing.

4 4/7 What an event-driven program can do: What an event-driven program can do: Search a document for an element containing a keyword Search a document for an element containing a keyword Print out formatted content Print out formatted content Modify an XML document by making small changes, such as fixing spelling and renaming elements Modify an XML document by making small changes, 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

5 5/7 Event-driven programming with Document Object Model (DOM) The W3C provides a standard recommendation for building a tree structure in memory for XML documents called the XML Document Object Model (DOM). A DOM-based parser exposes (i.e. makes available) a library, called the DOM Application Programming Interface (API), that allows data in an XML document to be accessed and modified by manipulating the nodes in a DOM tree. The W3C provides a standard recommendation for building a tree structure in memory for XML documents called the XML Document Object Model (DOM). A DOM-based parser exposes (i.e. makes available) a library, called the DOM Application Programming Interface (API), that allows data in an XML document to be accessed and modified by manipulating the nodes in a DOM tree.

6 6/7 Event-driven programming with Asynchronous JavaScript and XML (Ajax) Ajax is a web development technique that makes use of a combination of: Ajax is a web development technique that makes use of a combination of: HTML/XHTML and stylesheets (CSS) for data presentation. HTML/XHTML and stylesheets (CSS) for data presentation. The DOM is programmed using Javascript for dynamically displaying data. The DOM is programmed using Javascript for dynamically displaying data. An XMLHttpRequest object is used to exchange XML data asynchronously between a browser and a web server. An XMLHttpRequest object is used to exchange XML data asynchronously between a browser and a web server.

7 7/7 Concluding Remarks and Coursework Assignment Let’s read the FMA assignment and clarify any questions you may have. Let’s read the FMA assignment and clarify any questions you may have. Any Final Questions ??? Any Final Questions ???


Download ppt "1/7 ITApplications XML Module Session 8: Introduction to Programming with XML."

Similar presentations


Ads by Google