From: Wang, Hai (hwang@accuris.ie)
Date: Thu Dec 07 2000 - 06:36:32 EST
Hello Daniel,
You are right, but I still could not print out any thing from leaves
nodes,say text node. I used the function "xmlNodeIsText"to check if the node
is a leaf node. the output from my codes is:
nodename: text
node content:
nodename: question
nodename: text
node content:
nodename: answer
nodename: text
node content:
nodename: question
nodename: text
node content:
nodename: answer
nodename: text
node content:
//---XML file used is -------
<?xml version="1.0"?>
<exam>
<question>Who is the last King of England</question>
<answer>George VI</answer>
<question>How many queens were named Elizabeth </question>
<answer>Two</answer>
</exam>
//----------------------------
Thank you very much
-----Original Message-----
From: Daniel Veillard [mailto:Daniel.Veillard@w3.org]
Sent: Thursday, December 07, 2000 10:30 AM
To: xml@rpmfind.net
Subject: Re: [xml] traverse the XML tree but contents and attributes are
emmpty
On Thu, Dec 07, 2000 at 09:57:22AM -0000, Wang, Hai wrote:
>
> Hello everybody,
> I have got a problem with gnome parser, I tried to parse a XML doc
> from memory, it was good, but when I tried to traverse the xml tree in
> xmlDocPtr to get all the nodes and print out their names, attributesname
and
> contents, I find the following problems:
> 1. Node name is correct, but with text node, (I want to get rid of the
text
> node).
> 2. attributes are empty
> 3 contents are all empty.
You need to (re)read
http://xmlsoft.org/#tree
Attributes and element nodes don't have content they have children,
Only leaves in the tree have content !
Daniel
-- Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes | libxml Gnome XML toolkit Tel : +33 476 615 257 | 655, avenue de l'Europe | http://xmlsoft.org/ Fax : +33 476 615 207 | 38330 Montbonnot FRANCE | Rpmfind search site http://www.w3.org/People/all#veillard%40w3.org | http://rpmfind.net/ ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Thu Dec 07 2000 - 09:43:37 EST