Class: REXML::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/wss4r/security/util/xmlutils.rb

Instance Method Summary collapse

Instance Method Details

#element_with_attribute(key, value) ⇒ Object



49
50
51
# File 'lib/wss4r/security/util/xmlutils.rb', line 49

def element_with_attribute(key, value)

end

#select(xpath) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/wss4r/security/util/xmlutils.rb', line 17

def select(xpath)
	#XPath.first(document, "/env:Envelope/env:Header/wsse:Security/ds:Signature")
	element = XPath.first(self, xpath)
	if (element != nil)
		return element
	end
	node_path = xpath.sub("/","").split("/")
	
	element = self
	
	node_path.each{|expr|
		element = select_element(element, expr)
		if (element == nil)
			return nil
		end
	}
	element
end

#select_element(element, name) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/wss4r/security/util/xmlutils.rb', line 36

def select_element(element, name)
	childs = Array.new()
	element.each_child{|child|
		if (child.node_type() == :element)
			if (child.expanded_name() == name)
				childs.push(child)
				return child
			end
		end
	}
	nil
end