class REXML::CData
常量
- ILLEGAL
- START
- STOP
公共类方法
new( first, whitespace=true, parent=nil ) 点击以切换源代码
Constructor. CData is data between <![CDATA[ ... ]]>
示例
CData.new( source ) CData.new( "Here is some CDATA" ) CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element )
调用父类方法
# File rexml-3.4.0/lib/rexml/cdata.rb, line 16 def initialize( first, whitespace=true, parent=nil ) super( first, whitespace, parent, false, true, ILLEGAL ) end
公共实例方法
clone() 点击以切换源代码
创建此对象的副本
示例
c = CData.new( "Some text" ) d = c.clone d.to_s # -> "Some text"
# File rexml-3.4.0/lib/rexml/cdata.rb, line 26 def clone CData.new self end
to_s() 点击以切换源代码
返回此 CData
对象的内容
示例
c = CData.new( "Some text" ) c.to_s # -> "Some text"
# File rexml-3.4.0/lib/rexml/cdata.rb, line 35 def to_s @string end
value() 点击以切换源代码
# File rexml-3.4.0/lib/rexml/cdata.rb, line 39 def value @string end
write( output=$stdout, indent=-1, transitive=false, ie_hack=false ) 点击以切换源代码
已弃用¶ ↑
请参阅 rexml/formatters 包
生成此对象的 XML 输出
- output
-
写入字符串的位置。 默认为 $stdout
- indent
-
此节点缩进的量
- transitive
-
忽略
- ie_hack
-
忽略
示例
c = CData.new( " Some text " ) c.write( $stdout ) #-> <![CDATA[ Some text ]]>
# File rexml-3.4.0/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