Hi guys
Even thought Expat was successfully compiled through, I was still stuck in a big problem, I done like this:
Code:
#cd example
#gcc -g -I/usr/local/include elements.c -o elements -L/usr/local/lib -lexpat
#./element
(nothing happen, it was suspended forever)
so, I have to press CTRL+C to paused it. I checked over the source of this file and found that it readed XML file from STDIN, so I edited this file :
Code:
#vi element.c
...
FILE *pFile = NULL;
pFile = fopen("test.xml", "rb");
...
size_t len = fread(buf, 1, sizeof(buf), pFile);
...
#gcc -g -I/usr/local/include elements.c -o elements -L/usr/local/lib -lexpat
#./element
[root@root examples]# ./elements
Authentication
user
username
password
user
username
password
[root@root examples]#
[root@root examples]#less test.xml
<?xml version="1.0" encoding="UTF-8" ?>
<Authentication>
<user id="1">
<username>root</username>
<password>root</password>
</user>
<user id="2">
<username>ctgu</username>
<password>ctgu</password>
</user>
</Authentication>
[root@root examples]#
finaly, my question is that how to obtain the context and attributes of element ?
Thanks