Line | |
---|
1 | # WSDL4R - XMLSchema complexContent definition for WSDL.
|
---|
2 | # Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <[email protected]>.
|
---|
3 |
|
---|
4 | # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
---|
5 | # redistribute it and/or modify it under the same terms of Ruby's license;
|
---|
6 | # either the dual license version in 2003, or any later version.
|
---|
7 |
|
---|
8 |
|
---|
9 | require 'wsdl/info'
|
---|
10 | require 'xsd/namedelements'
|
---|
11 |
|
---|
12 |
|
---|
13 | module WSDL
|
---|
14 | module XMLSchema
|
---|
15 |
|
---|
16 |
|
---|
17 | class ComplexContent < Info
|
---|
18 | attr_accessor :base
|
---|
19 | attr_reader :derivetype
|
---|
20 | attr_reader :content
|
---|
21 | attr_reader :attributes
|
---|
22 |
|
---|
23 | def initialize
|
---|
24 | super
|
---|
25 | @base = nil
|
---|
26 | @derivetype = nil
|
---|
27 | @content = nil
|
---|
28 | @attributes = XSD::NamedElements.new
|
---|
29 | @basetype = nil
|
---|
30 | end
|
---|
31 |
|
---|
32 | def targetnamespace
|
---|
33 | parent.targetnamespace
|
---|
34 | end
|
---|
35 |
|
---|
36 | def elementformdefault
|
---|
37 | parent.elementformdefault
|
---|
38 | end
|
---|
39 |
|
---|
40 | def basetype
|
---|
41 | @basetype ||= root.collect_complextypes[@base]
|
---|
42 | end
|
---|
43 |
|
---|
44 | def parse_element(element)
|
---|
45 | case element
|
---|
46 | when RestrictionName, ExtensionName
|
---|
47 | @derivetype = element.name
|
---|
48 | self
|
---|
49 | when AllName
|
---|
50 | if @derivetype.nil?
|
---|
51 | raise Parser::ElementConstraintError.new("base attr not found.")
|
---|
52 | end
|
---|
53 | @content = All.new
|
---|
54 | @content
|
---|
55 | when SequenceName
|
---|
56 | if @derivetype.nil?
|
---|
57 | raise Parser::ElementConstraintError.new("base attr not found.")
|
---|
58 | end
|
---|
59 | @content = Sequence.new
|
---|
60 | @content
|
---|
61 | when ChoiceName
|
---|
62 | if @derivetype.nil?
|
---|
63 | raise Parser::ElementConstraintError.new("base attr not found.")
|
---|
64 | end
|
---|
65 | @content = Choice.new
|
---|
66 | @content
|
---|
67 | when AttributeName
|
---|
68 | if @derivetype.nil?
|
---|
69 | raise Parser::ElementConstraintError.new("base attr not found.")
|
---|
70 | end
|
---|
71 | o = Attribute.new
|
---|
72 | @attributes << o
|
---|
73 | o
|
---|
74 | end
|
---|
75 | end
|
---|
76 |
|
---|
77 | def parse_attr(attr, value)
|
---|
78 | if @derivetype.nil?
|
---|
79 | return nil
|
---|
80 | end
|
---|
81 | case attr
|
---|
82 | when BaseAttrName
|
---|
83 | @base = value
|
---|
84 | else
|
---|
85 | nil
|
---|
86 | end
|
---|
87 | end
|
---|
88 | end
|
---|
89 |
|
---|
90 |
|
---|
91 | end
|
---|
92 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.