Class: Moxml::Adapter::CustomizedLibxml::Text
- Defined in:
- lib/moxml/adapter/customized_libxml/text.rb
Overview
Wrapper for LibXML text nodes
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #text ⇒ Object
- #to_s ⇒ Object
-
#to_xml ⇒ Object
Serialize as XML with proper escaping LibXML’s .content already contains escaped text, but it over-escapes quotes which don’t need escaping in text nodes (only in attributes).
Methods inherited from Node
#==, #document, #document_present?, #hash, #initialize
Constructor Details
This class inherits a constructor from Moxml::Adapter::CustomizedLibxml::Node
Instance Method Details
#text ⇒ Object
14 15 16 |
# File 'lib/moxml/adapter/customized_libxml/text.rb', line 14 def text @native.content end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/moxml/adapter/customized_libxml/text.rb', line 10 def to_s @native.content end |
#to_xml ⇒ Object
Serialize as XML with proper escaping LibXML’s .content already contains escaped text, but it over-escapes quotes which don’t need escaping in text nodes (only in attributes)
21 22 23 |
# File 'lib/moxml/adapter/customized_libxml/text.rb', line 21 def to_xml @native.content.gsub(""", '"') end |