Class: WSDL::XMLSchema::ComplexContent

Inherits:
Info
  • Object
show all
Defined in:
lib/wsdl/xmlSchema/complexContent.rb

Instance Attribute Summary collapse

Attributes inherited from Info

#id, #parent, #root

Instance Method Summary collapse

Methods inherited from Info

#inspect, #parse_epilogue

Constructor Details

#initializeComplexContent

Returns a new instance of ComplexContent


23
24
25
26
27
28
29
30
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 23

def initialize
  super
  @base = nil
  @derivetype = nil
  @content = nil
  @attributes = XSD::NamedElements.new
  @basetype = nil
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes


21
22
23
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 21

def attributes
  @attributes
end

#baseObject

Returns the value of attribute base


18
19
20
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 18

def base
  @base
end

#contentObject (readonly)

Returns the value of attribute content


20
21
22
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 20

def content
  @content
end

#derivetypeObject (readonly)

Returns the value of attribute derivetype


19
20
21
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 19

def derivetype
  @derivetype
end

Instance Method Details

#basetypeObject


40
41
42
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 40

def basetype
  @basetype ||= root.collect_complextypes[@base]
end

#elementformdefaultObject


36
37
38
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 36

def elementformdefault
  parent.elementformdefault
end

#parse_attr(attr, value) ⇒ Object


77
78
79
80
81
82
83
84
85
86
87
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 77

def parse_attr(attr, value)
  if @derivetype.nil?
    return nil
  end
  case attr
  when BaseAttrName
    @base = value
  else
    nil
  end
end

#parse_element(element) ⇒ Object


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 44

def parse_element(element)
  case element
  when RestrictionName, ExtensionName
    @derivetype = element.name
    self
  when AllName
    if @derivetype.nil?
	raise Parser::ElementConstraintError.new("base attr not found.")
    end
    @content = All.new
    @content
  when SequenceName
    if @derivetype.nil?
	raise Parser::ElementConstraintError.new("base attr not found.")
    end
    @content = Sequence.new
    @content
  when ChoiceName
    if @derivetype.nil?
	raise Parser::ElementConstraintError.new("base attr not found.")
    end
    @content = Choice.new
    @content
  when AttributeName
    if @derivetype.nil?
	raise Parser::ElementConstraintError.new("base attr not found.")
    end
    o = Attribute.new
    @attributes << o
    o
  end
end

#targetnamespaceObject


32
33
34
# File 'lib/wsdl/xmlSchema/complexContent.rb', line 32

def targetnamespace
  parent.targetnamespace
end