WSDL::XMLSchema::ComplexType (Class)

In: wsdl/xmlSchema/complexType.rb
wsdl/soap/complexType.rb
Parent: Info

Attributes

attributes  [R] 
complexcontent  [RW] 
content  [RW] 
final  [RW] 
mixed  [RW] 
name  [RW] 

Public Class methods

[Source]

# File wsdl/xmlSchema/complexType.rb, line 26
  def initialize(name = nil)
    super()
    @name = name
    @complexcontent = nil
    @content = nil
    @final = nil
    @mixed = false
    @attributes = XSD::NamedElements.new
  end

Public Instance methods

[Source]

# File wsdl/xmlSchema/complexType.rb, line 73
  def all_elements=(elements)
    @content = All.new
    elements.each do |element|
      @content << element
    end
  end

[Source]

# File wsdl/soap/complexType.rb, line 21
  def check_type
    if content
      if content.elements.size == 1 and content.elements[0].maxoccurs != 1
        :TYPE_ARRAY
      else
        :TYPE_STRUCT
      end
    elsif complexcontent and complexcontent.base == ::SOAP::ValueArrayName
      :TYPE_ARRAY
    else
      raise NotImplementedError.new("Unknown kind of complexType.")
    end
  end

[Source]

# File wsdl/soap/complexType.rb, line 50
  def child_defined_complextype(name)
    ele = nil
    case compoundtype
    when :TYPE_STRUCT
      unless ele = find_element(name)
        if name.namespace.nil?
          ele = find_element_by_name(name.name)
        end
      end
    when :TYPE_ARRAY
      if content.elements.size == 1
        ele = content.elements[0]
      else
        raise RuntimeError.new("Assert: must not reach.")
      end
    else
      raise RuntimeError.new("Assert: Not implemented.")
    end
    unless ele
      raise RuntimeError.new("Cannot find #{name} as a children of #{@name}.")
    end
    ele.local_complextype
  end

[Source]

# File wsdl/soap/complexType.rb, line 35
  def child_type(name = nil)
    case compoundtype
    when :TYPE_STRUCT
      if ele = find_element(name)
        ele.type
      elsif ele = find_element_by_name(name.name)
        ele.type
      else
        nil
      end
    when :TYPE_ARRAY
      @contenttype ||= content_arytype
    end
  end

[Source]

# File wsdl/soap/complexType.rb, line 17
  def compoundtype
    @compoundtype ||= check_type
  end

[Source]

# File wsdl/xmlSchema/complexType.rb, line 40
  def each_element
    if @content
      @content.elements.each do |element|
        yield(element.name, element)
      end
    end
  end

[Source]

# File wsdl/soap/complexType.rb, line 74
  def find_arytype
    unless compoundtype == :TYPE_ARRAY
      raise RuntimeError.new("Assert: not for array")
    end
    if complexcontent
      complexcontent.attributes.each do |attribute|
        if attribute.ref == ::SOAP::AttrArrayTypeName
          return attribute.arytype
        end
      end
    elsif content.elements.size == 1 and content.elements[0].maxoccurs != 1
      return content.elements[0].type
    else
      raise RuntimeError.new("Assert: Unknown array definition.")
    end
    nil
  end

[Source]

# File wsdl/xmlSchema/complexType.rb, line 48
  def find_element(name)
    if @content
      @content.elements.each do |element|
        return element if name == element.name
      end
    end
    nil
  end

[Source]

# File wsdl/xmlSchema/complexType.rb, line 57
  def find_element_by_name(name)
    if @content
      @content.elements.each do |element|
        return element if name == element.name.name
      end
    end
    nil
  end

[Source]

# File wsdl/xmlSchema/complexType.rb, line 103
  def parse_attr(attr, value)
    case attr
    when FinalAttrName
      @final = value
    when MixedAttrName
      @mixed = (value == 'true')
    when NameAttrName
      @name = XSD::QName.new(targetnamespace, value)
    else
      nil
    end
  end

[Source]

# File wsdl/xmlSchema/complexType.rb, line 80
  def parse_element(element)
    case element
    when AllName
      @content = All.new
      @content
    when SequenceName
      @content = Sequence.new
      @content
    when ChoiceName
      @content = Choice.new
      @content
    when ComplexContentName
      @complexcontent = ComplexContent.new
      @complexcontent
    when AttributeName
      o = Attribute.new
      @attributes << o
      o
    else
      nil
    end
  end

[Source]

# File wsdl/xmlSchema/complexType.rb, line 66
  def sequence_elements=(elements)
    @content = Sequence.new
    elements.each do |element|
      @content << element
    end
  end

[Source]

# File wsdl/xmlSchema/complexType.rb, line 36
  def targetnamespace
    parent.targetnamespace
  end

[Validate]