# File wsdl/xmlSchema/element.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
# File wsdl/xmlSchema/element.rb, line 60
def initialize(name = nil, type = nil)
super()
@name = name
@form = nil
@type = type
@local_simpletype = @local_complextype = nil
@constraint = nil
@maxoccurs = '1'
@minoccurs = '1'
@nillable = nil
@ref = nil
@refelement = nil
end
# File wsdl/soap/element.rb, line 21
def attributes
@local_complextype.attributes
end
# File wsdl/xmlSchema/element.rb, line 86
def elementform
self.form.nil? ? parent.elementformdefault : self.form
end
# File wsdl/xmlSchema/element.rb, line 82
def elementformdefault
parent.elementformdefault
end
# File wsdl/soap/element.rb, line 17
def map_as_array?
maxoccurs != '1'
end
# File wsdl/xmlSchema/element.rb, line 107
def parse_attr(attr, value)
case attr
when NameAttrName
# namespace may be nil
if directelement? or elementform == 'qualified'
@name = XSD::QName.new(targetnamespace, value.source)
else
@name = XSD::QName.new(nil, value.source)
end
when FormAttrName
@form = value.source
when TypeAttrName
@type = value
when RefAttrName
@ref = value
when MaxOccursAttrName
if parent.is_a?(All)
if value.source != '1'
raise Parser::AttrConstraintError.new(
"cannot parse #{value} for #{attr}")
end
end
@maxoccurs = value.source
when MinOccursAttrName
if parent.is_a?(All)
unless ['0', '1'].include?(value.source)
raise Parser::AttrConstraintError.new(
"cannot parse #{value} for #{attr}")
end
end
@minoccurs = value.source
when NillableAttrName
@nillable = (value.source == 'true')
else
nil
end
end
# File wsdl/xmlSchema/element.rb, line 90
def parse_element(element)
case element
when SimpleTypeName
@local_simpletype = SimpleType.new
@local_simpletype
when ComplexTypeName
@type = nil
@local_complextype = ComplexType.new
@local_complextype
when UniqueName
@constraint = Unique.new
@constraint
else
nil
end
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.