Class: XMLScan::XPath::DOM::AbstractNodeAdapter

Inherits:
NullNodeAdapter
  • Object
show all
Defined in:
lib/xml/dom2/xpath.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



28
29
30
# File 'lib/xml/dom2/xpath.rb', line 28

def node
  @node
end

Instance Method Details

#childrenObject



38
39
40
# File 'lib/xml/dom2/xpath.rb', line 38

def children
  @node.childNodes.to_a
end

#each_following_siblingsObject



42
43
44
45
# File 'lib/xml/dom2/xpath.rb', line 42

def each_following_siblings
  node = @node
  yield node while node = node.nextSibling
end

#each_preceding_siblingsObject



47
48
49
50
# File 'lib/xml/dom2/xpath.rb', line 47

def each_preceding_siblings
  node = @node
  yield node while node = node.previousSibling
end

#indexObject



52
53
54
# File 'lib/xml/dom2/xpath.rb', line 52

def index
  @node.parentNode.childNodes.to_a.index(@node)
end

#langObject



56
57
58
59
60
61
62
63
# File 'lib/xml/dom2/xpath.rb', line 56

def lang
  node = @node
  lang = nil
  until a = node.attributes and lang = a.getNamedItem('xml:lang')
    node = node.parentNode
  end
  lang and lang.nodeValue
end

#parentObject



34
35
36
# File 'lib/xml/dom2/xpath.rb', line 34

def parent
  @node.parentNode
end

#rootObject



30
31
32
# File 'lib/xml/dom2/xpath.rb', line 30

def root
  @node.ownerDocument
end

#wrap(node, visitor) ⇒ Object



23
24
25
26
# File 'lib/xml/dom2/xpath.rb', line 23

def wrap(node, visitor)
  @node = node
  self
end