LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Encounter a big problem while using phaser of Expat (https://www.linuxquestions.org/questions/linux-software-2/encounter-a-big-problem-while-using-phaser-of-expat-449830/)

SybaseLu 05-30-2006 04:42 AM

Encounter a big problem while using phaser of Expat
 
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

SybaseLu 05-30-2006 08:10 PM

Well, I tried others pharser of XML likes libxml2 etc. But I didn't think that it has good API interface (i.e it so ugly) ,right? In my mind , same as Expat.

SybaseLu 05-31-2006 03:31 AM

Is there anybody else? Both you are sleeping? Well, I am working now, Because...
Please


All times are GMT -5. The time now is 01:57 PM.