Class REXML::Text
In: rexml/text.rb
Parent: Child

Represents text in an XML document

Methods
<=>    clone    empty?    new    normalize    parse_stream    pull    read_with_substitution    to_s    unnormalize    write    write_with_substitution   
Attributes
:raw  [RW] 
:string  [R] 

string is String content, raw is a boolean

Included modules
Comparable
Public Class methods
new(arg, respect_whitespace=false, parent=nil, pattern=PATTERN, raw=false)

Constructor FIXME: This documentation sucks. @param arg if a String, the content is set to the String. If a Text, the object is shallowly cloned. If a Source, the source is parsed for text content up to the next element. If a Parent, the parent of this object is set to the argument. If true or false, will be used as the value for the 'raw' setting. @param respect_whitespace (boolean, optional) if true, whitespace is respected @param parent (Parent, optional) if this is a Parent object, the parent will be set to this. If this is true or false, the value will be used as the 'raw' setting. @param pattern INTERNAL USE ONLY @param raw INTERNAL USE ONLY

parse_stream(source, listener)
pull(source)
read_with_substitution( input, illegal=nil )

Reads text, substituting entities

normalize( input, doctype=nil )
unnormalize( string, doctype=nil, illegal=nil )
Public Instance methods
empty?()
clone()
<=>( other )

@param other a String or a Text @return the result of (to_s <=> arg.to_s)

to_s()

Returns an UNNORMALIZED value; IE, entities that can be replaced have been replaced.

write( writer, indent=-1, transitive=false, ie_hack=false )
write_with_substitution(out, input)

Writes out text, substituting special characters beforehand. @param out A String, IO, or any other object supporting <<( String ) @param input the text to substitute and the write out

z=utf8.unpack("U*") ascOut="" z.each{|r|

  if r <  0x100
    ascOut.concat(r.chr)
  else
    ascOut.concat(sprintf("&#x%x;", r))
  end

} puts ascOut