svn上的minixml源碼下載:
svn co http://svn.msweet.org/mxml/tags/release-2.7/
按照下載回來的源代碼進行編譯和安裝。本教程只針對新手作一個引導,大神見笑了,能夠直接繞道。願這個教程給你帶來幫助。
即:
./configure
make
make install
隨後就能夠開始使用很是簡潔的並能夠跨不少平臺的minixml
更換平臺只須要將xml庫使用不一樣的工具鏈重寫編譯一下便可啦。
開始開發的示例以下:
對應有個一minixml的中文說明手冊:MiniXML中文文檔.doc
http://wenku.baidu.com/view/25fd7d7f31b765ce050814f7.htmlhtml
XML示例文件源:node
1 <?xml version="1.0" encoding="gb2312" ?>
2 <note year="55" date="33" month="22">
3 <id>5000</id>
4 <password>FE-D0-18-00</password>
5 </note>
對應的解析代碼以下: 代碼很簡單放到你的工程裏面跑一盤就十分清楚了。GoodLuck!svn
#include<mxml.h> #include<string.h> #include<stdio.h> #include<stdlib.h>
int main() { FILE *fp; mxml_node_t *tree,*node; fp = fopen("debug_settings.xml", "r"); tree = mxmlLoadFile(NULL, fp,MXML_TEXT_CALLBACK); fclose(fp); mxml_node_t *id,*password; node = mxmlFindElement(tree, tree, "note",NULL, NULL,MXML_DESCEND); printf(" year:%s \n",mxmlElementGetAttr(node,"year")); printf(" date:%s \n",mxmlElementGetAttr(node,"date")); printf(" month:%s \n",mxmlElementGetAttr(node,"month")); id = mxmlFindElement(node, tree, "id",NULL, NULL,MXML_DESCEND); printf("[%s}\n",id->child->value.text.string); password = mxmlFindElement(node, tree, "password",NULL, NULL,MXML_DESCEND); printf("[%s]\n",password->child->value.text.string); mxmlDelete(tree); return 0 ; }
轉自:https://www.cnblogs.com/dyllove98/archive/2013/07/24/3212538.html工具