Class: WSDL::XMLSchema::Group

Inherits:
Info show all
Defined in:
lib/wsdl/xmlSchema/group.rb

Instance Attribute Summary collapse

Attributes inherited from Info

#id, #parent, #root

Instance Method Summary collapse

Methods inherited from Info

#inspect, #parse_epilogue

Constructor Details

#initialize(name = nil) ⇒ Group

Returns a new instance of Group.



48
49
50
51
52
53
54
55
56
# File 'lib/wsdl/xmlSchema/group.rb', line 48

def initialize(name = nil)
  super()
  @name = name
  @maxoccurs = 1
  @minoccurs = 1
  @content = nil
  @ref = nil
  @refelement = nil
end

Instance Attribute Details

#content=(value) ⇒ Object (writeonly)

Sets the attribute content

Parameters:

  • value

    the value to set the attribute content to.



41
42
43
# File 'lib/wsdl/xmlSchema/group.rb', line 41

def content=(value)
  @content = value
end

#maxoccursObject

Returns the value of attribute maxoccurs.



39
40
41
# File 'lib/wsdl/xmlSchema/group.rb', line 39

def maxoccurs
  @maxoccurs
end

#minoccursObject

Returns the value of attribute minoccurs.



40
41
42
# File 'lib/wsdl/xmlSchema/group.rb', line 40

def minoccurs
  @minoccurs
end

#name=(value) ⇒ Object (writeonly)

required



38
39
40
# File 'lib/wsdl/xmlSchema/group.rb', line 38

def name=(value)
  @name = value
end

#refObject

Returns the value of attribute ref.



46
47
48
# File 'lib/wsdl/xmlSchema/group.rb', line 46

def ref
  @ref
end

Instance Method Details

#attr_reader_ref(symbol) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/wsdl/xmlSchema/group.rb', line 19

def attr_reader_ref(symbol)
  name = symbol.to_s
  define_method(name) {
    instance_variable_get("@#{name}") ||
      (refelement ? refelement.__send__(name) : nil)
  }
end

#elementformdefaultObject



66
67
68
# File 'lib/wsdl/xmlSchema/group.rb', line 66

def elementformdefault
  parent.elementformdefault
end

#parse_attr(attr, value) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/wsdl/xmlSchema/group.rb', line 83

def parse_attr(attr, value)
  case attr
  when NameAttrName
    @name = XSD::QName.new(targetnamespace, value.source)
  when RefAttrName
    @ref = value
  when MaxOccursAttrName
    if parent.is_a?(All)
	if value.source != '1'
 raise Parser::AttributeConstraintError.new(
          "cannot parse #{value} for #{attr}")
	end
    end
    if value.source == 'unbounded'
      @maxoccurs = nil
    else
      @maxoccurs = Integer(value.source)
    end
    value.source
  when MinOccursAttrName
    if parent.is_a?(All)
	unless ['0', '1'].include?(value.source)
 raise Parser::AttributeConstraintError.new(
          "cannot parse #{value} for #{attr}")
	end
    end
    @minoccurs = Integer(value.source)
  else
    nil
  end
end

#parse_element(element) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/wsdl/xmlSchema/group.rb', line 70

def parse_element(element)
  case element
  when AllName
    @content = All.new
  when SequenceName
    @content = Sequence.new
  when ChoiceName
    @content = Choice.new
  else
    nil
  end
end

#refelementObject



58
59
60
# File 'lib/wsdl/xmlSchema/group.rb', line 58

def refelement
  @refelement ||= (@ref ? root.collect_modelgroups[@ref] : nil)
end

#targetnamespaceObject



62
63
64
# File 'lib/wsdl/xmlSchema/group.rb', line 62

def targetnamespace
  parent.targetnamespace
end