I want to generate a xml file through my C application and add entries to it dynamically. I almost know what should my xml look like, i mean its schema. Please let me know how to accomplish this in C.
-
See how to create xml message in c?.Matthew Flaschen– Matthew Flaschen2011-09-05 04:17:03 +00:00Commented Sep 5, 2011 at 4:17
-
The cited post doesn't mention either expat (a "classic" choice) or Xerces (arguably one of the best libraries available)paulsm4– paulsm42011-09-05 04:19:14 +00:00Commented Sep 5, 2011 at 4:19
Add a comment
|
3 Answers
You can use an xml library like minixml.
It can read and write XML and XML-like data files in your application without requiring large non-standard libraries and Mini-XML only requires an ANSI C compatible compiler.
4 Comments
user911747
Thanks!! Is it platform specific? My application needs to be ported on windows, linux etc.
Alok Save
@user911747: It is available for Windows, Unix as well as Linux.
user911747
Thanks. One more query: minixml vs Expat/Xerces ? which is a better choice and when do we use what?
Alok Save
@user911747: There is no Best solution for all.It is a matter of choice, preference and requirements in some cases, You will have to read through the docummentation of these libraries(through links provided in answers here) & evaluate what best suits your purpose/requirement.
"fopen()/fprintf()" will work just fine :)
"Expat" and "Xerces" are two very popular open-source libraries for XML.
2 Comments
user911747
Thanks!! I would explore both of them. Does any of these libraries give me some APIs to even parse an xml?
Jeegar Patel
for just xml writing i would prefere this method but in case of reading xml file i use mxml...
3 Comments
user911747
Thanks!! minixml vs Expat/Xerces ? which is a better choice and when do we use what?
Arash
@user911747: I use them for some small project, so for me both of them are good.
user10607
I found minixml to be super easy to get started.