[xml] getting atribute values



I'm having some questions, that maybe be easy to some, but i'm getting
some problems getting it done, so here it goes.

image you have one xml that looks like this:

<?xml version="1.0"?>
<root>
  <destination_ip>
    <dest_ip>192.168.10.50</dest_ip>
    <dest_port>1024</dest_port>
  </destination_ip>
  <source_ip>
    <src_ip>192.168.10.50</src_ip>
    <src_port>1025</src_port>
  </source_ip>
  <tos_byte>
    <tos_b>255</tos_b>
  </tos_byte>
  <message_id>
    <msg_id>255</msg_id>
  </message_id>
</root>

and you want to do something simple like the result from
http://xmlsoft.org/examples/tree1.c

but instead fo that i want to print out to the screen something like this:

dest_ip , 192.168.10.50
dest_port , 1024
tos_b , 255
msg_id , 255
etc...

the problem is that i'm not getting anywhere near that, i tried change
the code from the example, but i always print out some results i don't
want.

first i tried to get only the XML_TEXT_NODE values, then a bunch of
other ways, and i'm getting kind of lost in the recursion here.

is there anyway of doing it without recursion?

sorry if it was posted, but i checked for the archive and didn't find any

-- 

Miguel Costa



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