Sha256: b100e997029ea21c3c9e6ed477ae32eae2a527aadfac483517f1250ce610a5fc

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

# WSDL4R - XMLSchema complexContent definition for WSDL.
# Copyright (C) 2000-2007  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.

# This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version.


require 'wsdl/info'
require 'xsd/namedelements'


module WSDL
module XMLSchema


class ComplexContent < Info
  attr_accessor :restriction
  attr_accessor :extension
  attr_accessor :mixed

  def initialize
    super
    @restriction = nil
    @extension = nil
    @mixed = false
  end

  def targetnamespace
    parent.targetnamespace
  end

  def elementformdefault
    parent.elementformdefault
  end

  def content
    @extension || @restriction
  end

  def base
    content ? content.base : nil
  end

  def have_any?
    content ? content.have_any? : nil
  end

  def choice?
    content ? content.choice? : nil
  end

  def elements
    content ? content.elements : XSD::NamedElements::Empty
  end

  def attributes
    content ? content.attributes : XSD::NamedElements::Empty
  end

  def nested_elements
    # restrict and extension does not have particle.
    content ? content.nested_elements : XSD::NamedElements::Empty
  end

  def check_type
    if content
      content.check_type
    else
      raise ArgumentError.new("incomplete complexContent")
    end
  end

  def parse_element(element)
    case element
    when RestrictionName
      raise ArgumentError.new("incomplete complexContent") if content
      @restriction = ComplexRestriction.new
    when ExtensionName
      raise ArgumentError.new("incomplete complexContent") if content
      @extension = ComplexExtension.new
    end
  end

  def parse_attr(attr, value)
    case attr
    when MixedAttrName
      @mixed = (value.source == 'true')
    else
      nil
    end
  end
end


end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
soap4r-1.5.6 lib/wsdl/xmlSchema/complexContent.rb
soap4r-1.5.7 lib/wsdl/xmlSchema/complexContent.rb