标签:
1 //read_check.xml
2 <?xml version="1.0" encoding="UTF-8" ?>
3 <note year="55" date="33" month="22">
4 <id>5000</id>
5 <password>FE-D0-18-00</password>
6 </note>
1 jason@ubuntu:~/Desktop/project_xml_mysql$ gcc -o read_xml read_xml.c -lmxml -lpthread
2 read_xml.c: In function ‘main’:
3 read_xml.c:25:9: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
4 id_text=mxmlGetText(id,0);
5 ^
6 read_xml.c:29:15: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
7 password_text=mxmlGetText(password,0);
8 ^
9 jason@ubuntu:~/Desktop/project_xml_mysql$ ./read_xml
10 year:55
11 date:33
12 month:22
13 5000
14 FE-D0-18-00
15
16 出现这个问题是丢失了const限定符,在char id_text,password_text;前面加上const就可以完美解决这个问题。
17
18 jason@ubuntu:~/Desktop/project_xml_mysql$ gcc -o read_xml read_xml.c -lmxml -lpthread
19 jason@ubuntu:~/Desktop/project_xml_mysql$ ./read_xml
20 year:55
21 date:33
22 month:22
23 5000
24 FE-D0-18-00
25 jason@ubuntu:~/Desktop/project_xml_mysql$
26
27 参考文献:http://www.cnblogs.com/dyllove98/archive/2013/07/24/3212538.html
现在为止,实现了利用mxml库函数,用C语言,创建了一个简单的xml文件,并且实现了反向的去调用一些api去解析这些xml文件。
下一步是实现,将解析出来的数据同步到MySQL数据库。
标签:
原文地址:http://www.cnblogs.com/kongchung/p/4811461.html