0
|
1 |
"{ Package: 'stx:goodies/xmlsuite/relaxng' }"
|
|
2 |
|
|
3 |
"{ NameSpace: RNG }"
|
|
4 |
|
|
5 |
Pattern subclass:#ComplexTypePattern
|
|
6 |
instanceVariableNames:'name automaton isAttribute'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Relax NG-Patterns'
|
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!ComplexTypePattern methodsFor:'accessing'!
|
|
14 |
|
|
15 |
contentModelAutomaton
|
|
16 |
|
|
17 |
automaton ifNil:[
|
|
18 |
automaton := Automaton new initializeFor:self.
|
|
19 |
].
|
|
20 |
^automaton
|
|
21 |
|
|
22 |
"Created: / 01-05-2005 / 16:10:45 / janfrog"
|
|
23 |
"Modified: / 14-05-2005 / 22:30:23 / janfrog"
|
|
24 |
!
|
|
25 |
|
|
26 |
isForAttribute:aBoolean
|
|
27 |
isAttribute := aBoolean.
|
|
28 |
|
|
29 |
"Created: / 01-05-2005 / 12:40:46 / janfrog"
|
|
30 |
!
|
|
31 |
|
|
32 |
localName
|
|
33 |
|
|
34 |
^(self name tokensBasedOn:$#) last
|
|
35 |
|
|
36 |
"Created: / 02-05-2005 / 16:56:58 / janfrog"
|
|
37 |
!
|
|
38 |
|
|
39 |
name
|
|
40 |
^ name
|
|
41 |
|
|
42 |
"Created: / 30-04-2005 / 14:37:56 / janfrog"
|
|
43 |
!
|
|
44 |
|
|
45 |
name:aString
|
|
46 |
|
|
47 |
"aString must be expaned tag name, i.e a string in
|
|
48 |
form <namespace>#<localName>"
|
|
49 |
|
|
50 |
name := aString.
|
|
51 |
|
|
52 |
"Created: / 30-04-2005 / 14:38:04 / janfrog"
|
|
53 |
!
|
|
54 |
|
|
55 |
namespace
|
|
56 |
|
|
57 |
^(self name includes:$#)
|
|
58 |
ifTrue:[(self name readStream upTo:$#)]
|
|
59 |
ifFalse:[''].
|
|
60 |
|
|
61 |
"Created: / 02-05-2005 / 16:57:40 / janfrog"
|
|
62 |
"Modified: / 06-05-2005 / 12:22:27 / janfrog"
|
|
63 |
!
|
|
64 |
|
|
65 |
pcDataContentPattern
|
|
66 |
|
|
67 |
^node pcDataContentPattern
|
|
68 |
|
|
69 |
"Created: / 02-05-2005 / 17:26:31 / janfrog"
|
|
70 |
! !
|
|
71 |
|
|
72 |
!ComplexTypePattern methodsFor:'initialization'!
|
|
73 |
|
|
74 |
postParseFor:aSchema
|
|
75 |
|
|
76 |
"automaton := Automaton new initializeFor:self."
|
|
77 |
|
|
78 |
"Created: / 14-05-2005 / 21:20:41 / janfrog"
|
|
79 |
"Modified: / 16-05-2005 / 09:30:17 / masca"
|
|
80 |
!
|
|
81 |
|
|
82 |
setNamespace:ns localName:localName
|
|
83 |
|
|
84 |
"must convert ns and localName into expanded name form"
|
|
85 |
|
|
86 |
name := ns isNilOrEmptyCollection ifFalse:[ns , '#' , localName] ifTrue:[localName]
|
|
87 |
|
|
88 |
"Created: / 30-04-2005 / 14:49:05 / janfrog"
|
|
89 |
"Modified: / 14-05-2005 / 11:36:35 / janfrog"
|
|
90 |
! !
|
|
91 |
|
|
92 |
!ComplexTypePattern methodsFor:'printing'!
|
|
93 |
|
|
94 |
nameForPrint
|
|
95 |
|
|
96 |
^((self isForAttribute) ifTrue:['@'] ifFalse:['']) ,self name
|
|
97 |
|
|
98 |
"Created: / 30-04-2005 / 17:41:33 / janfrog"
|
|
99 |
"Modified: / 01-05-2005 / 12:40:26 / janfrog"
|
|
100 |
!
|
|
101 |
|
|
102 |
printOn:aStream
|
|
103 |
|
|
104 |
aStream nextPutAll:self name.
|
|
105 |
aStream space; nextPut:$< ; space.
|
|
106 |
self node printChildrenOn:aStream.
|
|
107 |
aStream space; nextPut:$> ; space;
|
|
108 |
cr; cr; nextPutAll:'Content model automaton' ; cr.
|
|
109 |
self contentModelAutomaton printOn:aStream
|
|
110 |
|
|
111 |
"Created: / 30-04-2005 / 17:42:58 / janfrog"
|
|
112 |
"Modified: / 02-05-2005 / 14:28:17 / janfrog"
|
|
113 |
! !
|
|
114 |
|
|
115 |
!ComplexTypePattern methodsFor:'queries'!
|
|
116 |
|
|
117 |
hasComplexContentModel
|
|
118 |
|
|
119 |
^(self node children size > 2) or:
|
|
120 |
[(self node firstChild isPatternNode and:[self node firstChild pattern isPCDataPattern]) not]
|
|
121 |
|
|
122 |
"Created: / 16-05-2005 / 16:32:37 / masca"
|
|
123 |
! !
|
|
124 |
|
|
125 |
!ComplexTypePattern methodsFor:'testing'!
|
|
126 |
|
|
127 |
hasBinding
|
|
128 |
^self bindingInfo hasBinding
|
|
129 |
|
|
130 |
"Created: / 02-05-2005 / 16:55:23 / janfrog"
|
|
131 |
!
|
|
132 |
|
|
133 |
isComplexTypePattern
|
|
134 |
^ true
|
|
135 |
|
|
136 |
"Created: / 14-05-2005 / 20:34:31 / janfrog"
|
|
137 |
!
|
|
138 |
|
|
139 |
isForAttribute
|
|
140 |
^ isAttribute ? false
|
|
141 |
|
|
142 |
"Created: / 01-05-2005 / 12:40:42 / janfrog"
|
|
143 |
! !
|
|
144 |
|
|
145 |
!ComplexTypePattern methodsFor:'validation/binding'!
|
|
146 |
|
|
147 |
newBinderContext
|
|
148 |
|
|
149 |
^ValidatorContext for:self
|
|
150 |
|
|
151 |
"Created: / 02-05-2005 / 14:55:46 / janfrog"
|
|
152 |
"Modified: / 02-05-2005 / 16:17:58 / janfrog"
|
|
153 |
!
|
|
154 |
|
|
155 |
newValidatorContext
|
|
156 |
|
|
157 |
^ValidatorContext for:self
|
|
158 |
|
|
159 |
"Created: / 01-05-2005 / 16:15:29 / janfrog"
|
|
160 |
! !
|
|
161 |
|
|
162 |
!ComplexTypePattern class methodsFor:'documentation'!
|
|
163 |
|
|
164 |
version
|
|
165 |
^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/relaxng/RNG__ComplexTypePattern.st,v 1.1.1.1 2005-11-01 22:07:12 vranyj1 Exp $'
|
|
166 |
! !
|