Home arrow Python arrow Parsing XML with SAX and Python

Parsing XML with SAX and Python

In this article Nadia explains how to parse an XML document using the SAX API implementation available for Python.

TABLE OF CONTENTS:
  1. Parsing XML with SAX and Python
  2. The xml.sax Package
  3. Our SAX Parser
  4. Homework
  5. Conclusion
By: Nadia Poulou
Rating: starstarstarstarstar / 16
January 21, 2003

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PYTHON ARTICLES

- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- 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

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: