Class WSDL::XMLSchema::Element
In: lib/wsdl/xmlSchema/element.rb
lib/wsdl/soap/element.rb
Parent: Info

Methods

Attributes

constraint  [W] 
form  [W] 
local_complextype  [W] 
local_simpletype  [W] 
maxoccurs  [W] 
minoccurs  [W] 
name  [W] 
nillable  [W] 
ref  [RW] 
type  [W] 

Public Class methods

[Source]

    # File lib/wsdl/xmlSchema/element.rb, line 19
19:       def attr_reader_ref(symbol)
20:         name = symbol.to_s
21:         define_method(name) {
22:           instance_variable_get("@#{name}") ||
23:             (refelement ? refelement.__send__(name) : nil)
24:         }
25:       end

[Source]

    # File lib/wsdl/xmlSchema/element.rb, line 27
27:       def attr_reader_ref(symbol)
28:         name = symbol.to_s
29:         module_eval "def \#{name}\n@\#{name} || (refelement ? refelement.\#{name} : nil)\nend\n"
30:       end

[Source]

    # File lib/wsdl/xmlSchema/element.rb, line 61
61:   def initialize(name = nil, type = nil)
62:     super()
63:     @name = name
64:     @form = nil
65:     @type = type
66:     @local_simpletype = @local_complextype = nil
67:     @constraint = nil
68:     @maxoccurs = '1'
69:     @minoccurs = '1'
70:     @nillable = nil
71:     @ref = nil
72:     @refelement = nil
73:   end

Public Instance methods

[Source]

    # File lib/wsdl/soap/element.rb, line 21
21:   def attributes
22:     @local_complextype.attributes
23:   end

[Source]

    # File lib/wsdl/xmlSchema/element.rb, line 87
87:   def elementform
88:     self.form.nil? ? parent.elementformdefault : self.form
89:   end

[Source]

    # File lib/wsdl/xmlSchema/element.rb, line 83
83:   def elementformdefault
84:     parent.elementformdefault
85:   end

[Source]

    # File lib/wsdl/soap/element.rb, line 17
17:   def map_as_array?
18:     maxoccurs != '1'
19:   end

[Source]

     # File lib/wsdl/xmlSchema/element.rb, line 108
108:   def parse_attr(attr, value)
109:     case attr
110:     when NameAttrName
111:       # namespace may be nil
112:       if directelement? or elementform == 'qualified'
113:         @name = XSD::QName.new(targetnamespace, value.source)
114:       else
115:         @name = XSD::QName.new(nil, value.source)
116:       end
117:     when FormAttrName
118:       @form = value.source
119:     when TypeAttrName
120:       @type = value
121:     when RefAttrName
122:       @ref = value
123:     when MaxOccursAttrName
124:       if parent.is_a?(All)
125:         if value.source != '1'
126:           raise Parser::AttrConstraintError.new(
127:             "cannot parse #{value} for #{attr}")
128:         end
129:       end
130:       @maxoccurs = value.source
131:     when MinOccursAttrName
132:       if parent.is_a?(All)
133:         unless ['0', '1'].include?(value.source)
134:           raise Parser::AttrConstraintError.new(
135:             "cannot parse #{value} for #{attr}")
136:         end
137:       end
138:       @minoccurs = value.source
139:     when NillableAttrName
140:       @nillable = (value.source == 'true')
141:     else
142:       nil
143:     end
144:   end

[Source]

     # File lib/wsdl/xmlSchema/element.rb, line 91
 91:   def parse_element(element)
 92:     case element
 93:     when SimpleTypeName
 94:       @local_simpletype = SimpleType.new
 95:       @local_simpletype
 96:     when ComplexTypeName
 97:       @type = nil
 98:       @local_complextype = ComplexType.new
 99:       @local_complextype
100:     when UniqueName
101:       @constraint = Unique.new
102:       @constraint
103:     else
104:       nil
105:     end
106:   end

[Source]

    # File lib/wsdl/xmlSchema/element.rb, line 75
75:   def refelement
76:     @refelement ||= (@ref ? root.collect_elements[@ref] : nil)
77:   end

[Source]

    # File lib/wsdl/xmlSchema/element.rb, line 79
79:   def targetnamespace
80:     parent.targetnamespace
81:   end

Private Instance methods

[Source]

     # File lib/wsdl/xmlSchema/element.rb, line 148
148:   def directelement?
149:     parent.is_a?(Schema)
150:   end

[Validate]