Rexml/document problem


#1

<?xml version="1.0"?>
<a>

  <b prefix="A" num="1" />
  <b perfix="B" num="2" />
  <b prefix="C" num="3" />
  <b prefix="D" num="4" />
  <b prefix="F" num="5" />
</a>

This is my xml file data. There include several in the xml file. i
can read the 1st data:

puts root.elements[“b”].attributes[“prefix”]

Now i cannot read the 1 by 1. How can i read the and write the
output is:

“A”
“B”
“C”
“D”
“E”


#2

Cool W. wrote:

“C”
“D”
“E”

REXML::XPath.each(root, ‘//b’) do |node|
p node.text
end


#3

Phlip wrote:

Cool W. wrote:

“C”
“D”
“E”

REXML::XPath.each(root, ‘//b’) do |node|
p node.text
end

if i want to update or edit the content in the xml file, how can i
update it??