To use xml in C
Any one who knows how t开发者_如何学运维o create and update XML file in C?
This should work:
void main()
{
puts(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<feed xmlns=\"http://www.w3.org/2005/Atom\">"
" <entry>"
" <title type=\"text\">To use xml in C</title>"
" <author>"
" <name>Punit</name>"
" <uri>http://stackoverflow.com/users/352194</uri>"
" </author>"
" <published>2010-05-27T23:36:02Z</published>"
" <updated>2010-05-27T23:37:20Z</updated>"
" <summary type=\"html\">"
" <p>Any one who knows how to create and update XML file in C?</p>"
""
" </summary>"
" </entry>"
"</feed>"
);
}
Use a library, such as libxml2.
There are numerous examples, depending on the particulars of what you are trying to accomplish.
in simplest way you can create xml file in c just printing < > around your element...if you want to use advance feature with handling xml file then you should use any library for reading & writing of xml in c i suggest you MXML LIBRARY you can find its info & download it from http://www.minixml.org/
精彩评论