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

SAP Web Service from .NET via WCF -

Optimized Line drawing in QT -

datetime - str to time in python -