首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

REXML raw tag not working when getting an attribute

2012-12-27 
REXML raw tag not working when getting an attribute?Today I met a problem and want REXML get the ra

REXML raw tag not working when getting an attribute?
Today I met a problem and want REXML get the raw text from attibute, e.g.

    xml_string="<root><outline url='&amp;'/></root>"    doc= REXML::Document.new( xml_string, {:raw => :all} )    outline = doc.root.elements[1]    url = outline.attribute("url")  # raw text!    url = outline.attributes["url"]  # escaped text!


solution is:  use  attribute("xx") instead of attributes["xx"]. 

p.s. How I want to use LibXML and say goodbye to REXML.... 

热点排行