Class: Moxml::Adapter::CustomizedLibxml::Text

Inherits:
Node
  • Object
show all
Defined in:
lib/moxml/adapter/customized_libxml/text.rb

Overview

Wrapper for LibXML text nodes

Instance Attribute Summary

Attributes inherited from Node

#native

Instance Method Summary collapse

Methods inherited from Node

#==, #document, #document_present?, #hash, #initialize

Constructor Details

This class inherits a constructor from Moxml::Adapter::CustomizedLibxml::Node

Instance Method Details

#textObject



14
15
16
# File 'lib/moxml/adapter/customized_libxml/text.rb', line 14

def text
  @native.content
end

#to_sObject



10
11
12
# File 'lib/moxml/adapter/customized_libxml/text.rb', line 10

def to_s
  @native.content
end

#to_xmlObject

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