author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 10 Apr 2008 09:14:47 +0000 | |
changeset 3 | 7909b6680107 |
parent 2 | 06f508a6f55c |
child 174 | 76f50ac2e6a0 |
permissions | -rw-r--r-- |
3
7909b6680107
Loaded into & commited from 5.3.6
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
1 |
"{ Package: 'stx:goodies/xmlsuite/core' }" |
0 | 2 |
|
3 |
"{ NameSpace: XMLv2 }" |
|
4 |
||
5 |
Node subclass:#Attr |
|
6 |
instanceVariableNames:'nodeName children isId specified' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'XML Suite-DOM3' |
|
10 |
! |
|
11 |
||
12 |
||
13 |
!Attr class methodsFor:'instance creation'! |
|
14 |
||
15 |
fromCincomAttribute: anAttribute |
|
16 |
||
17 |
^self new |
|
18 |
setNodeName:(NodeName fromCincomNodeTag: anAttribute tag); |
|
19 |
value: anAttribute value |
|
20 |
||
21 |
"Created: / 21-12-2005 / 17:36:25 / janfrog" |
|
22 |
! |
|
23 |
||
24 |
named:aNodeName value:aString |
|
25 |
||
26 |
^self new |
|
27 |
setNodeName:aNodeName; |
|
28 |
nodeValue:aString; |
|
29 |
yourself |
|
30 |
||
31 |
"Created: / 05-08-2005 / 13:33:37 / janfrog" |
|
32 |
! ! |
|
33 |
||
34 |
!Attr methodsFor:'DOM3 helpers'! |
|
35 |
||
36 |
computeLookupPrefix:arg |
|
37 |
"Superclass says that I am responsible to implement this method" |
|
38 |
||
39 |
self shouldImplement |
|
40 |
||
41 |
"Created: / 18-06-2005 / 21:13:11 / janfrog" |
|
42 |
! |
|
43 |
||
44 |
postAdoptedBy:aDocument |
|
45 |
||
46 |
super postAdoptedBy: aDocument. |
|
47 |
||
48 |
parent := nil. |
|
49 |
specified := true. |
|
50 |
||
51 |
self childNodes do:[:child| |
|
52 |
aDocument recursivelyAdoptNode: child. |
|
53 |
child setParentNode:self |
|
54 |
] |
|
55 |
||
56 |
"Created: / 25-12-2005 / 10:15:19 / janfrog" |
|
57 |
! |
|
58 |
||
59 |
postImportBy:aDocument deep:aBoolean |
|
60 |
nodeName := nodeName deepCopy. |
|
61 |
parent := nil. |
|
62 |
specified := true. |
|
63 |
isId := false. |
|
64 |
children := children |
|
65 |
collect:[:child | |
|
66 |
(aDocument importNode:child deep:true) |
|
67 |
setParentNode:self; |
|
68 |
yourself |
|
69 |
] |
|
70 |
||
71 |
"Created: / 25-12-2005 / 11:01:36 / janfrog" |
|
72 |
"Modified: / 28-12-2005 / 16:18:05 / janfrog" |
|
73 |
! |
|
74 |
||
75 |
recusivelyAdoptedBy:aDocument |
|
76 |
||
77 |
"nothing to do" |
|
78 |
||
79 |
"Created: / 19-06-2005 / 13:49:41 / janfrog" |
|
80 |
! |
|
81 |
||
82 |
removeFromParentChildren |
|
83 |
||
84 |
self parent ifNotNil:[ |
|
85 |
self parent removeAttributeNode:self |
|
86 |
] |
|
87 |
||
88 |
"Created: / 19-06-2005 / 13:28:41 / janfrog" |
|
89 |
! |
|
90 |
||
91 |
textContentOn:aStream |
|
92 |
"Superclass says that I am responsible to implement this method" |
|
93 |
||
94 |
self childNodes do:[:node|node textContentOn:aStream] |
|
95 |
||
96 |
"Created: / 18-06-2005 / 20:18:16 / janfrog" |
|
97 |
"Modified: / 18-10-2005 / 14:52:43 / janfrog" |
|
98 |
! ! |
|
99 |
||
100 |
!Attr methodsFor:'DOM3 interface'! |
|
101 |
||
102 |
childNodes |
|
103 |
||
104 |
^children |
|
105 |
||
106 |
"Created: / 17-06-2005 / 11:54:04 / janfrog" |
|
107 |
"Modified: / 17-06-2005 / 14:03:17 / janfrog" |
|
108 |
! |
|
109 |
||
110 |
compareDocumentPosition:arg |
|
111 |
"Superclass says that I am responsible to implement this method" |
|
112 |
||
113 |
self shouldImplement |
|
114 |
||
115 |
"Created: / 18-06-2005 / 20:18:16 / janfrog" |
|
116 |
! |
|
117 |
||
118 |
isId |
|
119 |
||
120 |
^ isId ? false |
|
121 |
||
122 |
"Modified: / 25-11-2005 / 12:32:20 / janfrog" |
|
123 |
! |
|
124 |
||
125 |
localName |
|
126 |
||
127 |
^nodeName localName |
|
128 |
||
129 |
"Created: / 17-06-2005 / 11:52:58 / janfrog" |
|
130 |
! |
|
131 |
||
132 |
lookupNamespaceURI:arg |
|
133 |
"Superclass says that I am responsible to implement this method" |
|
134 |
||
135 |
self shouldImplement |
|
136 |
||
137 |
"Created: / 18-06-2005 / 20:18:16 / janfrog" |
|
138 |
! |
|
139 |
||
140 |
name |
|
141 |
^ nodeName qualifiedName |
|
142 |
||
143 |
"Modified: / 19-06-2005 / 13:42:23 / janfrog" |
|
144 |
! |
|
145 |
||
146 |
namespaceURI |
|
147 |
||
148 |
^nodeName ns |
|
149 |
||
150 |
"Created: / 17-06-2005 / 11:52:12 / janfrog" |
|
151 |
! |
|
152 |
||
153 |
nodeName |
|
154 |
^ self name |
|
155 |
||
156 |
"Created: / 17-06-2005 / 11:25:15 / janfrog" |
|
157 |
! |
|
158 |
||
159 |
nodeType |
|
160 |
||
161 |
^Node ATTRIBUTE_NODE |
|
162 |
||
163 |
"Created: / 17-06-2005 / 11:42:41 / janfrog" |
|
164 |
! |
|
165 |
||
166 |
nodeValue |
|
167 |
||
168 |
^self value |
|
169 |
||
170 |
"Created: / 17-06-2005 / 11:35:37 / janfrog" |
|
171 |
! |
|
172 |
||
173 |
nodeValue:value |
|
174 |
||
175 |
^self value:value |
|
176 |
||
177 |
"Created: / 17-06-2005 / 12:07:16 / janfrog" |
|
178 |
! |
|
179 |
||
180 |
normalize |
|
181 |
"Superclass says that I am responsible to implement this method" |
|
182 |
||
183 |
self shouldImplement |
|
184 |
||
185 |
"Created: / 18-06-2005 / 20:18:16 / janfrog" |
|
186 |
! |
|
187 |
||
188 |
ownerElement |
|
189 |
||
190 |
^self parent |
|
191 |
||
192 |
"Created: / 19-06-2005 / 13:43:01 / janfrog" |
|
193 |
! |
|
194 |
||
195 |
parentNode |
|
196 |
||
197 |
^self domError:'Attributes has no parents' code:#NOT_SUPPORTED_ERR |
|
198 |
||
199 |
"Modified: / 17-06-2005 / 12:04:05 / janfrog" |
|
200 |
! |
|
201 |
||
202 |
prefix |
|
203 |
||
204 |
^nodeName prefix |
|
205 |
||
206 |
"Created: / 17-06-2005 / 12:10:08 / janfrog" |
|
207 |
"Modified: / 28-06-2005 / 23:35:55 / janfrog" |
|
208 |
! |
|
209 |
||
210 |
schemaTypeInfo |
|
211 |
||
212 |
^TypeInfo new |
|
213 |
||
214 |
"Created: / 15-11-2005 / 10:53:29 / janfrog" |
|
215 |
"Modified: / 24-12-2005 / 11:11:46 / janfrog" |
|
216 |
! |
|
217 |
||
218 |
specified |
|
219 |
||
220 |
^specified ? true |
|
221 |
||
222 |
"Modified: / 24-12-2005 / 13:42:55 / janfrog" |
|
223 |
! |
|
224 |
||
225 |
specified:aBoolean |
|
226 |
||
227 |
specified := aBoolean |
|
228 |
||
229 |
"Created: / 19-06-2005 / 13:45:31 / janfrog" |
|
230 |
"Modified: / 24-12-2005 / 13:43:08 / janfrog" |
|
231 |
! |
|
232 |
||
233 |
value |
|
234 |
^ self textContent |
|
235 |
||
236 |
"Modified: / 17-06-2005 / 14:03:08 / janfrog" |
|
237 |
! |
|
238 |
||
239 |
value: aString |
|
240 |
||
241 |
children removeAll. |
|
242 |
children add:(Text new data:aString) |
|
243 |
||
244 |
"Modified: / 17-06-2005 / 14:02:59 / janfrog" |
|
245 |
! ! |
|
246 |
||
247 |
!Attr methodsFor:'accessing'! |
|
248 |
||
249 |
isId: aBoolean |
|
250 |
||
251 |
isId := aBoolean |
|
252 |
||
253 |
"Created: / 25-11-2005 / 12:32:38 / janfrog" |
|
254 |
! |
|
255 |
||
256 |
localName:localName |
|
257 |
||
258 |
nodeName localName:localName |
|
259 |
||
260 |
"Created: / 16-06-2005 / 16:21:53 / janfrog" |
|
261 |
! |
|
262 |
||
263 |
ns:uri |
|
264 |
||
265 |
nodeName ns:uri |
|
266 |
||
267 |
"Created: / 16-06-2005 / 16:25:42 / janfrog" |
|
268 |
! |
|
269 |
||
270 |
parent:aNode |
|
271 |
parent := aNode. |
|
272 |
||
273 |
"Created: / 04-08-2005 / 14:31:36 / janfrog" |
|
274 |
! |
|
275 |
||
276 |
prefix:prefix |
|
277 |
||
278 |
nodeName prefix:prefix |
|
279 |
||
280 |
"Created: / 16-06-2005 / 16:25:42 / janfrog" |
|
281 |
"Modified: / 20-05-2006 / 13:59:52 / janfrog" |
|
282 |
! |
|
283 |
||
284 |
qualifiedName:qualifiedName |
|
285 |
||
286 |
nodeName qualifiedName:qualifiedName |
|
287 |
||
288 |
"Created: / 28-06-2005 / 23:17:55 / janfrog" |
|
289 |
! |
|
290 |
||
291 |
setNodeName:aNodeName |
|
292 |
nodeName := aNodeName |
|
293 |
||
294 |
"Created: / 05-08-2005 / 13:32:16 / janfrog" |
|
295 |
! |
|
296 |
||
297 |
setOwnerElement: aNode |
|
298 |
self parent: aNode. |
|
299 |
||
300 |
"Created: / 25-12-2005 / 10:17:58 / janfrog" |
|
301 |
! ! |
|
302 |
||
303 |
!Attr methodsFor:'children'! |
|
304 |
||
305 |
insertChild:childNode after:refNode |
|
306 |
||
307 |
^self childNodes insert:childNode after:refNode |
|
308 |
||
309 |
"Created: / 18-06-2005 / 21:51:16 / janfrog" |
|
310 |
! |
|
311 |
||
312 |
insertChild: childNode before: refNode |
|
313 |
||
314 |
self childNodes insert:childNode before:refNode |
|
315 |
||
316 |
"Created: / 25-12-2005 / 11:18:19 / janfrog" |
|
317 |
! ! |
|
318 |
||
319 |
!Attr methodsFor:'copying'! |
|
320 |
||
321 |
copy |
|
322 |
||
323 |
^self deepCopy |
|
324 |
||
325 |
"Created: / 17-06-2005 / 14:39:08 / janfrog" |
|
326 |
! ! |
|
327 |
||
328 |
!Attr methodsFor:'initialization & release'! |
|
329 |
||
330 |
initialize |
|
331 |
||
332 |
super initialize. |
|
333 |
nodeName := NodeName new. |
|
334 |
children := NodeList new |
|
335 |
||
336 |
"Created: / 16-06-2005 / 16:24:40 / janfrog" |
|
337 |
"Modified: / 17-06-2005 / 14:02:09 / janfrog" |
|
338 |
! ! |
|
339 |
||
340 |
!Attr methodsFor:'printing & storing'! |
|
341 |
||
342 |
printOn:aStream |
|
343 |
||
344 |
||
345 |
aStream |
|
346 |
nextPutAll: nodeName qualifiedName; |
|
347 |
nextPut:$=; |
|
348 |
nextPut:$"; |
|
349 |
nextPutAll: self value; |
|
350 |
nextPut:$" |
|
351 |
||
352 |
"Created: / 21-05-2006 / 10:01:30 / janfrog" |
|
353 |
! ! |
|
354 |
||
355 |
!Attr methodsFor:'testing'! |
|
356 |
||
357 |
isAttr |
|
358 |
^ true |
|
359 |
||
360 |
"Created: / 05-08-2005 / 14:27:51 / janfrog" |
|
361 |
! |
|
362 |
||
363 |
isNamespaceDeclarationAttribute |
|
364 |
||
365 |
^(nodeName prefix isEmptyOrNil and:[nodeName localName = 'xmlns']) |
|
366 |
or:[nodeName prefix='xmlns'] |
|
367 |
||
368 |
"Created: / 18-06-2005 / 20:35:36 / janfrog" |
|
369 |
! ! |
|
370 |
||
371 |
!Attr methodsFor:'visiting'! |
|
372 |
||
373 |
acceptVisitor:aVisitor |
|
374 |
"Double dispatch back to the visitor, passing my type encoded in |
|
375 |
the selector (visitor pattern)" |
|
376 |
||
377 |
"stub code automatically generated - please change if required" |
|
378 |
||
379 |
^ aVisitor visitAttr:self |
|
380 |
||
381 |
"Created: / 05-08-2005 / 13:09:35 / janfrog" |
|
382 |
! ! |
|
383 |
||
384 |
!Attr class methodsFor:'documentation'! |
|
385 |
||
386 |
version |
|
387 |
^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/XMLv2__Attr.st,v 1.7 2006-05-21 08:15:12 vranyj1 Exp $' |
|
388 |
! ! |