Sha256: 77cea9597fd52f2cbbc0f9e0448039c44a7bbd8fabf9a937f824a66820821bb3

Contents?: true

Size: 1.58 KB

Versions: 35

Compression:

Stored size: 1.58 KB

Contents

# WSDL4R - XMLSchema simpleType 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 SimpleType < Info
  attr_accessor :name
  attr_reader :restriction
  attr_reader :list
  attr_reader :union

  def check_lexical_format(value)
    if @restriction
      check_restriction(value)
    elsif @list
      # TODO: check
    elsif @union
      # TODO: check
    else
      raise ArgumentError.new("incomplete simpleType")
    end
  end

  def base
    if @restriction
      @restriction.base
    else
      nil
    end
  end

  def initialize(name = nil)
    super()
    @name = name
    @restriction = nil
    @list = nil
    @union = nil
  end

  def targetnamespace
    parent.targetnamespace
  end

  def parse_element(element)
    case element
    when RestrictionName
      @restriction = SimpleRestriction.new
      @restriction
    when ListName
      @list = List.new
      @list
    when UnionName
      @union = Union.new
      @union
    end
  end

  def parse_attr(attr, value)
    case attr
    when NameAttrName
      @name = XSD::QName.new(targetnamespace, value.source)
    end
  end

private

  def check_restriction(value)
    unless @restriction.valid?(value)
      raise XSD::ValueSpaceError.new("#{@name}: cannot accept '#{value}'")
    end
  end
end


end
end

Version data entries

35 entries across 35 versions & 15 rubygems

Version Path
mumboe-soap4r-1.6.0.pre.beta lib/wsdl/xmlSchema/simpleType.rb
DefV-soap4r-1.5.8.2 lib/wsdl/xmlSchema/simpleType.rb
mumboe-soap4r-1.5.8.7 lib/wsdl/xmlSchema/simpleType.rb
soap2r-1.5.8 lib/wsdl/xmlSchema/simpleType.rb
teo-soap4r-1.5.9b lib/wsdl/xmlSchema/simpleType.rb
mumboe-soap4r-1.5.8.6 lib/wsdl/xmlSchema/simpleType.rb
soap4r-spox-1.6.0 lib/wsdl/xmlSchema/simpleType.rb
soap4r-r19-1.5.9 lib/wsdl/xmlSchema/simpleType.rb
mumboe-soap4r-1.5.8.5 lib/wsdl/xmlSchema/simpleType.rb
soap4r-ruby1.9-2.0.5 lib/wsdl/xmlSchema/simpleType.rb
soap4r-sgonyea-1.6.0 lib/wsdl/xmlSchema/simpleType.rb
soap4r-straightjacket-1.5.9 lib/wsdl/xmlSchema/simpleType.rb
soap4r-straightjacket-1.5.8 lib/wsdl/xmlSchema/simpleType.rb
soap4r-ruby1.9-2.0.3 lib/wsdl/xmlSchema/simpleType.rb
soap4r-ruby1.9-2.0.2 lib/wsdl/xmlSchema/simpleType.rb
soap4r-ruby1.9-2.0.1 lib/wsdl/xmlSchema/simpleType.rb
mumboe-soap4r-1.5.8.4 lib/wsdl/xmlSchema/simpleType.rb
railsware-soap4r-1.5.8.1 lib/wsdl/xmlSchema/simpleType.rb
soap4r-ruby1.9-2.0.0 lib/wsdl/xmlSchema/simpleType.rb
hands-soap4r-1.5.8.4 lib/wsdl/xmlSchema/simpleType.rb