[C][Expat][XML] Touver un champ avec expat
Bonjour,
Je vien de me lancer avec expat (non négociable ne me parlez pas des autres lib :'( ) et je cherche bettement à retrouver mes petits:
Code:
1 2 3 4 5 6 7 8 9 10
| <bookstore xmlns:bk="urn:samples">
<book genre="novel" publicationdate="1997" bk:ISBN="1-861001-57-8">
<title>Pride And Prejudice</title>
<author>
<first-name>Jane</first-name>
<last-name>Austen</last-name>
</author>
<price>24.95</price>
</book>
</bookstore> |
Disons que je cherche 24.95 dans le doc ci dessus.
J'enregistre mon handler XML_SetCharacterDataHandler :
Code:
1 2 3 4 5 6 7
|
static void XMLCALL charData (void *userData, const XML_Char *s, int len)
{
XML_Char * prix = "24.95";
if(strcmp(s,prix) == 0)
puts("Found\n");
} |
Et evidement je ne trouve jamais mon prix, en regardant de plus pret (debug) *prix = 24.95 pas de pb la desssus mais
*s = un ruc incomprehensible
Pourtant si j'affiche ce qui est pointé par s
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
static void XMLCALL charData (void *userData, const XML_Char *s, int len)
{
int i;
char s;
XML_Char * prix = "24.95";
for(i = 0; i<len; i++)
{
s = *string;
putchar(s);
string++;
}
if(strcmp(s,prix) == 0)
puts("found\n");
} |
j'arrive bien a avoir 24.95, j'ai du louper un truc...