libxml-examples
libxml examples for C and Python, featuring some common actions.
Dependecies
This examples have been tested under Ubuntu Linux 12.04
with the following
configuration:
gcc 4.6.3
andlibxml2 2.7.8
Python 2.7.3
andlxml 2.3.4
How to run the examples
Python
Open a terminal, navigate to src/python
and run python exampleX-Y.py
C
Open a terminal, navigate to src/c
and run:
gcc -o exampleX-Y `xml2-config --cflags` exampleX-Y.c `xml2-config --libs`
./exampleX-Y
Examples
1. Reading an XML document
- Show the contents of a document.
2. Creating a new XML document
- Create a document including different nodes.
- Create a document with namespaces.
3. Finding elements in an XML document
- Find elements in a simple document.
- Find elements in a document with namespaces.
4. Modifying an existing XML document
- Create new node.
- Delete node.
- Replace a node.
- Modify the node's tag.
- Modify the node's text value.
- Modify the node's properties.