Class: Moxml::Adapter::CustomizedLibxml::ProcessingInstruction

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

Overview

Wrapper for LibXML processing instruction nodes

Instance Attribute Summary

Attributes inherited from Node

#native

Instance Method Summary collapse

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_xmlObject

XML 1.0 §2.6: PI content is verbatim — no entity resolution, no escaping.



9
10
11
12
13
14
15
16
17
# File 'lib/moxml/adapter/customized_libxml/processing_instruction.rb', line 9

def to_xml
  target = @native.name
  content = @native.content
  if content && !content.empty?
    "<?#{target} #{content}?>"
  else
    "<?#{target}?>"
  end
end