Python
  Home arrow Python arrow Parsing XML with SAX and Python
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PYTHON

Parsing XML with SAX and Python
By: Nadia Poulou
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 14
    2003-01-21


    Table of Contents:
  • Parsing XML with SAX and Python
  • The xml.sax Package
  • Our SAX Parser
  • Homework
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Parsing XML with SAX and Python
    ( Page 1 of 5 )

    In this article Nadia explains how to parse an XML document using the SAX API implementation available for Python.This tutorial will explain how to parse an XML document using the SAX API implementation available for Python. Of course, there is more than one way to parse XML data with Python. In this article we will focus at its built-in SAX module.

    You don’t have to be an expert in Python or XML in order to follow this article. On the contrary, this is an introduction rather than an in-depth analysis. Of course I assume that you have some basic knowledge of programming and –preferably- the Python syntax and structures. It will also be nice if you are aware of the basic XML principles and terms.

    In the next part of this article, I will describe the SAX classes of Python. Afterwards, I will use an example in order to show how the theory can be applied. In the last parts I will provide some homework and some links that will help you to delve deeper in the subjects introduced in this article.

    In any case, if you want to test the code in this tutorial, you will need Python 2.1 or later installed. I don’t provide any installation details; if you need them, I would recommend that you check other sources, like the article Getting Started With Python.

    Our example is web-based therefore it would be nice if Python were integrated in your web server, but –of course- you may modify the script to run as standalone application or in any other way you desire.

    After the end of the article you will be in a position to successfully use Python in order to parse XML documents with the SAX interfaces, but let’s first make sure we cover the theory...

     
     
    >>> More Python Articles          >>> More By Nadia Poulou
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek