Class: Handsoap::XmlMason::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/handsoap/xml_mason.rb

Direct Known Subclasses

Document, Element

Instance Method Summary collapse

Constructor Details

#initializeNode



15
16
17
# File 'lib/handsoap/xml_mason.rb', line 15

def initialize
  @namespaces = {}
end

Instance Method Details

#add(node_name, value = nil, options = {}) ⇒ Object

:yields: Handsoap::XmlMason::Element



18
19
20
21
22
23
24
# File 'lib/handsoap/xml_mason.rb', line 18

def add(node_name, value = nil, options = {}) # :yields: Handsoap::XmlMason::Element
  prefix, name = parse_ns(node_name)
  node = append_child Element.new(self, prefix, name, value, options)
  if block_given?
    yield node
  end
end

#alias(prefix, namespaces) ⇒ Object

Registers a prefix for a namespace.

You must register a namespace, before you can refer it.



28
29
30
# File 'lib/handsoap/xml_mason.rb', line 28

def alias(prefix, namespaces)
  @namespaces[prefix] = namespaces
end

#find(name) ⇒ Object

Finds the first element whos node_name equals name

Doesn't regard namespaces/prefixes.

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/handsoap/xml_mason.rb', line 34

def find(name)
  raise NotImplementedError.new
end

#find_all(name) ⇒ Object

Finds all elements whos node_name equals name

Doesn't regard namespaces/prefixes.

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/handsoap/xml_mason.rb', line 40

def find_all(name)
  raise NotImplementedError.new
end