Class: WsdlMapper::SvcDescParsing::Parser

Inherits:
Parsing::Base show all
Includes:
Wsdl11
Defined in:
lib/wsdl_mapper/svc_desc_parsing/parser.rb

Constant Summary

Constant Summary

Constants included from Wsdl11

Wsdl11::ARRAY_TYPE, Wsdl11::BINDING, Wsdl11::DEFINITIONS, Wsdl11::DOCUMENTATION, Wsdl11::FAULT, Wsdl11::INPUT, Wsdl11::MESSAGE, Wsdl11::NS, Wsdl11::OPERATION, Wsdl11::OUTPUT, Wsdl11::PART, Wsdl11::PORT, Wsdl11::PORT_TYPE, Wsdl11::SERVICE, Wsdl11::TYPES

Constants inherited from Parsing::Base

Parsing::Base::NS_DECL_PREFIX, Parsing::Base::TARGET_NS

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Parsing::Base

get_name

Constructor Details

- (Parser) initialize

Returns a new instance of Parser



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 22

def initialize
  @base = self
  @description = WsdlMapper::SvcDesc::Wsdl11::Description.new

  @parsers = {
    MESSAGE => MessageParser.new(self),
    PORT_TYPE => PortTypeParser.new(self),
    SERVICE => ServiceParser.new(self),
    BINDING => BindingParser.new(self),
    TYPES => TypesParser.new(self)
    # TODO: import
  }

  @namespaces = Namespaces.new
  @target_namespace = nil
  @default_namespace = nil
  @log_msgs = []
  @linker = Linker.new @description
end

Instance Attribute Details

- (Object) default_namespace (readonly)

Returns the value of attribute default_namespace



20
21
22
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 20

def default_namespace
  @default_namespace
end

- (Object) description (readonly)

Returns the value of attribute description



20
21
22
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 20

def description
  @description
end

- (Object) log_msgs (readonly)

Returns the value of attribute log_msgs



20
21
22
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 20

def log_msgs
  @log_msgs
end

- (Object) namespaces (readonly)

Returns the value of attribute namespaces



20
21
22
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 20

def namespaces
  @namespaces
end

- (Object) parsers (readonly)

Returns the value of attribute parsers



20
21
22
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 20

def parsers
  @parsers
end

- (Object) target_namespace (readonly)

Returns the value of attribute target_namespace



20
21
22
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 20

def target_namespace
  @target_namespace
end

Instance Method Details

- (Object) log_msg(node, msg = '', source = self)

Parameters:

  • node (Nokogiri::XML::Node)
  • msg (String, Symbol) (defaults to: '')


56
57
58
59
60
61
62
63
64
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 56

def log_msg(node, msg = '', source = self)
  log_msg = LogMsg.new(node, source, msg)
  log_msgs << log_msg
  # TODO: remove debugging output
  puts node.inspect
  puts msg
  puts caller
  puts "\n\n"
end

- (WsdlMapper::Dom::Schema) parse(doc)

Parameters:

  • doc (Nokogiri::XML::Document)

Returns:



44
45
46
47
48
49
50
51
52
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 44

def parse(doc)
  # Phase 1: Parsing
  parse_doc doc

  # Phase 2: Linking
  _, @schema = @linker.link

  [@description, @schema]
end

- (Object) parse_documentation(node, obj)



66
67
68
# File 'lib/wsdl_mapper/svc_desc_parsing/parser.rb', line 66

def parse_documentation(node, obj)
  obj.documentation = node.text
end