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

- (Node) initialize

Returns a new instance of Node



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

def initialize
  @namespaces = {}
end

Instance Method Details

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

: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

- (Object) alias(prefix, namespaces)

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

- (Object) find(name)

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

- (Object) find_all(name)

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