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?
Asked
Active
Viewed 357 times
-3
-
6Use a library. If you don't know anything about parsing in general, then definitely use a library. – Some programmer dude Mar 22 '17 at 09:41
-
Do not underestimate the complexity of writing a parser for even quite a simple language. Use a library, it's much easier. – JeremyP Mar 22 '17 at 10:08
-
My task just got more complicated. My data is in the form of a XML based binary encoding scheme. So from this I should either directly parse the transmitted binary representation or restore the XML representation. Can someone give some details on the basics of data parsing? – Rohith Mohan Mar 22 '17 at 10:48
2 Answers
2
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?

Community
- 1
- 1

Gaurav Pathak
- 1,065
- 11
- 28