Class: Moxml::Adapter::CustomizedLibxml::Cdata
- Defined in:
- lib/moxml/adapter/customized_libxml/cdata.rb
Overview
Wrapper for LibXML CDATA section nodes
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
-
#to_xml ⇒ Object
libxml stores CDATA payload verbatim.
Methods inherited from Node
#==, #document, #document_present?, #hash, #initialize, #replace_native!
Constructor Details
This class inherits a constructor from Moxml::Adapter::CustomizedLibxml::Node
Instance Method Details
#to_xml ⇒ Object
libxml stores CDATA payload verbatim. Only the ]]> end-marker
needs splitting before re-wrapping.
10 11 12 13 |
# File 'lib/moxml/adapter/customized_libxml/cdata.rb', line 10 def to_xml escaped_content = @native.content.gsub("]]>", "]]]]><![CDATA[>") "<![CDATA[#{escaped_content}]]>" end |