class WSDL::XMLSchema::Element
Attributes
constraint[W]
form[W]
local_complextype[W]
local_simpletype[W]
maxoccurs[RW]
minoccurs[RW]
name[W]
nillable[W]
type[W]
Public Class Methods
new(name = nil, type = nil)
click to toggle source
Calls superclass method
WSDL::Info::new
# File lib/wsdl/xmlSchema/element.rb, line 40 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 @default = nil @abstract = false @ref = nil @refelement = nil end
Public Instance Methods
anonymous_type?()
click to toggle source
# File lib/wsdl/soap/element.rb, line 22 def anonymous_type? !@ref and @name and @local_complextype end
attributes()
click to toggle source
# File lib/wsdl/soap/element.rb, line 26 def attributes @local_complextype.attributes end
elementform()
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 68 def elementform self.form.nil? ? parent.elementformdefault : self.form end
elementformdefault()
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 64 def elementformdefault parent.elementformdefault end
empty?()
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 56 def empty? !(local_simpletype || local_complextype || constraint || type) end
map_as_array?()
click to toggle source
# File lib/wsdl/soap/element.rb, line 17 def map_as_array? # parent sequence / choice may be marked as maxOccurs="unbounded" maxoccurs.nil? or maxoccurs != 1 or (parent and parent.map_as_array?) end
parse_attr(attr, value)
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 89 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 if @form != 'qualified' and @name.namespace @name = XSD::QName.new(nil, @name.name) end @form when TypeAttrName @type = value 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) when NillableAttrName @nillable = to_boolean(value) when DefaultAttrName @default = value.source when AbstractAttrName @abstract = to_boolean(value) else nil end end
parse_element(element)
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 72 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
targetnamespace()
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 60 def targetnamespace parent.targetnamespace end
Private Instance Methods
directelement?()
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 142 def directelement? parent.is_a?(Schema) end
refelement()
click to toggle source
# File lib/wsdl/xmlSchema/element.rb, line 146 def refelement @refelement ||= (@ref ? root.collect_elements[@ref] : nil) end