`
sg552
  • 浏览: 614014 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
47437293-94b9-3b04-9152-8971c7580049
白手起家学习使用Flex
浏览量:18490
社区版块
存档分类
最新评论

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.... 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics