Class: Handsoap::XmlQueryFront::REXMLDriver
- Inherits:
-
Object
- Object
- Handsoap::XmlQueryFront::REXMLDriver
show all
- Includes:
- BaseDriver
- Defined in:
- lib/handsoap/xml_query_front.rb
Overview
Instance Method Summary
collapse
Methods included from BaseDriver
#/, #add_namespace, #assert_prefixes!, #initialize, #native_element, #to_boolean, #to_date, #to_f, #to_i
Instance Method Details
#[](attribute_name) ⇒ Object
249
250
251
252
|
# File 'lib/handsoap/xml_query_front.rb', line 249
def [](attribute_name)
raise ArgumentError.new unless attribute_name.kind_of? String
@element.attributes[attribute_name]
end
|
#node_name ⇒ Object
240
241
242
|
# File 'lib/handsoap/xml_query_front.rb', line 240
def node_name
@element.name
end
|
#to_raw ⇒ Object
261
262
263
|
# File 'lib/handsoap/xml_query_front.rb', line 261
def to_raw
@element.to_s
end
|
#to_s ⇒ Object
264
265
266
267
268
269
270
|
# File 'lib/handsoap/xml_query_front.rb', line 264
def to_s
if @element.kind_of? REXML::Attribute
@element.value
else
@element.text
end
end
|
#to_xml ⇒ Object
253
254
255
256
257
258
259
260
|
# File 'lib/handsoap/xml_query_front.rb', line 253
def to_xml
require 'rexml/formatters/pretty'
formatter = REXML::Formatters::Pretty.new
out = String.new
formatter.write(@element, out)
out.gsub(/>\n\s+([^<]+)\n\s+<\//, ">\\1</")
end
|
#xpath(expression, ns = nil) ⇒ Object
243
244
245
246
247
248
|
# File 'lib/handsoap/xml_query_front.rb', line 243
def xpath(expression, ns = nil)
ns = {} if ns.nil?
ns = @namespaces.merge(ns)
assert_prefixes!(expression, ns)
NodeSelection.new(REXML::XPath.match(@element, expression, ns).map{|node| REXMLDriver.new(node, ns) })
end
|