Class: SOAP::XSD

Inherits:
Object
  • Object
show all
Defined in:
lib/soap/lc/xsd.rb,
lib/soap/lc/xsd/convert.rb,
lib/soap/lc/xsd/element.rb,
lib/soap/lc/xsd/sequence.rb,
lib/soap/lc/xsd/simpletype.rb,
lib/soap/lc/xsd/complextype.rb,
lib/soap/lc/xsd/enumeration.rb,
lib/soap/lc/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.



24
25
26
27
28
29
# File 'lib/soap/lc/xsd.rb', line 24

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.



16
17
18
# File 'lib/soap/lc/xsd.rb', line 16

def complexType
  @complexType
end

#elementsObject (readonly)

Returns the value of attribute elements.



14
15
16
# File 'lib/soap/lc/xsd.rb', line 14

def elements
  @elements
end

#simpleTypesObject (readonly)

Returns the value of attribute simpleTypes.



15
16
17
# File 'lib/soap/lc/xsd.rb', line 15

def simpleTypes
  @simpleTypes
end

Class Method Details

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



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/soap/lc/xsd.rb', line 48

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

#[](name) ⇒ Object



44
45
46
# File 'lib/soap/lc/xsd.rb', line 44

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

#add_schema(types) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/soap/lc/xsd.rb', line 31

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



40
41
42
# File 'lib/soap/lc/xsd.rb', line 40

def any_defined_type
  @types.keys
end