Class: WSDL::XMLSchema::Element

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

### Methods

attr_reader_ref attr_reader_ref attributes elementform elementformdefault map_as_array? new parse_attr parse_element refelement targetnamespace

### 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

attr_reader_ref(symbol)

[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

attr_reader_ref(symbol)

[Source]

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

new(name = nil, type = nil)

[Source]

    # File wsdl/xmlSchema/element.rb, line 61
      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

attributes()

[Source]

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

elementform()

[Source]

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

elementformdefault()

[Source]

    # File wsdl/xmlSchema/element.rb, line 83
      def elementformdefault
        parent.elementformdefault
      end

map_as_array?()

[Source]

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

parse_attr(attr, value)

[Source]

    # File wsdl/xmlSchema/element.rb, line 108
      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)

[Source]

    # File wsdl/xmlSchema/element.rb, line 91
      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()

[Source]

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

targetnamespace()

[Source]

    # File wsdl/xmlSchema/element.rb, line 79
      def targetnamespace
        parent.targetnamespace
      end

[Validate]