Class: Handsoap::XmlQueryFront::LibXMLDriver
- Inherits:
-
Object
- Object
- Handsoap::XmlQueryFront::LibXMLDriver
show all
- Includes:
- XmlElement
- Defined in:
- lib/handsoap/xml_query_front.rb
Overview
Instance Method Summary
collapse
Methods included from XmlElement
#/, #add_namespace, #assert_prefixes!, #initialize, #native_element, #to_boolean, #to_date, #to_f, #to_i
Instance Method Details
#[](attribute_name) ⇒ Object
228
229
230
231
|
# File 'lib/handsoap/xml_query_front.rb', line 228
def [](attribute_name)
raise ArgumentError.new unless attribute_name.kind_of? String
@element[attribute_name]
end
|
#children ⇒ Object
225
226
227
|
# File 'lib/handsoap/xml_query_front.rb', line 225
def children
NodeSelection.new(@element.children.map{|node| LibXMLDriver.new(node) })
end
|
#node_name ⇒ Object
216
217
218
|
# File 'lib/handsoap/xml_query_front.rb', line 216
def node_name
@element.name
end
|
#to_raw ⇒ Object
235
236
237
|
# File 'lib/handsoap/xml_query_front.rb', line 235
def to_raw
@element.to_s(:indent => false)
end
|
#to_s ⇒ Object
238
239
240
241
242
243
244
|
# File 'lib/handsoap/xml_query_front.rb', line 238
def to_s
if @element.kind_of? LibXML::XML::Attr
@element.value
else
@element.content
end
end
|
#to_xml ⇒ Object
232
233
234
|
# File 'lib/handsoap/xml_query_front.rb', line 232
def to_xml
@element.to_s(:indent => true)
end
|
#xpath(expression, ns = nil) ⇒ Object
219
220
221
222
223
224
|
# File 'lib/handsoap/xml_query_front.rb', line 219
def xpath(expression, ns = nil)
ns = {} if ns.nil?
ns = @namespaces.merge(ns)
assert_prefixes!(expression, ns)
NodeSelection.new(@element.find(expression, ns.map{|k,v| "#{k}:#{v}" }).to_a.map{|node| LibXMLDriver.new(node, ns) })
end
|