How to implement a parser in C for xml based structured language?

365 Views Asked by At

I need to implement a simple parser in C (or C++ if C is discouraged for this application) that will read a xml file which will only contain a few elements (that's why called it xml based) i.e., only 4 root elements and and less than 5 child elements totally. Is it easy to implement or should I use a library like expat? And if it is possible can someone tell me how I can about the process?

2

There are 2 best solutions below

0
Gaurav Pathak On

Use libxml or libexpat. There are millions, trillions of examples you can find on net, or even at StackOverflow. Have a look at this: How can libxml2 be used to parse data from XML?

2
sailfish009 On

or use google protobuf, although it is not xml-based, but it fast.