First, you need to get a reference to the os element. This will work for that:
os = doc.at_css('os')
Next, get your snippet of XML into a DocumentFragment, so you can fling it around in Nokogiri:
elm = Nokogiri::XML::DocumentFragment([your string of XML above])
Finally, you simply add a new child to it with the node you created:
os.add_child(elm)
That should add it at the end of the os element. You have an empty <addOnModules> tag already in the first snippet, you could replace that in place or leave it out of the original template. To replace it, just change add_child() to replace(). Now if you may already have content in that element, and you want to merge contents, you will need to do a more granular approach, but this should get you started.
Walter
>
> --
> You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
nokogiri-tal...@googlegroups.com.
> To post to this group, send email to
nokogi...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/nokogiri-talk.
> For more options, visit
https://groups.google.com/groups/opt_out.