XML programming in Linux

Posted by Joys of Programming on in C/C++

For a detailed tutorial on XML programming, check the libxml tutorial.

To start XML programming in Ubuntu, you must have the following packages in your system

  • libxml2
  • libxml2-dev
  • libxml2-doc
  • libxml2-utils

To install these packages,


$ sudo apt-get install libxml2 libxml2-dev libxml2-doc libxml2-utils

Once you install these packages, you must check the path where the libxml2 header files are present


$ xml2-config --cflags
-I/usr/include/libxml2

You must make use of the above path while writing your codes. Also to compile your code, you must know the library corresponding to libxml.


$ xml2-config --libs
-lxml2

Now you know both these values, you can compile your program containing libXML headers and functions in the following manner


$ gcc file.c `xml2-config --cflags --libs`


Tags: , , , , , ,

Comments:

5 Comments

  • karthikd says:

    i troubled in running xml file using c in linux. i dont know how to compile. none helped.
    the above coding helped. very very thanks :)

  • Joys of Programming says:

    Thanks Karthik. Hope you find many other useful articles

  • KVB says:

    I dint know to compile xml..this post helped me..Thank you :)

  • Joys of Programming says:

    Thanks KVB, You can also follow us on our Facebook Fan Page

  • dotpan says:

    Short but helpful article. Very thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009-2012 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.