Class: SOAP::XSD

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/wsdl-reader/xsd.rb,
lib/wsdl-reader/xsd/convert.rb,
lib/wsdl-reader/xsd/element.rb,
lib/wsdl-reader/xsd/sequence.rb,
lib/wsdl-reader/xsd/simpletype.rb,
lib/wsdl-reader/xsd/complextype.rb,
lib/wsdl-reader/xsd/enumeration.rb,
lib/wsdl-reader/xsd/restriction.rb

Defined Under Namespace

Classes: ComplexType, Convert, Element, Enumeration, Restriction, Sequence, SimpleType

Constant Summary collapse

ANY_SIMPLE_TYPE =
%w(duration dateTime time date gYearMonth gYear gMonthDay gDay gMonth 
boolean base64Binary hexBinary float double anyURI QName NOTATION string normalizedString 
token language Name NMTOKEN NCName NMTOKENS ID IDREF ENTITY IDREFS ENTITIES
decimal integer nonPositiveInteger long nonNegativeInteger negativeInteger int unsignedLong positiveInteger
short unsignedInt byte unsignedShort unsignedByte)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeXSD

Returns a new instance of XSD.



25
26
27
28
29
30
# File 'lib/wsdl-reader/xsd.rb', line 25

def initialize()
  @elements = Hash.new
  @simpleTypes = Hash.new
  @complexTypes = Hash.new
  @types = Hash.new
end

Instance Attribute Details

#complexTypeObject (readonly)

Returns the value of attribute complexType.



17
18
19
# File 'lib/wsdl-reader/xsd.rb', line 17

def complexType
  @complexType
end

#elementsObject (readonly)

Returns the value of attribute elements.



15
16
17
# File 'lib/wsdl-reader/xsd.rb', line 15

def elements
  @elements
end

#simpleTypesObject (readonly)

Returns the value of attribute simpleTypes.



16
17
18
# File 'lib/wsdl-reader/xsd.rb', line 16

def simpleTypes
  @simpleTypes
end

Class Method Details

.displayBuiltinType(name, args, min = 1, max = 1) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/wsdl-reader/xsd.rb', line 53

def self.displayBuiltinType(name, args, min = 1, max = 1)
  r = ""

  if args.keys.include?(name.to_sym)
    args[name.to_sym] = [args[name.to_sym]] unless args[name.to_sym].class == Array
    if args[name.to_sym].size < min or args[name.to_sym].size > max
      raise SOAP::LCArgumentError, "Wrong number or values for parameter `#{name}'"
    end
    args[name.to_sym].each { |v|
      r << "<#{name}>#{v}</#{name}>\n"
    }
  elsif min > 0
    raise SOAP::LCArgumentError, "Missing parameter `#{name}'" if min > 0
  end

  return r
end

Instance Method Details

#<=>(other) ⇒ Object



32
33
34
# File 'lib/wsdl-reader/xsd.rb', line 32

def <=>(other)
  @types <=> other.instance_variable_get(:@types)
end

#[](name) ⇒ Object



49
50
51
# File 'lib/wsdl-reader/xsd.rb', line 49

def [](name)
  @types[name]
end

#add_schema(types) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/wsdl-reader/xsd.rb', line 36

def add_schema(types)
  # Process all schema
  types.children.find_all { |e| e.class == REXML::Element }.each { |schema|
    schema.find_all { |e| e.class == REXML::Element }.each { |type|
      processType type
    }
  }
end

#any_defined_typeObject



45
46
47
# File 'lib/wsdl-reader/xsd.rb', line 45

def any_defined_type
  @types.keys
end