Re: [xml] Example program tree1.c: Node content always NULL ?

On Jan 10, 2005, at 10:51 AM, Karl wrote:


I have compiled the example program tree1.c, but I wanted to get to the content of the nodes. Therefore, I changed its output in line 37 to:

printf("node type: Element, name: %s, value: %s\n", cur_node->name, cur_node->content);

and tested it with :

<?xml version="1.0" ?>
<Praktikum><Umfeld><Feld><Boden>Rasen</Boden><Ameise><Typ>Rot</ Typ><ID>1</ID><Blickrichtung>NW</Blickrichtung><Angegriffen>0</ Angegriffen><Objekt>Stein-2</Objekt></Ameise></Feld></ Umfeld><Status>OK</Status></Praktikum>

Unfortunately: all content attributes are NULL. The "<ID>1</ID>" e.g. should have content 1, or am I wrong?

Can anyone tell me, what I am doing wrong?

try the cur_node->children->content instead .
Nathanael D. Noblet
Gnat Solutions
204 - 131 Gorge Road E
Victoria, BC V9A 1L1

T 250.385.4613
C 250.893.4613

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]