Class: REXML::CData
Constant Summary collapse
- START =
'<![CDATA['
- STOP =
']]>'
- ILLEGAL =
/(\]\]>)/
Constants inherited from Text
Text::NEEDS_A_SECOND_CHECK, Text::NUMERICENTITY, Text::REFERENCE, Text::SETUTITSBUS, Text::SLAICEPS, Text::SPECIALS, Text::SUBSTITUTES, Text::VALID_CHAR, Text::VALID_XML_CHARS
Instance Attribute Summary
Attributes inherited from Text
Attributes inherited from Child
Instance Method Summary collapse
-
#clone ⇒ Object
Make a copy of this object.
-
#initialize(first, whitespace = true, parent = nil) ⇒ CData
constructor
Constructor.
-
#to_s ⇒ Object
Returns the content of this CData object.
- #value ⇒ Object
-
#write(output = $stdout, indent = -1,, transitive = false, ie_hack = false) ⇒ Object
DEPRECATED See the rexml/formatters package.
Methods inherited from Text
#<<, #<=>, check, #doctype, #empty?, #indent_text, #inspect, #node_type, #parent=, #value=, #wrap, #write_with_substitution, #xpath
Methods inherited from Child
#bytes, #document, #next_sibling=, #previous_sibling=, #remove, #replace_with
Methods included from Node
#each_recursive, #find_first_recursive, #indent, #index_in_parent, #next_sibling_node, #parent?, #previous_sibling_node
Constructor Details
#initialize(first, whitespace = true, parent = nil) ⇒ CData
Constructor. CData is data between <![CDATA[ … ]]>
Examples
CData.new( source )
CData.new( "Here is some CDATA" )
CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element )
16 17 18 |
# File 'lib/rexml/cdata.rb', line 16 def initialize( first, whitespace=true, parent=nil ) super( first, whitespace, parent, false, true, ILLEGAL ) end |
Instance Method Details
#clone ⇒ Object
Make a copy of this object
Examples
c = CData.new( "Some text" )
d = c.clone
d.to_s # -> "Some text"
26 27 28 |
# File 'lib/rexml/cdata.rb', line 26 def clone CData.new self end |
#to_s ⇒ Object
Returns the content of this CData object
Examples
c = CData.new( "Some text" )
c.to_s # -> "Some text"
35 36 37 |
# File 'lib/rexml/cdata.rb', line 35 def to_s @string end |
#value ⇒ Object
39 40 41 |
# File 'lib/rexml/cdata.rb', line 39 def value @string end |
#write(output = $stdout, indent = -1,, transitive = false, ie_hack = false) ⇒ Object
DEPRECATED
See the rexml/formatters package
Generates XML output of this object
- output
-
Where to write the string. Defaults to $stdout
- indent
-
The amount to indent this node by
- transitive
-
Ignored
- ie_hack
-
Ignored
Examples
c = CData.new( " Some text " )
c.write( $stdout ) #-> <![CDATA[ Some text ]]>
60 61 62 63 64 65 66 |
# File 'lib/rexml/cdata.rb', line 60 def write( output=$stdout, indent=-1, transitive=false, ie_hack=false ) Kernel.warn( "#{self.class.name}.write is deprecated", uplevel: 1) indent( output, indent ) output << START output << @string output << STOP end |