class XmlParser::Text

Text Class

Public Class Methods

multi_normalize(strs, doctype=nil, filter=nil) { |value| ... } click to toggle source

normalize string array. @param [Array] strs target string array. @param [REXML::DocType] doctype document type. @param [Array] filter entity filter. @return [Array] normalize string array.

# File lib/xml_parser/text.rb, line 24
def self.multi_normalize(strs, doctype=nil, filter=nil)

  # multi string normalize.
  strs.map { |str|
    value = normalize(str, doctype, filter)

    # if block_given?, do block process.
    if block_given?
      yield value
    else
      value
    end
  }
end
multi_unnormalize(strs, doctype=nil, filter=nil) { |value| ... } click to toggle source

unnormalize string array. @param [Array] strs target string array. @param [REXML::DocType] doctype document type. @param [Array] filter entity filter. @return [Array] unnormalize string array.

# File lib/xml_parser/text.rb, line 54
def self.multi_unnormalize(strs, doctype=nil, filter=nil)

  # multi string unnormalize.
  strs.map { |str|
    value = unnormalize(str, doctype, filter)

    # if block_given?, do block process.
    if block_given?
      yield value
    else
      value
    end
  }
end
normalize(str, doctype=nil, filter=nil) click to toggle source

normalize string. @param [String] str target string. @param [REXML::DocType] doctype document type. @param [Array] filter entity filter. @return [String] normalize string.

# File lib/xml_parser/text.rb, line 14
def self.normalize(str, doctype=nil, filter=nil)

  REXML::Text.normalize(str, doctype, filter)
end
unnormalize(str, doctype=nil, filter=nil) click to toggle source

unnormalize string. @param [String] str target string. @param [REXML::DocType] doctype document type. @param [Array] filter entity filter. @return [String] unnormalize string.

# File lib/xml_parser/text.rb, line 44
def self.unnormalize(str, doctype=nil, filter=nil)

  REXML::Text.unnormalize(str, doctype, filter)
end