I am following the example in
http://www.xml.com/pub/a/2005/11/09/rexml-processing-xml-in-ruby.html?page=2
irb(main):001:0> require ''rexml/document''
irb(main):002:0> include REXML
irb(main):003:0> doc = Document.new(File.new("bibliography.xml"))
irb(main):004:0> root = doc.root
irb(main):005:0> root.attributes[''id'']
irb(main):006:0> puts root.elements[1].elements["author"]
<author>
  <firstname>Godfrey</firstname>
  <surname>Vesey</surname>
</author>
I can do "root.attributes[''id'']="XXX""...
irb(main):007:0> puts root.attributes[''id'']
XXX
=> nil
Why cant i do
root.elements[2].elements["author"].elements["firstname"]="YYY"
???
I would like to locate one of the elements and reassign the value. How
can i do that?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---