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:#DocumentFragment |
|
6 |
instanceVariableNames:'children' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'XML Suite-DOM3' |
|
10 |
! |
|
11 |
||
12 |
||
13 |
!DocumentFragment methodsFor:'DOM3 helpers'! |
|
14 |
||
15 |
computeLookupPrefix:arg |
|
16 |
"Superclass says that I am responsible to implement this method" |
|
17 |
||
18 |
self shouldImplement |
|
19 |
||
20 |
"Created: / 18-06-2005 / 21:13:11 / janfrog" |
|
21 |
! |
|
22 |
||
23 |
postAdoptedBy:aDocument |
|
24 |
||
25 |
super postAdoptedBy: aDocument. |
|
26 |
||
27 |
self childNodes do: |
|
28 |
[:child|aDocument recursivelyAdoptNode:child] |
|
29 |
||
30 |
"Created: / 25-12-2005 / 10:15:19 / janfrog" |
|
31 |
! |
|
32 |
||
33 |
postImportBy:aDocument deep:aBoolean |
|
34 |
aBoolean ifFalse:[ |
|
35 |
children := OrderedCollection new |
|
36 |
] ifTrue:[ |
|
37 |
children := children |
|
38 |
collect:[:child | (aDocument importNode:child deep:true) setParentNode:self ] |
|
39 |
] |
|
40 |
||
41 |
"Created: / 25-12-2005 / 11:01:36 / janfrog" |
|
42 |
! |
|
43 |
||
44 |
textContentOn:arg |
|
45 |
"Superclass says that I am responsible to implement this method" |
|
46 |
||
47 |
self shouldImplement |
|
48 |
||
49 |
"Created: / 18-06-2005 / 20:18:17 / janfrog" |
|
50 |
! ! |
|
51 |
||
52 |
!DocumentFragment methodsFor:'DOM3 interface'! |
|
53 |
||
54 |
childNodes |
|
55 |
||
56 |
^children |
|
57 |
||
58 |
"Created: / 10-12-2006 / 21:01:42 / janfrog" |
|
59 |
! |
|
60 |
||
61 |
compareDocumentPosition:arg |
|
62 |
"Superclass says that I am responsible to implement this method" |
|
63 |
||
64 |
self shouldImplement |
|
65 |
||
66 |
"Created: / 18-06-2005 / 20:18:17 / janfrog" |
|
67 |
! |
|
68 |
||
69 |
isDefaultNamespace:uri |
|
70 |
||
71 |
^"unknown"false |
|
72 |
||
73 |
"Created: / 18-06-2005 / 20:18:17 / janfrog" |
|
74 |
! |
|
75 |
||
76 |
lookupNamespaceURI:prefix |
|
77 |
||
78 |
^"unknown"false |
|
79 |
||
80 |
"Created: / 18-06-2005 / 20:18:17 / janfrog" |
|
81 |
! |
|
82 |
||
83 |
nodeName |
|
84 |
||
85 |
^'#document-fragment' |
|
86 |
||
87 |
"Created: / 17-06-2005 / 11:26:23 / janfrog" |
|
88 |
! |
|
89 |
||
90 |
nodeType |
|
91 |
||
92 |
^Node DOCUMENT_FRAGMENT_NODE |
|
93 |
||
94 |
"Created: / 17-06-2005 / 11:44:06 / janfrog" |
|
95 |
! |
|
96 |
||
97 |
normalize |
|
98 |
"Superclass says that I am responsible to implement this method" |
|
99 |
||
100 |
self shouldImplement |
|
101 |
||
102 |
"Created: / 18-06-2005 / 20:18:17 / janfrog" |
|
103 |
! |
|
104 |
||
105 |
ownerDocument |
|
106 |
||
107 |
^self parent |
|
108 |
||
109 |
"Created: / 17-06-2005 / 11:57:30 / janfrog" |
|
110 |
! |
|
111 |
||
112 |
parentNode |
|
113 |
||
114 |
^self domError:'Document fragment has no parent' code:#NOT_SUPPORTED_ERR |
|
115 |
||
116 |
"Created: / 17-06-2005 / 12:04:43 / janfrog" |
|
117 |
! ! |
|
118 |
||
119 |
!DocumentFragment methodsFor:'DOM3 interface - extensions'! |
|
120 |
||
121 |
createAttribute:localName |
|
122 |
||
123 |
^Attr new |
|
124 |
localName:localName; |
|
125 |
setOwnerDocument:self |
|
126 |
||
127 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
128 |
! |
|
129 |
||
130 |
createAttribute:qualifiedName ns:ns |
|
131 |
||
132 |
^Attr new |
|
133 |
qualifiedName:qualifiedName; |
|
134 |
ns:ns; |
|
135 |
nodeValue:''; |
|
136 |
setOwnerDocument:self |
|
137 |
||
138 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
139 |
! |
|
140 |
||
141 |
createCDATASection:aString |
|
142 |
||
143 |
^CDATASection new |
|
144 |
data:aString; |
|
145 |
setOwnerDocument:self |
|
146 |
||
147 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
148 |
! |
|
149 |
||
150 |
createComment:aString |
|
151 |
||
152 |
^Comment new |
|
153 |
data:aString; |
|
154 |
setOwnerDocument:self |
|
155 |
||
156 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
157 |
! |
|
158 |
||
159 |
createDocumentFragment |
|
160 |
||
161 |
^DocumentFragment new |
|
162 |
setOwnerDocument:self |
|
163 |
||
164 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
165 |
! |
|
166 |
||
167 |
createDocumentType: qualifiedName publicId:publicId systemId: systemId |
|
168 |
||
169 |
||
170 |
^self shouldImplement |
|
171 |
||
172 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
173 |
! |
|
174 |
||
175 |
createElement:localName |
|
176 |
||
177 |
^Element new |
|
178 |
qualifiedName:localName; |
|
179 |
setOwnerDocument:self |
|
180 |
||
181 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
182 |
! |
|
183 |
||
184 |
createElement:qualifiedName ns:ns |
|
185 |
||
186 |
^Element new |
|
187 |
qualifiedName:qualifiedName; |
|
188 |
ns:ns; |
|
189 |
setOwnerDocument:self |
|
190 |
||
191 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
192 |
! |
|
193 |
||
194 |
createEntityReference:aString |
|
195 |
||
196 |
^EntityReference new |
|
197 |
setOwnerDocument: self; |
|
198 |
"appendChild: |
|
199 |
(Entity new |
|
200 |
setOwnerDocument:self; |
|
201 |
setNotationName: aString)" |
|
202 |
yourself |
|
203 |
||
204 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
205 |
! |
|
206 |
||
207 |
createProcessingInstruction:target data:data |
|
208 |
||
209 |
^ProcessingInstruction new |
|
210 |
target:target; |
|
211 |
data:data; |
|
212 |
setOwnerDocument:self |
|
213 |
||
214 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
215 |
! |
|
216 |
||
217 |
createTextNode:aString |
|
218 |
||
219 |
^Text new |
|
220 |
data:aString; |
|
221 |
setOwnerDocument:self |
|
222 |
||
223 |
"Created: / 10-08-2007 / 09:24:13 / janfrog" |
|
224 |
! ! |
|
225 |
||
226 |
!DocumentFragment methodsFor:'accessing'! |
|
227 |
||
228 |
document |
|
229 |
||
230 |
^self parent ifNil:[self] |
|
231 |
||
232 |
"Created: / 17-06-2005 / 11:58:44 / janfrog" |
|
233 |
! ! |
|
234 |
||
235 |
!DocumentFragment methodsFor:'children'! |
|
236 |
||
237 |
insertChild:childNode before:refNode |
|
238 |
||
239 |
refNode |
|
240 |
ifNil:[self childNodes addLast:childNode] |
|
241 |
ifNotNil:[self childNodes insert:childNode before:refNode] |
|
242 |
||
243 |
"Created: / 18-06-2005 / 19:33:30 / janfrog" |
|
244 |
! |
|
245 |
||
246 |
insertYourselfAfter:refNode in:parentNode |
|
247 |
self childNodes do:[:childNode | |
|
248 |
parentNode insertChild:childNode after:refNode |
|
249 |
] |
|
250 |
||
251 |
"Created: / 21-11-2007 / 10:58:42 / janfrog" |
|
252 |
! |
|
253 |
||
254 |
insertYourselfBefore:refNode in:parentNode |
|
255 |
self childNodes do:[:childNode | |
|
256 |
parentNode insertChild:childNode before:refNode |
|
257 |
] |
|
258 |
||
259 |
"Created: / 18-06-2005 / 19:32:23 / janfrog" |
|
260 |
! ! |
|
261 |
||
262 |
!DocumentFragment methodsFor:'initialization'! |
|
263 |
||
264 |
initialize |
|
265 |
||
266 |
super initialize. |
|
267 |
children := NodeList new |
|
268 |
||
269 |
"Created: / 17-06-2005 / 12:39:32 / janfrog" |
|
270 |
! ! |
|
271 |
||
272 |
!DocumentFragment methodsFor:'testing'! |
|
273 |
||
274 |
isDocumentFragment |
|
275 |
^ true |
|
276 |
||
277 |
"Created: / 05-08-2005 / 14:27:51 / janfrog" |
|
278 |
! ! |
|
279 |
||
280 |
!DocumentFragment methodsFor:'visiting'! |
|
281 |
||
282 |
acceptVisitor:aVisitor |
|
283 |
"Double dispatch back to the visitor, passing my type encoded in |
|
284 |
the selector (visitor pattern)" |
|
285 |
||
286 |
"stub code automatically generated - please change if required" |
|
287 |
||
288 |
^ aVisitor visitDocumentFragment:self |
|
289 |
||
290 |
"Created: / 05-08-2005 / 13:09:35 / janfrog" |
|
291 |
! ! |
|
292 |
||
293 |
!DocumentFragment class methodsFor:'documentation'! |
|
294 |
||
295 |
version |
|
296 |
^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/XMLv2__DocumentFragment.st,v 1.5 2007-11-22 21:41:37 vranyj1 Exp $' |
|
297 |
! ! |