Class: WSDL::XMLSchema::Content

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

Direct Known Subclasses

All, Choice, Sequence

Instance Attribute Summary (collapse)

Attributes inherited from Info

#id, #parent, #root

Instance Method Summary (collapse)

Methods inherited from Info

#inspect, #parse_epilogue

Constructor Details

- (Content) initialize



21
22
23
24
25
26
# File 'lib/wsdl/xmlSchema/content.rb', line 21

def initialize
  super()
  @minoccurs = 1
  @maxoccurs = 1
  @elements = XSD::NamedElements.new
end

Instance Attribute Details

- (Object) elements (readonly)

Returns the value of attribute elements



19
20
21
# File 'lib/wsdl/xmlSchema/content.rb', line 19

def elements
  @elements
end

- (Object) maxoccurs (readonly)

Returns the value of attribute maxoccurs



18
19
20
# File 'lib/wsdl/xmlSchema/content.rb', line 18

def maxoccurs
  @maxoccurs
end

- (Object) minoccurs (readonly)

Returns the value of attribute minoccurs



17
18
19
# File 'lib/wsdl/xmlSchema/content.rb', line 17

def minoccurs
  @minoccurs
end

Instance Method Details

- (Object) <<(element)



60
61
62
# File 'lib/wsdl/xmlSchema/content.rb', line 60

def <<(element)
  @elements << element
end

- (Boolean) choice?



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

def choice?
  false
end

- (Object) elementformdefault



32
33
34
# File 'lib/wsdl/xmlSchema/content.rb', line 32

def elementformdefault
  parent.elementformdefault
end

- (Boolean) have_any?



36
37
38
# File 'lib/wsdl/xmlSchema/content.rb', line 36

def have_any?
  false
end

- (Boolean) map_as_array?



44
45
46
# File 'lib/wsdl/xmlSchema/content.rb', line 44

def map_as_array?
  maxoccurs.nil? or maxoccurs != 1
end

- (Object) nested_elements



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

def nested_elements
  elements = XSD::NamedElements.new
  @elements.each do |ele|
    if ele.respond_to?(:nested_elements)
      elements.concat(ele.nested_elements)
    else
      elements << ele
    end
  end
  elements
end

- (Object) parse_attr(attr, value)



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/wsdl/xmlSchema/content.rb', line 76

def parse_attr(attr, value)
  case attr
  when MaxOccursAttrName
    if value.source == 'unbounded'
      @maxoccurs = nil
    else
      @maxoccurs = Integer(value.source)
    end
    value.source
  when MinOccursAttrName
    @minoccurs = Integer(value.source)
  else
    nil
  end
end

- (Object) parse_element(element)



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/wsdl/xmlSchema/content.rb', line 64

def parse_element(element)
  case element
  when ElementName
    o = Element.new
    o.form = elementformdefault
    @elements << o
    o
  else
    nil
  end
end

- (Object) targetnamespace



28
29
30
# File 'lib/wsdl/xmlSchema/content.rb', line 28

def targetnamespace
  parent.targetnamespace
end