24 May 2011

Setting up Xerces XML parsing library in ubuntu

The Apache project's Xerces-C libraries support the DOM approach to XML parsing. The entire XML file is imported into memory and the data is held as nodes in a data tree which can be traversed for information.

The Xerces-C C++ parser home page: http://xml.apache.org/xerces-c/

1. Go to your working directory.
2. Download the compressed file from here
3. Unpack the downloaded file: tar -xzf xerces-c-3.0.1.tar.gz
4. Go to unpacked directory: cd xerces-c-3.0.1
5. ./configure --prefix=/opt
6. Build: make
7. Install: sudo make install     

This will install development files such as include header files and libraries in "/opt" so compiler flags and linker flags are required:
  • Compiler flags: -I/opt/include
  • Linker flags: -L/opt/lib -lxerces-c 
 Compiling a sample program named parser.cpp - 
g++ -g -Wall -pedantic -I/opt/include -L/opt/lib -lxerces-c parser.cpp -DMAIN_TEST -o parser 

Get the complete program from - 

Useful Links - 
1. http://xerces.apache.org/xerces-c/
2. http://xerces.apache.org/xerces-c/api-2.html
3. http://www.yolinux.com/TUTORIALS/XML-Xerces-C.html
4. http://en.wikipedia.org/wiki/Xerces
5. http://www.artima.com/cppsource/xml_data_binding.html

No comments:

Post a Comment