require 'rubygems'
require 'activesupport'
require 'hpricot'
doc = Hpricot::XML(%q{
<data PropFormat="node">
<TPerson>
<Id>477</Id>
<identifier>asd6asd76as7d6sa78d6a78s6d78asd678a6s87d</identifier>
</TPerson>
</data>
})
puts doc.search('/data/*').find(&:elem?).name => 'TPerson'
Refactorings
No refactoring yet !
halogenandtoast
October 28, 2008, October 28, 2008 21:40, permalink
Unfortunately, no. You may want to try libxml instead, Hpricot only seems useful if you know what format to expect.
Adam
October 29, 2008, October 29, 2008 03:49, permalink
require 'rexml/document' document = REXML::Document.new(xml) document.root.elements[1].name
unlogeDeemn
May 9, 2011, May 09, 2011 02:32, permalink
Christian Drug Rehab Detox Centers http://www.thegirlyghosthunters.com - ambien cr One cannot take alcohol while on Zoldipem as it will make one to feel drowsy. http://www.thegirlyghosthunters.com - ambien drug
mablePabure
May 3, 2011, May 03, 2011 16:09, permalink
Drugs Philadelphia http://www.champion-audi.com/ - generic prednisolone It can also be used in the treatment of migraines, cluster headaches, leukemia, Hodgkin?s lymphoma, and hormone sensitive tumors. http://www.champion-audi.com/ - prednisone for sale
CafDahsmeashy
June 15, 2011, June 15, 2011 21:34, permalink
Walmart Drug Assistance http://crueton.com/ - cialis online El fA?rmaco debe ser tomado cuando se quiera tener relaciones sexuales y solo debe ser adquirido bajo prescripciA?n medica. http://crueton.com/ - como comprar cialis
RilmShillesee
June 30, 2011, June 30, 2011 19:21, permalink
Canine Medicine Chest http://www.texashighschoolfootballonline.com/ - soma muscle relaxant This some name is known by different names in different categories. http://www.texashighschoolfootballonline.com/ - generic soma
Is there a simpler way of getting the name of the node after <data>?