Method: XML::DOM::Attr#to_s

Defined in:
lib/xml/dom/core.rb,
lib/xml/dom2/attr.rb

#to_sObject

— Attr#to_s()

return the string representation of the Attr.



1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
# File 'lib/xml/dom/core.rb', line 1837

def to_s
  value = ""
  nodeValue.each_byte do |code|
    case code
    when 9, 10, 13
      value << sprintf("&#x%X;", code)
    when ?&
      value << "&amp;"
    when ?"
      value << "&quot;"
    when ?<
      value << "&lt;"
    else
      value << code
    end
  end
  "#{@name}=\"#{value}\""
end