In Files

  • wsdl/soap/element.rb
  • wsdl/xmlSchema/element.rb

Class/Module Index [+]

Quicksearch

WSDL::XMLSchema::Element

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

new(name = nil, type = nil) click to toggle source
 
               # 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
            

Public Instance Methods

attr_reader_ref(symbol) click to toggle source
 
               # 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
            
attributes() click to toggle source
 
               # File wsdl/soap/element.rb, line 21
def attributes
  @local_complextype.attributes
end
            
elementform() click to toggle source
 
               # File wsdl/xmlSchema/element.rb, line 86
def elementform
  self.form.nil? ? parent.elementformdefault : self.form
end
            
elementformdefault() click to toggle source
 
               # File wsdl/xmlSchema/element.rb, line 82
def elementformdefault
  parent.elementformdefault
end
            
map_as_array?() click to toggle source
 
               # File wsdl/soap/element.rb, line 17
def map_as_array?
  maxoccurs != '1'
end
            
parse_attr(attr, value) click to toggle source
 
               # 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
            
parse_element(element) click to toggle source
 
               # 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
            
refelement() click to toggle source
 
               # File wsdl/xmlSchema/element.rb, line 74
def refelement
  @refelement ||= (@ref ? root.collect_elements[@ref] : nil)
end
            
targetnamespace() click to toggle source
 
               # File wsdl/xmlSchema/element.rb, line 78
def targetnamespace
  parent.targetnamespace
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 visit Documenting-ruby.org.

blog comments powered by Disqus