Class: VimSdk::Soap::NamespacedDocument

Inherits:
Nokogiri::XML::SAX::Document
  • Object
show all
Defined in:
lib/ruby_vim_sdk/soap/deserializer.rb

Direct Known Subclasses

SoapDeserializer, SoapResponseDeserializer

Instance Method Summary collapse

Constructor Details

#initialize(namespace_map = nil) ⇒ NamespacedDocument

Returns a new instance of NamespacedDocument.



13
14
15
16
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 13

def initialize(namespace_map = nil)
  @namespace_map = namespace_map || {}
  @prefix_stack = []
end

Instance Method Details

#end_element_namespace(name, prefix = nil, uri = nil) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 51

def end_element_namespace(name, prefix = nil, uri = nil)
  end_namespaced_element([uri, name])

  unless @prefix_stack.empty?
    prefixes = @prefix_stack.pop
    prefixes.each { |namespace_prefix| @namespace_map[namespace_prefix].pop }
  end
end

#end_namespaced_element(name) ⇒ Object



21
22
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 21

def end_namespaced_element(name)
end

#namespace_and_wsdl_name(tag) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 24

def namespace_and_wsdl_name(tag)
  index = tag.index(":")
  if index
    prefix, name = tag[0..index - 1], tag[index + 1..-1]
  else
    prefix, name = nil, tag
  end
  namespace = @namespace_map[prefix].last
  [namespace, name]
end

#start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 35

def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = [])
  prefixes = []
  ns.each do |namespace_prefix, namespace|
    (@namespace_map[namespace_prefix] ||= []) << namespace
    prefixes << namespace_prefix
  end
  @prefix_stack << prefixes
  namespaced_attrs = {}
  attrs.each do |attr|
    attr_uri = attr.uri || uri
    namespaced_attrs[[attr_uri, attr.localname]] = attr.value
  end

  start_namespaced_element([uri, name], namespaced_attrs)
end

#start_namespaced_element(name, attrs) ⇒ Object



18
19
# File 'lib/ruby_vim_sdk/soap/deserializer.rb', line 18

def start_namespaced_element(name, attrs)
end