class XMLBuilder::PathParser::Document
Node
classes Each class represents a node type. An array of these classes is built up when the path is parsed. Each node is then visited by the current rexml node and (depending on which visit function is called) the action taken.
The visit function are:
- walk: Walks down the xml dom - assign: Assigns the value to rexml node - retrieve: Retrives the value of the rexml node Different node types implement different behaviour types. For example retrieve is illegal on Attribute nodes, but on Document and Attribute nodes the given node is returned.
Node
classes Each class represents a node type. An array of these classes is built up when the path is parsed. Each node is then visited by the current rexml node and (depending on which visit function is called) the action taken.
The visit function are:
- walk: Walks down the xml dom - assign: Assigns the value to rexml node - retrieve: Retrives the value of the rexml node Different node types implement different behaviour types. For example retrieve is illegal on Attribute nodes, but on Document and Attribute nodes the given node is returned.
Public Class Methods
new()
click to toggle source
# File lib/ec2/amitools/xmlbuilder.rb, line 132 def initialize() end
Public Instance Methods
assign_visit(document_node, value)
click to toggle source
# File lib/ec2/amitools/xmlbuilder.rb, line 142 def assign_visit(document_node, value) raise 'Can only assign REXML::Elements to document nodes' if !value.is_a?(REXML::Element) raise 'Expected a document node' if !document_node.is_a?(REXML::Element) if doc.root doc.replace_child(doc.root, value) else doc.add_element(element) end end
retrieve_visit(document_node)
click to toggle source
# File lib/ec2/amitools/xmlbuilder.rb, line 152 def retrieve_visit(document_node) document_node end
walk_visit(rexml_node)
click to toggle source
Move to the document node (top of the xml dom)
# File lib/ec2/amitools/xmlbuilder.rb, line 136 def walk_visit(rexml_node) return rexml_node if rexml_node.is_a?(REXML::Document) raise "No document set on node. #{rexml_node.name}" if rexml_node.document == nil rexml_node.document end