Class XTemplate::XMLDocument
In: lib/xtemplate/xml.rb
lib/xtemplate/yaml.rb
Parent: Object

Methods

[]   new   parse   strip!   to_hash   to_s   to_yaml  

Included Modules

XPath

Public Class methods

[Source]

# File lib/xtemplate/xml.rb, line 353
    def initialize(text)
      @hash = nil
      case text
      when XNode
        @node = text
      when Hash,Array
        @node = XNode.new()
        value_to_xml(text, @node)
      else
        @node = parse(text)
        @node.prepare(nil, {:@type => true, :include => true, :template => true})
      end
    end

Public Instance methods

[Source]

# File lib/xtemplate/xml.rb, line 383
    def [](path)
      root = to_hash()
      xpath(path,root)
    end

[Source]

# File lib/xtemplate/xml.rb, line 367
    def parse(text)
      XMLParser.new.parse(text)
    end

[Source]

# File lib/xtemplate/xml.rb, line 371
    def strip!(recursive=true)
      @node.strip!(recursive)
    end

[Source]

# File lib/xtemplate/xml.rb, line 375
    def to_hash()
      @node.to_hash()
    end

[Source]

# File lib/xtemplate/xml.rb, line 379
    def to_s()
      @node.to_s()
    end

[Source]

# File lib/xtemplate/yaml.rb, line 14
    def to_yaml
      @node.to_yaml
    end

[Validate]