ruby - Get node name with REXML -


i have xml, can like

<?xml version="1.0" encoding="utf-8"?> <testnode type="1">123</testnode> 

or like

<?xml version="1.0" encoding="utf-8"?> <othernode attrib="true">other value</othernode> 

or root node can unexpected. (theoretically anything.) i'm using rexml parse it. how can find out xml node root element?

xml = rexml::document.new "<?xml version" #etc (or load file) root_node = xml.elements[1] root_node_name = root_node.name 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -