|
1 "{ Package: 'stx:goodies/xmlsuite' }" |
|
2 |
|
3 "{ NameSpace: XMLv2 }" |
|
4 |
|
5 AbstractW3CDOM3TestCase subclass:#W3CDOM3CoreTests |
|
6 instanceVariableNames:'doc' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'XML Suite-Tests W3C' |
|
10 ! |
|
11 |
|
12 |
|
13 !W3CDOM3CoreTests class methodsFor:'defaults'! |
|
14 |
|
15 module |
|
16 ^'Core' |
|
17 ! ! |
|
18 |
|
19 !W3CDOM3CoreTests methodsFor:'W3C tests'! |
|
20 |
|
21 test_attrgetschematypeinfo01 |
|
22 " |
|
23 Call getSchemaTypeInfo on title attribute for the first acronym element. |
|
24 |
|
25 Creator: Curt Arnold |
|
26 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
27 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
28 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
29 " |
|
30 | |
|
31 doc "Document" |
|
32 elemList "NodeList" |
|
33 acronymElem "Element" |
|
34 attr "Attr" |
|
35 elem "Element" |
|
36 elemName "String" |
|
37 typeInfo "TypeInfo" |
|
38 typeNS "String" |
|
39 typeName "String" |
|
40 | |
|
41 ^self. "Validation not supported" |
|
42 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
43 elemList := doc getElementsByTagName: 'acronym'. |
|
44 acronymElem := elemList item:0. |
|
45 attr := acronymElem getAttributeNode:'title'. |
|
46 typeInfo := attr schemaTypeInfo. |
|
47 self assert: typeInfo notNil. |
|
48 typeName := typeInfo typeName. |
|
49 self assert: ( typeName = 'CDATA' ). |
|
50 typeNS := typeInfo typeNamespace. |
|
51 self assert: ( typeNS = 'http://www.w3.org/TR/REC-xml' ). |
|
52 |
|
53 ! |
|
54 |
|
55 test_attrgetschematypeinfo02 |
|
56 " |
|
57 Call getSchemaTypeInfo on id attribute for the third acronym element. |
|
58 |
|
59 Creator: Curt Arnold |
|
60 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
61 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
62 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
63 " |
|
64 | |
|
65 doc "Document" |
|
66 elemList "NodeList" |
|
67 acronymElem "Element" |
|
68 attr "Attr" |
|
69 elem "Element" |
|
70 elemName "String" |
|
71 typeInfo "TypeInfo" |
|
72 typeNS "String" |
|
73 typeName "String" |
|
74 | |
|
75 ^self. "Validation not supported" |
|
76 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
77 elemList := doc getElementsByTagName: 'acronym'. |
|
78 acronymElem := elemList item:2. |
|
79 attr := acronymElem getAttributeNode:'id'. |
|
80 typeInfo := attr schemaTypeInfo. |
|
81 self assert: typeInfo notNil. |
|
82 typeName := typeInfo typeName. |
|
83 self assert: ( typeName = 'ID' ). |
|
84 typeNS := typeInfo typeNamespace. |
|
85 self assert: ( typeNS = 'http://www.w3.org/TR/REC-xml' ). |
|
86 |
|
87 ! |
|
88 |
|
89 test_attrgetschematypeinfo03 |
|
90 " |
|
91 Call getSchemaTypeInfo on title attribute for the first acronym element. |
|
92 |
|
93 Creator: Curt Arnold |
|
94 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
95 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
96 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
97 " |
|
98 | |
|
99 doc "Document" |
|
100 elemList "NodeList" |
|
101 acronymElem "Element" |
|
102 attr "Attr" |
|
103 elem "Element" |
|
104 elemName "String" |
|
105 typeInfo "TypeInfo" |
|
106 typeNS "String" |
|
107 typeName "String" |
|
108 | |
|
109 ^self. "Schema validation not supported" |
|
110 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
111 elemList := doc getElementsByTagName: 'acronym'. |
|
112 acronymElem := elemList item:0. |
|
113 attr := acronymElem getAttributeNode:'title'. |
|
114 typeInfo := attr schemaTypeInfo. |
|
115 self assert: typeInfo notNil. |
|
116 typeName := typeInfo typeName. |
|
117 self assert: ( typeName = 'string' ). |
|
118 typeNS := typeInfo typeNamespace. |
|
119 self assert: ( typeNS = 'http://www.w3.org/2001/XMLSchema' ). |
|
120 |
|
121 ! |
|
122 |
|
123 test_attrgetschematypeinfo04 |
|
124 " |
|
125 Call getSchemaTypeInfo on id attribute for the third acronym element. |
|
126 |
|
127 Creator: Curt Arnold |
|
128 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
129 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
130 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
131 " |
|
132 | |
|
133 doc "Document" |
|
134 elemList "NodeList" |
|
135 acronymElem "Element" |
|
136 attr "Attr" |
|
137 elem "Element" |
|
138 elemName "String" |
|
139 typeInfo "TypeInfo" |
|
140 typeNS "String" |
|
141 typeName "String" |
|
142 | |
|
143 ^self. "Schema validation not supported" |
|
144 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
145 elemList := doc getElementsByTagName: 'acronym'. |
|
146 acronymElem := elemList item:2. |
|
147 attr := acronymElem getAttributeNode:'id'. |
|
148 typeInfo := attr schemaTypeInfo. |
|
149 self assert: typeInfo notNil. |
|
150 typeName := typeInfo typeName. |
|
151 self assert: ( typeName = 'ID' ). |
|
152 typeNS := typeInfo typeNamespace. |
|
153 self assert: ( typeNS = 'http://www.w3.org/2001/XMLSchema' ). |
|
154 |
|
155 ! |
|
156 |
|
157 test_attrgetschematypeinfo05 |
|
158 " |
|
159 Call getSchemaTypeInfo on class attribute for the third acronym element. |
|
160 |
|
161 Creator: Curt Arnold |
|
162 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
163 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
164 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
165 " |
|
166 | |
|
167 doc "Document" |
|
168 elemList "NodeList" |
|
169 acronymElem "Element" |
|
170 attr "Attr" |
|
171 elem "Element" |
|
172 elemName "String" |
|
173 typeInfo "TypeInfo" |
|
174 typeNS "String" |
|
175 typeName "String" |
|
176 | |
|
177 ^self. "Schema validation not supported" |
|
178 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
179 elemList := doc getElementsByTagName: 'acronym'. |
|
180 acronymElem := elemList item:2. |
|
181 attr := acronymElem getAttributeNode:'class'. |
|
182 typeInfo := attr schemaTypeInfo. |
|
183 self assert: typeInfo notNil. |
|
184 typeName := typeInfo typeName. |
|
185 self assert: ( typeName = 'classType' ). |
|
186 typeNS := typeInfo typeNamespace. |
|
187 self assert: ( typeNS = 'http://www.w3.org/1999/xhtml' ). |
|
188 |
|
189 ! |
|
190 |
|
191 test_attrgetschematypeinfo06 |
|
192 " |
|
193 Attr.schemaTypeInfo should return null if not validating or schema validating. |
|
194 |
|
195 Creator: Curt Arnold |
|
196 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
197 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
198 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
199 " |
|
200 | |
|
201 doc "Document" |
|
202 elemList "NodeList" |
|
203 acronymElem "Element" |
|
204 elem "Element" |
|
205 attr "Attr" |
|
206 typeInfo "TypeInfo" |
|
207 typeName "String" |
|
208 typeNS "String" |
|
209 | |
|
210 "implementationAttribute not supported: validating" |
|
211 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_nodtdstaff'). |
|
212 elemList := doc getElementsByTagName: 'acronym'. |
|
213 acronymElem := elemList item:0. |
|
214 attr := acronymElem getAttributeNode:'title'. |
|
215 typeInfo := attr schemaTypeInfo. |
|
216 self assert: typeInfo notNil. |
|
217 typeName := typeInfo typeName. |
|
218 self assert: typeName isNil. |
|
219 typeNS := typeInfo typeNamespace. |
|
220 self assert: typeNS isNil. |
|
221 |
|
222 ! |
|
223 |
|
224 test_attrgetschematypeinfo07 |
|
225 " |
|
226 The getSchemaTypeInfo method retrieves the type information associated with this attribute. |
|
227 |
|
228 Load a valid document with an XML Schema. |
|
229 |
|
230 Invoke getSchemaTypeInfo method on an attribute having [type definition] property. Expose {name} and {target namespace} |
|
231 properties of the [type definition] property. Verity that the typeName and typeNamespace of the title attribute's |
|
232 schemaTypeInfo are correct. getSchemaTypeInfo on the 'id' attribute of the fourth 'acronym' element |
|
233 |
|
234 Creator: IBM |
|
235 Autor Jenny Hsu |
|
236 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
237 " |
|
238 | |
|
239 doc "Document" |
|
240 elemList "NodeList" |
|
241 acElem "Element" |
|
242 attr "Attr" |
|
243 attrTypeInfo "TypeInfo" |
|
244 typeName "String" |
|
245 typeNamespace "String" |
|
246 | |
|
247 ^self. "Schema validation not supported" |
|
248 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
249 elemList := doc getElementsByTagName: 'acronym'. |
|
250 acElem := elemList item:3. |
|
251 attr := acElem getAttributeNode:'id'. |
|
252 attrTypeInfo := attr schemaTypeInfo. |
|
253 self assert: attrTypeInfo notNil. |
|
254 typeName := attrTypeInfo typeName. |
|
255 typeNamespace := attrTypeInfo typeNamespace. |
|
256 self assert: ( typeName = 'ID' ). |
|
257 self assert: ( typeNamespace = 'http://www.w3.org/2001/XMLSchema' ). |
|
258 |
|
259 ! |
|
260 |
|
261 test_attrgetschematypeinfo08 |
|
262 " |
|
263 The getSchemaTypeInfo method retrieves the type information associated with this attribute. |
|
264 |
|
265 Load a valid document with an XML Schema. |
|
266 Invoke getSchemaTypeInfo method on an attribute having [type definition] property. Expose {name} and {target namespace} |
|
267 properties of the [type definition] property. Verity that the typeName and typeNamespace of the 'title' attribute's (of first 'acronym' element) |
|
268 schemaTypeInfo are correct. |
|
269 |
|
270 Creator: IBM |
|
271 Autor Jenny Hsu |
|
272 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-schemaTypeInfo |
|
273 " |
|
274 | |
|
275 doc "Document" |
|
276 elemList "NodeList" |
|
277 acElem "Element" |
|
278 attr "Attr" |
|
279 attrTypeInfo "TypeInfo" |
|
280 typeName "String" |
|
281 typeNamespace "String" |
|
282 | |
|
283 ^self. "Schema validation not supported" |
|
284 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
285 elemList := doc getElementsByTagName: 'acronym'. |
|
286 acElem := elemList item:0. |
|
287 attr := acElem getAttributeNode:'title'. |
|
288 attrTypeInfo := attr schemaTypeInfo. |
|
289 typeName := attrTypeInfo typeName. |
|
290 typeNamespace := attrTypeInfo typeNamespace. |
|
291 self assert: ( typeName = 'string' ). |
|
292 self assert: ( typeNamespace = 'http://www.w3.org/2001/XMLSchema' ). |
|
293 |
|
294 ! |
|
295 |
|
296 test_attrisid01 |
|
297 " |
|
298 Retrieve the third acronyms element's class attribute, whose type is not ID. |
|
299 Invoke isID on the class attribute, this should return false. |
|
300 |
|
301 Creator: IBM |
|
302 Autor Neil Delima |
|
303 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-isId |
|
304 " |
|
305 | |
|
306 doc "Document" |
|
307 elemList "NodeList" |
|
308 acronymElem "Element" |
|
309 attr "Attr" |
|
310 id "Boolean" |
|
311 elem "Element" |
|
312 elemName "String" |
|
313 | |
|
314 id := false. |
|
315 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
316 elemList := doc getElementsByTagName: 'acronym'. |
|
317 acronymElem := elemList item:2. |
|
318 attr := acronymElem getAttributeNode:'class'. |
|
319 id := attr isId. |
|
320 self deny: id. |
|
321 |
|
322 ! |
|
323 |
|
324 test_attrisid02 |
|
325 " |
|
326 Invoke setIdAttribute on the third acronym element's new attribute and set |
|
327 isID=true. Verify by calling isID on the new attribute and check if the |
|
328 value returned is true. |
|
329 |
|
330 Creator: IBM |
|
331 Autor Neil Delima |
|
332 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-isId |
|
333 " |
|
334 | |
|
335 doc "Document" |
|
336 elemList "NodeList" |
|
337 acronymElem "Element" |
|
338 attributesMap "NamedNodeMap" |
|
339 attr "Attr" |
|
340 id "Boolean" |
|
341 elem "Element" |
|
342 elemName "String" |
|
343 xmlNS "String" |
|
344 | |
|
345 id := false. |
|
346 xmlNS := 'http://www.w3.org/XML/1998/namespace'. |
|
347 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
348 elemList := doc getElementsByTagName: 'acronym'. |
|
349 acronymElem := elemList item:2. |
|
350 acronymElem setAttribute: 'xml:lang' ns: xmlNS value: 'FR-fr'. |
|
351 acronymElem setIdAttribute: 'lang' ns: xmlNS isId:true. |
|
352 attr := acronymElem getAttributeNode: 'lang' ns: xmlNS. |
|
353 id := attr isId. |
|
354 self assert: id. |
|
355 |
|
356 ! |
|
357 |
|
358 test_attrisid03 |
|
359 " |
|
360 Invoke setIdAttribute(false) on a newly created attribute and then check Attr.isID. |
|
361 |
|
362 Creator: IBM |
|
363 Autor Neil Delima |
|
364 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-isId |
|
365 " |
|
366 | |
|
367 doc "Document" |
|
368 elemList "NodeList" |
|
369 acronymElem "Element" |
|
370 attributesMap "NamedNodeMap" |
|
371 attr "Attr" |
|
372 id "Boolean" |
|
373 elem "Element" |
|
374 elemName "String" |
|
375 xmlNS "String" |
|
376 | |
|
377 id := false. |
|
378 xmlNS := 'http://www.w3.org/XML/1998/namespace'. |
|
379 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
380 elemList := doc getElementsByTagName: 'acronym'. |
|
381 acronymElem := elemList item:2. |
|
382 acronymElem setAttribute: 'xml:lang' ns: xmlNS value: 'FR-fr'. |
|
383 acronymElem setIdAttribute: 'lang' ns: xmlNS isId:false. |
|
384 attr := acronymElem getAttributeNode: 'lang' ns: xmlNS. |
|
385 id := attr isId. |
|
386 self deny: id. |
|
387 |
|
388 ! |
|
389 |
|
390 test_attrisid04 |
|
391 " |
|
392 Attr.isID should return true for the id attribute on the fourth acronym node |
|
393 since its type is ID. |
|
394 |
|
395 Creator: IBM |
|
396 Autor Neil Delima |
|
397 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-isId |
|
398 " |
|
399 | |
|
400 doc "Document" |
|
401 elemList "NodeList" |
|
402 acronymElem "Element" |
|
403 clonedacronymElem "Element" |
|
404 attributesMap "NamedNodeMap" |
|
405 attr "Attr" |
|
406 id "Boolean" |
|
407 elem "Element" |
|
408 elemName "String" |
|
409 | |
|
410 ^self. "Validation not supported" |
|
411 id := false. |
|
412 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
413 elemList := doc getElementsByTagName: 'acronym'. |
|
414 acronymElem := elemList item:3. |
|
415 attr := acronymElem getAttributeNode:'id'. |
|
416 id := attr isId. |
|
417 self assert: id. |
|
418 |
|
419 ! |
|
420 |
|
421 test_attrisid05 |
|
422 " |
|
423 Retrieve the fourth acronym element's id attribute, whose type is ID. |
|
424 Deep clone the element node and append it as a sibling of the acronym node. |
|
425 We now have two id attributes of type ID with identical values. |
|
426 Invoke isID on the class attribute, should this return true??? |
|
427 |
|
428 Creator: IBM |
|
429 Autor Neil Delima |
|
430 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-isId |
|
431 " |
|
432 | |
|
433 doc "Document" |
|
434 elemList "NodeList" |
|
435 acronymElem "Element" |
|
436 clonedacronymElem "Element" |
|
437 acronymParentElem "Element" |
|
438 appendedNode "Node" |
|
439 attributesMap "NamedNodeMap" |
|
440 attr "Attr" |
|
441 id "Boolean" |
|
442 elem "Element" |
|
443 elemName "String" |
|
444 | |
|
445 ^self. "Validation not supported" |
|
446 id := false. |
|
447 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
448 elemList := doc getElementsByTagName: 'acronym'. |
|
449 acronymElem := elemList item:3. |
|
450 acronymParentElem := acronymElem parentNode. |
|
451 clonedacronymElem := acronymElem cloneNode:true. |
|
452 appendedNode := acronymParentElem appendChild:clonedacronymElem. |
|
453 attr := acronymElem getAttributeNode:'id'. |
|
454 id := attr isId. |
|
455 self assert: id. |
|
456 |
|
457 ! |
|
458 |
|
459 test_attrisid06 |
|
460 " |
|
461 Invoke isId on a new Attr node. Check if the value returned is false. |
|
462 |
|
463 Creator: IBM |
|
464 Autor Neil Delima |
|
465 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-isId |
|
466 " |
|
467 | |
|
468 doc "Document" |
|
469 attr "Attr" |
|
470 id "Boolean" |
|
471 | |
|
472 id := false. |
|
473 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
474 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
475 id := attr isId. |
|
476 self deny: id. |
|
477 |
|
478 ! |
|
479 |
|
480 test_attrisid07 |
|
481 " |
|
482 The method isId returns whether this attribute is known to be of type ID or not. |
|
483 |
|
484 Add a new attribute of type ID to the third acronym element node of this document. Verify that the method |
|
485 isId returns true. The use of Element.setIdAttributeNS() makes 'isId' a user-determined ID attribute. |
|
486 Import the newly created attribute node into this document. |
|
487 Since user data assocated to the imported node is not carried over, verify that the method isId |
|
488 returns false on the imported attribute node. |
|
489 |
|
490 |
|
491 Creator: IBM |
|
492 Autor Neil Delima |
|
493 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Attr-isId |
|
494 " |
|
495 | |
|
496 doc "Document" |
|
497 elemList "NodeList" |
|
498 acronymElem "Element" |
|
499 attributesMap "NamedNodeMap" |
|
500 attr "Attr" |
|
501 attrImported "Attr" |
|
502 id "Boolean" |
|
503 elem "Element" |
|
504 elemName "String" |
|
505 | |
|
506 "implementationAttribute not supported: namespaceAware" |
|
507 id := false. |
|
508 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
509 elemList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
510 acronymElem := elemList item:2. |
|
511 acronymElem setAttribute: 'dom3:newAttr' ns: 'http://www.w3.org/DOM' value: 'null'. |
|
512 acronymElem setIdAttribute: 'newAttr' ns: 'http://www.w3.org/DOM' isId:true. |
|
513 attr := acronymElem getAttributeNode: 'newAttr' ns: 'http://www.w3.org/DOM'. |
|
514 id := attr isId. |
|
515 self assert: id. |
|
516 attrImported := doc importNode:attr deep:false. |
|
517 id := attrImported isId. |
|
518 self deny: id. |
|
519 |
|
520 ! |
|
521 |
|
522 test_canonicalform01 |
|
523 " |
|
524 Normalize document with 'canonical-form' set to true, check that |
|
525 entity references are expanded and unused entity declaration are maintained. |
|
526 |
|
527 Creator: Curt Arnold |
|
528 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
529 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
530 " |
|
531 | |
|
532 doc "Document" |
|
533 pList "NodeList" |
|
534 pElem "Element" |
|
535 domConfig "DOMConfiguration" |
|
536 canSet "Boolean" |
|
537 canSetValidate "Boolean" |
|
538 errorMonitor "DOMErrorMonitor" |
|
539 child "Node" |
|
540 childName "String" |
|
541 entRef "EntityReference" |
|
542 childValue "String" |
|
543 entities "NamedNodeMap" |
|
544 ent2 "Entity" |
|
545 doctype "DocumentType" |
|
546 | |
|
547 "implementationAttribute not supported: namespaceAware" |
|
548 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
549 domConfig := doc domConfig. |
|
550 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
551 "if" |
|
552 (canSet) ifTrue: [ |
|
553 ]. |
|
554 |
|
555 ! |
|
556 |
|
557 test_canonicalform02 |
|
558 " |
|
559 Normalize document with normalize-characters set to false, check that |
|
560 characters are not normalized. |
|
561 |
|
562 Creator: Curt Arnold |
|
563 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
564 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
565 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
566 " |
|
567 | |
|
568 doc "Document" |
|
569 docElem "Element" |
|
570 domConfig "DOMConfiguration" |
|
571 errorMonitor "DOMErrorMonitor" |
|
572 pList "NodeList" |
|
573 pElem "Element" |
|
574 text "Text" |
|
575 textValue "String" |
|
576 retval "Node" |
|
577 canSet "Boolean" |
|
578 | |
|
579 "implementationAttribute not supported: namespaceAware" |
|
580 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
581 domConfig := doc domConfig. |
|
582 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
583 "if" |
|
584 (canSet) ifTrue: [ |
|
585 ]. |
|
586 |
|
587 ! |
|
588 |
|
589 test_canonicalform03 |
|
590 " |
|
591 Normalize a document with the 'canonical-form' parameter set to true and |
|
592 check that a CDATASection has been eliminated. |
|
593 |
|
594 Creator: Curt Arnold |
|
595 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
596 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
597 " |
|
598 | |
|
599 doc "Document" |
|
600 elemList "NodeList" |
|
601 elemName "Element" |
|
602 cdata "CDATASection" |
|
603 text "Text" |
|
604 nodeName "String" |
|
605 domConfig "DOMConfiguration" |
|
606 errorMonitor "DOMErrorMonitor" |
|
607 canSet "Boolean" |
|
608 | |
|
609 "implementationAttribute not supported: namespaceAware" |
|
610 "implementationAttribute not supported: coalescing" |
|
611 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
612 elemList := doc getElementsByTagName: 'strong'. |
|
613 elemName := elemList item:1. |
|
614 cdata := elemName lastChild. |
|
615 nodeName := cdata nodeName. |
|
616 self assert: ( nodeName = '#cdata-section' ). |
|
617 domConfig := doc domConfig. |
|
618 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
619 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
620 "if" |
|
621 (canSet) ifTrue: [ |
|
622 ]. |
|
623 |
|
624 ! |
|
625 |
|
626 test_canonicalform04 |
|
627 " |
|
628 Normalize document with canonical-form set to true, check that |
|
629 namespace declaration attributes are maintained. |
|
630 |
|
631 Creator: Curt Arnold |
|
632 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
633 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
634 " |
|
635 | |
|
636 doc "Document" |
|
637 docElem "Element" |
|
638 domConfig "DOMConfiguration" |
|
639 errorMonitor "DOMErrorMonitor" |
|
640 xmlnsAttr "Attr" |
|
641 canSet "Boolean" |
|
642 | |
|
643 "implementationAttribute not supported: namespaceAware" |
|
644 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
645 domConfig := doc domConfig. |
|
646 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
647 "if" |
|
648 (canSet) ifTrue: [ |
|
649 ]. |
|
650 |
|
651 ! |
|
652 |
|
653 test_canonicalform05 |
|
654 " |
|
655 Add a L1 element to a L2 namespace aware document and perform namespace normalization. Should result |
|
656 in an error. |
|
657 |
|
658 Creator: Curt Arnold |
|
659 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
660 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algorithms#normalizeDocumentAlgo |
|
661 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
662 " |
|
663 | |
|
664 doc "Document" |
|
665 elem "Element" |
|
666 domConfig "DOMConfiguration" |
|
667 pList "NodeList" |
|
668 newChild "Element" |
|
669 retval "Element" |
|
670 errorMonitor "DOMErrorMonitor" |
|
671 errors "List" |
|
672 error "DOMError" |
|
673 errorCount "SmallInteger" |
|
674 severity "SmallInteger" |
|
675 problemNode "Node" |
|
676 location "DOMLocator" |
|
677 lineNumber "SmallInteger" |
|
678 columnNumber "SmallInteger" |
|
679 byteOffset "SmallInteger" |
|
680 utf16Offset "SmallInteger" |
|
681 uri "String" |
|
682 type "String" |
|
683 message "String" |
|
684 relatedException "DOMObject" |
|
685 relatedData "DOMObject" |
|
686 length "SmallInteger" |
|
687 canSet "Boolean" |
|
688 | |
|
689 "implementationAttribute not supported: namespaceAware" |
|
690 errorCount := 0. |
|
691 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
692 pList := doc getElementsByTagName: 'p'. |
|
693 elem := pList item:0. |
|
694 newChild := doc createElement:'br'. |
|
695 retval := elem appendChild:newChild. |
|
696 domConfig := doc domConfig. |
|
697 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
698 "if" |
|
699 (canSet) ifTrue: [ |
|
700 severity := error severity. |
|
701 "if" |
|
702 ( severity = 2 ) ifTrue: [ |
|
703 self assert:false description:'Method "greater" is not supported yet'. |
|
704 ]. |
|
705 ]. |
|
706 |
|
707 ! |
|
708 |
|
709 test_canonicalform06 |
|
710 " |
|
711 Create a document with an XML 1.1 valid but XML 1.0 invalid element and |
|
712 normalize document with canonical-form set to true. |
|
713 |
|
714 Creator: Curt Arnold |
|
715 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
716 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
717 " |
|
718 | |
|
719 domImpl "DOMImplementation" |
|
720 nullString "String" |
|
721 nullDoctype "DocumentType" |
|
722 doc "Document" |
|
723 elem "Element" |
|
724 retval "Node" |
|
725 domConfig "DOMConfiguration" |
|
726 errorMonitor "DOMErrorMonitor" |
|
727 errors "List" |
|
728 error "DOMError" |
|
729 severity "SmallInteger" |
|
730 type "String" |
|
731 locator "DOMLocator" |
|
732 relatedNode "Node" |
|
733 canSet "Boolean" |
|
734 | |
|
735 nullString := nil. |
|
736 nullDoctype := nil. |
|
737 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
738 doc := domImpl createDocumentNS: nullString qualifiedName: nullString doctype: nullDoctype. |
|
739 "assertDOMException..." |
|
740 self should:[ |
|
741 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed01'. |
|
742 ] raise: DOMException. |
|
743 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
744 "end of assertDOMException..." |
|
745 "try" |
|
746 [ |
|
747 ] on: DOMException do: [:ex| ]. |
|
748 "end of try" |
|
749 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed01'. |
|
750 retval := doc appendChild:elem. |
|
751 domConfig := doc domConfig. |
|
752 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
753 "if" |
|
754 (canSet) ifTrue: [ |
|
755 severity := error severity. |
|
756 self assert: ( severity = 2 ). |
|
757 type := error type. |
|
758 self assert: ( type = 'wf-invalid-character-in-node-name' ). |
|
759 locator := error location. |
|
760 relatedNode := locator relatedNode. |
|
761 self assert: relatedNode == elem. |
|
762 ]. |
|
763 |
|
764 ! |
|
765 |
|
766 test_canonicalform07 |
|
767 " |
|
768 Normalize document with canonical-form set to true and validation set to true, check that |
|
769 whitespace in element content is preserved. |
|
770 |
|
771 Creator: Curt Arnold |
|
772 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
773 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
774 " |
|
775 | |
|
776 doc "Document" |
|
777 bodyList "NodeList" |
|
778 body "Element" |
|
779 domConfig "DOMConfiguration" |
|
780 canSet "Boolean" |
|
781 canSetValidate "Boolean" |
|
782 errorMonitor "DOMErrorMonitor" |
|
783 child "Node" |
|
784 childName "String" |
|
785 text "Text" |
|
786 | |
|
787 "implementationAttribute not supported: namespaceAware" |
|
788 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
789 domConfig := doc domConfig. |
|
790 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
791 "if" |
|
792 (canSet) ifTrue: [ |
|
793 ^self. "ignoringElementContentWhitespace supported" |
|
794 bodyList := doc getElementsByTagName: 'body'. |
|
795 body := bodyList item:0. |
|
796 child := body firstChild. |
|
797 text := doc createTextNode:' '. |
|
798 body insert:text before: child. |
|
799 ]. |
|
800 |
|
801 ! |
|
802 |
|
803 test_canonicalform08 |
|
804 " |
|
805 Normalize document based on section 3.1 with canonical-form set to true and check normalized document. |
|
806 |
|
807 Creator: Curt Arnold |
|
808 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
809 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
810 " |
|
811 | |
|
812 doc "Document" |
|
813 bodyList "NodeList" |
|
814 body "Element" |
|
815 domConfig "DOMConfiguration" |
|
816 canSet "Boolean" |
|
817 canSetValidate "Boolean" |
|
818 errorMonitor "DOMErrorMonitor" |
|
819 node "Node" |
|
820 nodeName "String" |
|
821 nodeValue "String" |
|
822 nodeType "SmallInteger" |
|
823 length "SmallInteger" |
|
824 text "Text" |
|
825 | |
|
826 "implementationAttribute not supported: namespaceAware" |
|
827 "implementationAttribute not supported: validating" |
|
828 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'canonicalform01'). |
|
829 domConfig := doc domConfig. |
|
830 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
831 "if" |
|
832 (canSet) ifTrue: [ |
|
833 ]. |
|
834 |
|
835 ! |
|
836 |
|
837 test_canonicalform09 |
|
838 " |
|
839 Normalize document based on section 3.1 with canonical-form set to true |
|
840 and comments to false and check normalized document. |
|
841 |
|
842 Creator: Curt Arnold |
|
843 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
844 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
845 " |
|
846 | |
|
847 doc "Document" |
|
848 bodyList "NodeList" |
|
849 body "Element" |
|
850 domConfig "DOMConfiguration" |
|
851 canSet "Boolean" |
|
852 canSetValidate "Boolean" |
|
853 errorMonitor "DOMErrorMonitor" |
|
854 node "Node" |
|
855 nodeName "String" |
|
856 nodeValue "String" |
|
857 nodeType "SmallInteger" |
|
858 length "SmallInteger" |
|
859 text "Text" |
|
860 | |
|
861 "implementationAttribute not supported: namespaceAware" |
|
862 "implementationAttribute not supported: validating" |
|
863 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'canonicalform01'). |
|
864 domConfig := doc domConfig. |
|
865 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
866 "if" |
|
867 (canSet) ifTrue: [ |
|
868 ]. |
|
869 |
|
870 ! |
|
871 |
|
872 test_canonicalform10 |
|
873 " |
|
874 Check elimination of unnecessary namespace prefixes when |
|
875 normalized with canonical-form = true. |
|
876 |
|
877 Creator: Curt Arnold |
|
878 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
879 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
880 " |
|
881 | |
|
882 doc "Document" |
|
883 divList "NodeList" |
|
884 div "Element" |
|
885 domConfig "DOMConfiguration" |
|
886 canSet "Boolean" |
|
887 errorMonitor "DOMErrorMonitor" |
|
888 node "Node" |
|
889 | |
|
890 "implementationAttribute not supported: namespaceAware" |
|
891 "implementationAttribute not supported: validating" |
|
892 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'canonicalform03'). |
|
893 domConfig := doc domConfig. |
|
894 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
895 "if" |
|
896 (canSet) ifTrue: [ |
|
897 ]. |
|
898 |
|
899 ! |
|
900 |
|
901 test_canonicalform11 |
|
902 " |
|
903 Check that default attributes are made explicitly specified. |
|
904 |
|
905 Creator: Curt Arnold |
|
906 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
907 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
908 " |
|
909 | |
|
910 doc "Document" |
|
911 elemList "NodeList" |
|
912 elem "Element" |
|
913 domConfig "DOMConfiguration" |
|
914 canSet "Boolean" |
|
915 errorMonitor "DOMErrorMonitor" |
|
916 attr "Attr" |
|
917 attrValue "String" |
|
918 attrSpecified "Boolean" |
|
919 | |
|
920 "implementationAttribute not supported: namespaceAware" |
|
921 "implementationAttribute not supported: validating" |
|
922 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'canonicalform03'). |
|
923 domConfig := doc domConfig. |
|
924 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
925 "if" |
|
926 (canSet) ifTrue: [ |
|
927 ]. |
|
928 |
|
929 ! |
|
930 |
|
931 test_canonicalform12 |
|
932 " |
|
933 Normalize document with 'canonical-form' set to true, check that |
|
934 DocumentType nodes are removed. |
|
935 |
|
936 Creator: Curt Arnold |
|
937 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
938 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
939 " |
|
940 | |
|
941 doc "Document" |
|
942 domConfig "DOMConfiguration" |
|
943 canSet "Boolean" |
|
944 errorMonitor "DOMErrorMonitor" |
|
945 doctype "DocumentType" |
|
946 | |
|
947 "implementationAttribute not supported: namespaceAware" |
|
948 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
949 domConfig := doc domConfig. |
|
950 canSet := domConfig canSetParameter: 'canonical-form' value: true. |
|
951 "if" |
|
952 (canSet) ifTrue: [ |
|
953 ]. |
|
954 |
|
955 ! |
|
956 |
|
957 test_cdatasections01 |
|
958 " |
|
959 Normalize a document using Node.normalize and check that |
|
960 the value of the 'cdata-sections' parameter is ignored. |
|
961 |
|
962 Creator: Curt Arnold |
|
963 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
964 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-cdata-sections |
|
965 " |
|
966 | |
|
967 doc "Document" |
|
968 elem "Element" |
|
969 newCdata "CDATASection" |
|
970 cdata "CDATASection" |
|
971 text "Node" |
|
972 nodeName "String" |
|
973 nodeValue "String" |
|
974 appendedChild "Node" |
|
975 domConfig "DOMConfiguration" |
|
976 pList "NodeList" |
|
977 errorMonitor "DOMErrorMonitor" |
|
978 | |
|
979 "implementationAttribute not supported: namespaceAware" |
|
980 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
981 pList := doc getElementsByTagName: 'p'. |
|
982 elem := pList item:0. |
|
983 newCdata := doc createCDATASection:'CDATA'. |
|
984 appendedChild := elem appendChild:newCdata. |
|
985 domConfig := doc domConfig. |
|
986 domConfig setParameter: 'cdata-sections' value: false. |
|
987 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
988 doc normalize. |
|
989 errorMonitor assertLowerSeverityFor: self message:'normalizationError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
990 pList := doc getElementsByTagName: 'p'. |
|
991 elem := pList item:0. |
|
992 cdata := elem lastChild. |
|
993 nodeName := cdata nodeName. |
|
994 self assert: ( nodeName = '#cdata-section' ). |
|
995 |
|
996 ! |
|
997 |
|
998 test_checkcharacternormalization01 |
|
999 " |
|
1000 Normalize document with check-character-normalization set to false, check that |
|
1001 no errors are dispatched. |
|
1002 |
|
1003 Creator: Curt Arnold |
|
1004 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1005 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-check-character-normalization |
|
1006 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
1007 " |
|
1008 | |
|
1009 doc "Document" |
|
1010 docElem "Element" |
|
1011 domConfig "DOMConfiguration" |
|
1012 errorMonitor "DOMErrorMonitor" |
|
1013 pList "NodeList" |
|
1014 pElem "Element" |
|
1015 text "Text" |
|
1016 textValue "String" |
|
1017 retval "Node" |
|
1018 | |
|
1019 "implementationAttribute not supported: namespaceAware" |
|
1020 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
1021 domConfig := doc domConfig. |
|
1022 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
1023 domConfig setParameter: 'check-character-normalization' value: false. |
|
1024 pList := doc getElementsByTagName: 'p'. |
|
1025 pElem := pList item:0. |
|
1026 text := doc createTextNode:'suçon'. |
|
1027 retval := pElem appendChild:text. |
|
1028 doc normalizeDocument. |
|
1029 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
1030 pList := doc getElementsByTagName: 'p'. |
|
1031 pElem := pList item:0. |
|
1032 text := pElem firstChild. |
|
1033 textValue := text nodeValue. |
|
1034 self assert: ( textValue = 'barsuçon' ). |
|
1035 |
|
1036 ! |
|
1037 |
|
1038 test_checkcharacternormalization02 |
|
1039 " |
|
1040 Normalize document with check-character-normalization set to true, check that |
|
1041 non-normalized characters are signaled. |
|
1042 |
|
1043 Creator: Curt Arnold |
|
1044 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1045 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-check-character-normalization |
|
1046 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
1047 " |
|
1048 | |
|
1049 doc "Document" |
|
1050 docElem "Element" |
|
1051 domConfig "DOMConfiguration" |
|
1052 errorMonitor "DOMErrorMonitor" |
|
1053 pList "NodeList" |
|
1054 pElem "Element" |
|
1055 text "Text" |
|
1056 textValue "String" |
|
1057 retval "Node" |
|
1058 canSet "Boolean" |
|
1059 errors "List" |
|
1060 error "DOMError" |
|
1061 severity "SmallInteger" |
|
1062 locator "DOMLocator" |
|
1063 relatedNode "Node" |
|
1064 errorCount "SmallInteger" |
|
1065 errorType "String" |
|
1066 | |
|
1067 "implementationAttribute not supported: namespaceAware" |
|
1068 errorCount := 0. |
|
1069 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
1070 domConfig := doc domConfig. |
|
1071 canSet := domConfig canSetParameter: 'check-character-normalization' value: true. |
|
1072 "if" |
|
1073 (canSet) ifTrue: [ |
|
1074 severity := error severity. |
|
1075 "if" |
|
1076 ( severity = 2 ) ifTrue: [ |
|
1077 ]. |
|
1078 ]. |
|
1079 |
|
1080 ! |
|
1081 |
|
1082 test_checkcharacternormalization03 |
|
1083 " |
|
1084 Normalize document using Node.normalize checking that check-character-normalization |
|
1085 is ignored. |
|
1086 |
|
1087 Creator: Curt Arnold |
|
1088 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
1089 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-check-character-normalization |
|
1090 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
1091 " |
|
1092 | |
|
1093 doc "Document" |
|
1094 docElem "Element" |
|
1095 domConfig "DOMConfiguration" |
|
1096 errorMonitor "DOMErrorMonitor" |
|
1097 pList "NodeList" |
|
1098 pElem "Element" |
|
1099 text "Text" |
|
1100 textValue "String" |
|
1101 retval "Node" |
|
1102 canSet "Boolean" |
|
1103 | |
|
1104 "implementationAttribute not supported: namespaceAware" |
|
1105 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
1106 domConfig := doc domConfig. |
|
1107 canSet := domConfig canSetParameter: 'check-character-normalization' value: true. |
|
1108 "if" |
|
1109 (canSet) ifTrue: [ |
|
1110 ]. |
|
1111 |
|
1112 ! |
|
1113 |
|
1114 test_comments01 |
|
1115 " |
|
1116 Check that Node.normalize ignores the setting of configuration parameter 'comments'. |
|
1117 |
|
1118 Creator: Curt Arnold |
|
1119 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
1120 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-comments |
|
1121 " |
|
1122 | |
|
1123 doc "Document" |
|
1124 elem "Element" |
|
1125 newComment "Comment" |
|
1126 lastChild "Node" |
|
1127 text "Text" |
|
1128 nodeName "String" |
|
1129 appendedChild "Node" |
|
1130 domConfig "DOMConfiguration" |
|
1131 errorMonitor "DOMErrorMonitor" |
|
1132 pList "NodeList" |
|
1133 | |
|
1134 "implementationAttribute not supported: namespaceAware" |
|
1135 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
1136 pList := doc getElementsByTagName: 'p'. |
|
1137 elem := pList item:0. |
|
1138 newComment := doc createComment:'COMMENT_NODE'. |
|
1139 appendedChild := elem appendChild:newComment. |
|
1140 domConfig := doc domConfig. |
|
1141 domConfig setParameter: 'comments' value: false. |
|
1142 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
1143 doc normalize. |
|
1144 errorMonitor assertLowerSeverityFor: self message:'normalizationError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
1145 pList := doc getElementsByTagName: 'p'. |
|
1146 elem := pList item:0. |
|
1147 lastChild := elem lastChild. |
|
1148 nodeName := lastChild nodeName. |
|
1149 self assert: ( nodeName = '#comment' ). |
|
1150 |
|
1151 ! |
|
1152 |
|
1153 test_datatypenormalization01 |
|
1154 " |
|
1155 Normalize document with datatype-normalization set to true. |
|
1156 Check if double values were normalized. |
|
1157 |
|
1158 Creator: Curt Arnold |
|
1159 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1160 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1161 " |
|
1162 | |
|
1163 doc "Document" |
|
1164 elemList "NodeList" |
|
1165 element "Element" |
|
1166 domConfig "DOMConfiguration" |
|
1167 str "String" |
|
1168 canSetNormalization "Boolean" |
|
1169 canSetValidate "Boolean" |
|
1170 canSetXMLSchema "Boolean" |
|
1171 xsdNS "String" |
|
1172 errorMonitor "DOMErrorMonitor" |
|
1173 | |
|
1174 "implementationAttribute not supported: namespaceAware" |
|
1175 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1176 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1177 domConfig := doc domConfig. |
|
1178 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1179 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1180 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1181 "if" |
|
1182 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1183 ]. |
|
1184 |
|
1185 ! |
|
1186 |
|
1187 test_datatypenormalization02 |
|
1188 " |
|
1189 Normalize document with datatype-normalization set to true. |
|
1190 Check if decimal values were normalized. |
|
1191 |
|
1192 Creator: Curt Arnold |
|
1193 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1194 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1195 " |
|
1196 | |
|
1197 doc "Document" |
|
1198 elemList "NodeList" |
|
1199 element "Element" |
|
1200 domConfig "DOMConfiguration" |
|
1201 str "String" |
|
1202 canSetNormalization "Boolean" |
|
1203 canSetValidate "Boolean" |
|
1204 canSetXMLSchema "Boolean" |
|
1205 xsdNS "String" |
|
1206 errorMonitor "DOMErrorMonitor" |
|
1207 | |
|
1208 "implementationAttribute not supported: namespaceAware" |
|
1209 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1210 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1211 domConfig := doc domConfig. |
|
1212 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1213 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1214 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1215 "if" |
|
1216 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1217 ]. |
|
1218 |
|
1219 ! |
|
1220 |
|
1221 test_datatypenormalization03 |
|
1222 " |
|
1223 Normalize document with datatype-normalization set to true. |
|
1224 Check if boolean values were whitespace normalized. |
|
1225 |
|
1226 Creator: Curt Arnold |
|
1227 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1228 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1229 " |
|
1230 | |
|
1231 doc "Document" |
|
1232 elemList "NodeList" |
|
1233 element "Element" |
|
1234 domConfig "DOMConfiguration" |
|
1235 str "String" |
|
1236 canSetNormalization "Boolean" |
|
1237 canSetValidate "Boolean" |
|
1238 canSetXMLSchema "Boolean" |
|
1239 xsdNS "String" |
|
1240 errorMonitor "DOMErrorMonitor" |
|
1241 | |
|
1242 "implementationAttribute not supported: namespaceAware" |
|
1243 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1244 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1245 domConfig := doc domConfig. |
|
1246 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1247 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1248 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1249 "if" |
|
1250 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1251 ]. |
|
1252 |
|
1253 ! |
|
1254 |
|
1255 test_datatypenormalization04 |
|
1256 " |
|
1257 Normalize document with datatype-normalization set to true. |
|
1258 Check if float values were normalized. |
|
1259 |
|
1260 Creator: Curt Arnold |
|
1261 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1262 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1263 " |
|
1264 | |
|
1265 doc "Document" |
|
1266 elemList "NodeList" |
|
1267 element "Element" |
|
1268 domConfig "DOMConfiguration" |
|
1269 str "String" |
|
1270 canSetNormalization "Boolean" |
|
1271 canSetValidate "Boolean" |
|
1272 canSetXMLSchema "Boolean" |
|
1273 xsdNS "String" |
|
1274 errorMonitor "DOMErrorMonitor" |
|
1275 | |
|
1276 "implementationAttribute not supported: namespaceAware" |
|
1277 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1278 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1279 domConfig := doc domConfig. |
|
1280 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1281 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1282 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1283 "if" |
|
1284 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1285 ]. |
|
1286 |
|
1287 ! |
|
1288 |
|
1289 test_datatypenormalization05 |
|
1290 " |
|
1291 Normalize document with datatype-normalization set to true. |
|
1292 Check if dateTime values were correctly normalized. |
|
1293 |
|
1294 Creator: Curt Arnold |
|
1295 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1296 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1297 " |
|
1298 | |
|
1299 doc "Document" |
|
1300 elemList "NodeList" |
|
1301 element "Element" |
|
1302 domConfig "DOMConfiguration" |
|
1303 str "String" |
|
1304 canSetNormalization "Boolean" |
|
1305 canSetValidate "Boolean" |
|
1306 canSetXMLSchema "Boolean" |
|
1307 xsdNS "String" |
|
1308 errorMonitor "DOMErrorMonitor" |
|
1309 | |
|
1310 "implementationAttribute not supported: namespaceAware" |
|
1311 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1312 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1313 domConfig := doc domConfig. |
|
1314 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1315 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1316 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1317 "if" |
|
1318 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1319 ]. |
|
1320 |
|
1321 ! |
|
1322 |
|
1323 test_datatypenormalization06 |
|
1324 " |
|
1325 Normalize document with datatype-normalization set to true. |
|
1326 Check if time values were normalized. |
|
1327 |
|
1328 Creator: Curt Arnold |
|
1329 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1330 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1331 " |
|
1332 | |
|
1333 doc "Document" |
|
1334 elemList "NodeList" |
|
1335 element "Element" |
|
1336 domConfig "DOMConfiguration" |
|
1337 str "String" |
|
1338 canSetNormalization "Boolean" |
|
1339 canSetValidate "Boolean" |
|
1340 canSetXMLSchema "Boolean" |
|
1341 xsdNS "String" |
|
1342 errorMonitor "DOMErrorMonitor" |
|
1343 | |
|
1344 "implementationAttribute not supported: namespaceAware" |
|
1345 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1346 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1347 domConfig := doc domConfig. |
|
1348 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1349 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1350 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1351 "if" |
|
1352 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1353 ]. |
|
1354 |
|
1355 ! |
|
1356 |
|
1357 test_datatypenormalization07 |
|
1358 " |
|
1359 The default value for the double element must be provided in canonical lexical form. |
|
1360 |
|
1361 Creator: Curt Arnold |
|
1362 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1363 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1364 " |
|
1365 | |
|
1366 doc "Document" |
|
1367 elemList "NodeList" |
|
1368 element "Element" |
|
1369 domConfig "DOMConfiguration" |
|
1370 str "String" |
|
1371 canSetNormalization "Boolean" |
|
1372 canSetValidate "Boolean" |
|
1373 canSetXMLSchema "Boolean" |
|
1374 xsdNS "String" |
|
1375 errorMonitor "DOMErrorMonitor" |
|
1376 | |
|
1377 "implementationAttribute not supported: namespaceAware" |
|
1378 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1379 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1380 domConfig := doc domConfig. |
|
1381 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1382 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1383 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1384 "if" |
|
1385 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1386 ]. |
|
1387 |
|
1388 ! |
|
1389 |
|
1390 test_datatypenormalization08 |
|
1391 " |
|
1392 The default value for the decimal element must be provided in canonical lexical form. |
|
1393 |
|
1394 Creator: Curt Arnold |
|
1395 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1396 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1397 " |
|
1398 | |
|
1399 doc "Document" |
|
1400 elemList "NodeList" |
|
1401 element "Element" |
|
1402 domConfig "DOMConfiguration" |
|
1403 str "String" |
|
1404 canSetNormalization "Boolean" |
|
1405 canSetValidate "Boolean" |
|
1406 canSetXMLSchema "Boolean" |
|
1407 xsdNS "String" |
|
1408 errorMonitor "DOMErrorMonitor" |
|
1409 | |
|
1410 "implementationAttribute not supported: namespaceAware" |
|
1411 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1412 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1413 domConfig := doc domConfig. |
|
1414 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1415 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1416 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1417 "if" |
|
1418 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1419 ]. |
|
1420 |
|
1421 ! |
|
1422 |
|
1423 test_datatypenormalization09 |
|
1424 " |
|
1425 The default value for the boolean element must be provided in canonical lexical form. |
|
1426 |
|
1427 Creator: Curt Arnold |
|
1428 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1429 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1430 " |
|
1431 | |
|
1432 doc "Document" |
|
1433 elemList "NodeList" |
|
1434 element "Element" |
|
1435 domConfig "DOMConfiguration" |
|
1436 str "String" |
|
1437 canSetNormalization "Boolean" |
|
1438 canSetValidate "Boolean" |
|
1439 canSetXMLSchema "Boolean" |
|
1440 xsdNS "String" |
|
1441 errorMonitor "DOMErrorMonitor" |
|
1442 | |
|
1443 "implementationAttribute not supported: namespaceAware" |
|
1444 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1445 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1446 domConfig := doc domConfig. |
|
1447 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1448 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1449 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1450 "if" |
|
1451 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1452 ]. |
|
1453 |
|
1454 ! |
|
1455 |
|
1456 test_datatypenormalization10 |
|
1457 " |
|
1458 The default value for the float element must be provided in canonical lexical form. |
|
1459 |
|
1460 Creator: Curt Arnold |
|
1461 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1462 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1463 " |
|
1464 | |
|
1465 doc "Document" |
|
1466 elemList "NodeList" |
|
1467 element "Element" |
|
1468 domConfig "DOMConfiguration" |
|
1469 str "String" |
|
1470 canSetNormalization "Boolean" |
|
1471 canSetValidate "Boolean" |
|
1472 canSetXMLSchema "Boolean" |
|
1473 xsdNS "String" |
|
1474 errorMonitor "DOMErrorMonitor" |
|
1475 | |
|
1476 "implementationAttribute not supported: namespaceAware" |
|
1477 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1478 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1479 domConfig := doc domConfig. |
|
1480 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1481 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1482 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1483 "if" |
|
1484 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1485 ]. |
|
1486 |
|
1487 ! |
|
1488 |
|
1489 test_datatypenormalization11 |
|
1490 " |
|
1491 The default value for the dateTime element must be provided in canonical lexical form. |
|
1492 |
|
1493 Creator: Curt Arnold |
|
1494 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1495 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1496 " |
|
1497 | |
|
1498 doc "Document" |
|
1499 elemList "NodeList" |
|
1500 element "Element" |
|
1501 domConfig "DOMConfiguration" |
|
1502 str "String" |
|
1503 canSetNormalization "Boolean" |
|
1504 canSetValidate "Boolean" |
|
1505 canSetXMLSchema "Boolean" |
|
1506 xsdNS "String" |
|
1507 errorMonitor "DOMErrorMonitor" |
|
1508 | |
|
1509 "implementationAttribute not supported: namespaceAware" |
|
1510 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1511 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1512 domConfig := doc domConfig. |
|
1513 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1514 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1515 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1516 "if" |
|
1517 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1518 ]. |
|
1519 |
|
1520 ! |
|
1521 |
|
1522 test_datatypenormalization12 |
|
1523 " |
|
1524 Default values must be provided in canonical lexical form. |
|
1525 |
|
1526 Creator: Curt Arnold |
|
1527 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1528 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1529 " |
|
1530 | |
|
1531 doc "Document" |
|
1532 elemList "NodeList" |
|
1533 element "Element" |
|
1534 domConfig "DOMConfiguration" |
|
1535 str "String" |
|
1536 canSetNormalization "Boolean" |
|
1537 canSetValidate "Boolean" |
|
1538 canSetXMLSchema "Boolean" |
|
1539 xsdNS "String" |
|
1540 errorMonitor "DOMErrorMonitor" |
|
1541 | |
|
1542 "implementationAttribute not supported: namespaceAware" |
|
1543 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1544 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization'). |
|
1545 domConfig := doc domConfig. |
|
1546 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1547 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1548 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1549 "if" |
|
1550 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1551 ]. |
|
1552 |
|
1553 ! |
|
1554 |
|
1555 test_datatypenormalization13 |
|
1556 " |
|
1557 Normalize document with datatype-normalization set to true. |
|
1558 Check if string values were normalized per default whitespace |
|
1559 facet of xsd:string. |
|
1560 |
|
1561 Creator: Curt Arnold |
|
1562 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1563 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1564 " |
|
1565 | |
|
1566 doc "Document" |
|
1567 elemList "NodeList" |
|
1568 element "Element" |
|
1569 domConfig "DOMConfiguration" |
|
1570 str "String" |
|
1571 canSetNormalization "Boolean" |
|
1572 canSetValidate "Boolean" |
|
1573 canSetXMLSchema "Boolean" |
|
1574 xsdNS "String" |
|
1575 errorMonitor "DOMErrorMonitor" |
|
1576 childNode "Node" |
|
1577 childValue "String" |
|
1578 | |
|
1579 "implementationAttribute not supported: namespaceAware" |
|
1580 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1581 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization2'). |
|
1582 domConfig := doc domConfig. |
|
1583 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1584 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1585 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1586 "if" |
|
1587 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1588 ]. |
|
1589 |
|
1590 ! |
|
1591 |
|
1592 test_datatypenormalization14 |
|
1593 " |
|
1594 Normalize document with datatype-normalization set to true. |
|
1595 Check if string values were normalized per explicit whitespace=preserve. |
|
1596 |
|
1597 Creator: Curt Arnold |
|
1598 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1599 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1600 " |
|
1601 | |
|
1602 doc "Document" |
|
1603 elemList "NodeList" |
|
1604 element "Element" |
|
1605 domConfig "DOMConfiguration" |
|
1606 str "String" |
|
1607 canSetNormalization "Boolean" |
|
1608 canSetValidate "Boolean" |
|
1609 canSetXMLSchema "Boolean" |
|
1610 xsdNS "String" |
|
1611 errorMonitor "DOMErrorMonitor" |
|
1612 childNode "Node" |
|
1613 childValue "String" |
|
1614 | |
|
1615 "implementationAttribute not supported: namespaceAware" |
|
1616 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1617 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization2'). |
|
1618 domConfig := doc domConfig. |
|
1619 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1620 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1621 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1622 "if" |
|
1623 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1624 ]. |
|
1625 |
|
1626 ! |
|
1627 |
|
1628 test_datatypenormalization15 |
|
1629 " |
|
1630 Normalize document with datatype-normalization set to true. |
|
1631 Check if string values were normalized per an explicit whitespace=collapse. |
|
1632 |
|
1633 Creator: Curt Arnold |
|
1634 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1635 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1636 " |
|
1637 | |
|
1638 doc "Document" |
|
1639 elemList "NodeList" |
|
1640 element "Element" |
|
1641 domConfig "DOMConfiguration" |
|
1642 str "String" |
|
1643 canSetNormalization "Boolean" |
|
1644 canSetValidate "Boolean" |
|
1645 canSetXMLSchema "Boolean" |
|
1646 xsdNS "String" |
|
1647 errorMonitor "DOMErrorMonitor" |
|
1648 childNode "Node" |
|
1649 childValue "String" |
|
1650 | |
|
1651 "implementationAttribute not supported: namespaceAware" |
|
1652 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1653 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization2'). |
|
1654 domConfig := doc domConfig. |
|
1655 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1656 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1657 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1658 "if" |
|
1659 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1660 ]. |
|
1661 |
|
1662 ! |
|
1663 |
|
1664 test_datatypenormalization16 |
|
1665 " |
|
1666 Normalize document with datatype-normalization set to true. |
|
1667 Check if string values were normalized per explicit whitespace=replace. |
|
1668 |
|
1669 Creator: Curt Arnold |
|
1670 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1671 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1672 " |
|
1673 | |
|
1674 doc "Document" |
|
1675 elemList "NodeList" |
|
1676 element "Element" |
|
1677 domConfig "DOMConfiguration" |
|
1678 str "String" |
|
1679 canSetNormalization "Boolean" |
|
1680 canSetValidate "Boolean" |
|
1681 canSetXMLSchema "Boolean" |
|
1682 xsdNS "String" |
|
1683 errorMonitor "DOMErrorMonitor" |
|
1684 childNode "Node" |
|
1685 childValue "String" |
|
1686 | |
|
1687 "implementationAttribute not supported: namespaceAware" |
|
1688 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1689 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization2'). |
|
1690 domConfig := doc domConfig. |
|
1691 canSetNormalization := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1692 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1693 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1694 "if" |
|
1695 (canSetNormalization) and: [(canSetValidate) and: [(canSetXMLSchema)]] ifTrue: [ |
|
1696 ]. |
|
1697 |
|
1698 ! |
|
1699 |
|
1700 test_datatypenormalization17 |
|
1701 " |
|
1702 Normalize document with datatype-normalization set to false, string values |
|
1703 should not be normalized. |
|
1704 |
|
1705 Creator: Curt Arnold |
|
1706 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
1707 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1708 " |
|
1709 | |
|
1710 doc "Document" |
|
1711 elemList "NodeList" |
|
1712 element "Element" |
|
1713 domConfig "DOMConfiguration" |
|
1714 str "String" |
|
1715 canSetValidate "Boolean" |
|
1716 canSetXMLSchema "Boolean" |
|
1717 xsdNS "String" |
|
1718 errorMonitor "DOMErrorMonitor" |
|
1719 childNode "Node" |
|
1720 childValue "String" |
|
1721 | |
|
1722 "implementationAttribute not supported: namespaceAware" |
|
1723 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1724 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization2'). |
|
1725 domConfig := doc domConfig. |
|
1726 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1727 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1728 "if" |
|
1729 (canSetValidate) and: [(canSetXMLSchema)] ifTrue: [ |
|
1730 ]. |
|
1731 |
|
1732 ! |
|
1733 |
|
1734 test_datatypenormalization18 |
|
1735 " |
|
1736 Normalize document using Node.normalize which is not affected by DOMConfiguration unlike |
|
1737 Document.normalizeDocument. Strings should not have been normalized. |
|
1738 |
|
1739 Creator: Curt Arnold |
|
1740 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
1741 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
1742 " |
|
1743 | |
|
1744 doc "Document" |
|
1745 elemList "NodeList" |
|
1746 element "Element" |
|
1747 domConfig "DOMConfiguration" |
|
1748 str "String" |
|
1749 canSetValidate "Boolean" |
|
1750 canSetXMLSchema "Boolean" |
|
1751 canSetDataNorm "Boolean" |
|
1752 xsdNS "String" |
|
1753 errorMonitor "DOMErrorMonitor" |
|
1754 childNode "Node" |
|
1755 childValue "String" |
|
1756 | |
|
1757 "implementationAttribute not supported: namespaceAware" |
|
1758 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
1759 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization2'). |
|
1760 domConfig := doc domConfig. |
|
1761 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
1762 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
1763 canSetDataNorm := domConfig canSetParameter: 'datatype-normalization' value: true. |
|
1764 "if" |
|
1765 (canSetValidate) and: [(canSetXMLSchema) and: [(canSetDataNorm)]] ifTrue: [ |
|
1766 ]. |
|
1767 |
|
1768 ! |
|
1769 |
|
1770 test_documentadoptnode01 |
|
1771 " |
|
1772 Adopt the class attribute node of the fourth acronym element. Check if this attribute has been adopted successfully by verifying the |
|
1773 nodeName, nodeType, nodeValue, specified and ownerElement attributes of the adopted node. |
|
1774 |
|
1775 Creator: IBM |
|
1776 Autor Neil Delima |
|
1777 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
1778 " |
|
1779 | |
|
1780 doc "Document" |
|
1781 attrOwnerElem "Element" |
|
1782 element "Element" |
|
1783 attr "Attr" |
|
1784 childList "NodeList" |
|
1785 adoptedclass "Node" |
|
1786 attrsParent "Node" |
|
1787 nodeName "String" |
|
1788 nodeType "SmallInteger" |
|
1789 nodeValue "String" |
|
1790 firstChild "Text" |
|
1791 firstChildValue "String" |
|
1792 secondChild "EntityReference" |
|
1793 secondChildType "SmallInteger" |
|
1794 secondChildName "String" |
|
1795 | |
|
1796 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
1797 childList := doc getElementsByTagName: 'acronym'. |
|
1798 element := childList item:3. |
|
1799 attr := element getAttributeNode:'class'. |
|
1800 adoptedclass := doc adoptNode: attr. |
|
1801 "if" |
|
1802 ( adoptedclass notNil ) ifTrue: [ |
|
1803 self assert:false description:'Method "equals" is not supported yet'. |
|
1804 secondChild := firstChild nextSibling. |
|
1805 self assert: secondChild notNil. |
|
1806 secondChildType := secondChild nodeType. |
|
1807 self assert: ( secondChildType = 5 ). |
|
1808 secondChildName := secondChild nodeName. |
|
1809 self assert: ( secondChildName = 'alpha' ). |
|
1810 self assert:false description:'Method "else" is not supported yet'. |
|
1811 ]. |
|
1812 |
|
1813 ! |
|
1814 |
|
1815 test_documentadoptnode02 |
|
1816 " |
|
1817 Adopt the class attribute node of the fourth acronym element. Check if this attribute has been adopted |
|
1818 successfully by verifying the nodeName, nodeType, ownerElement, specified attributes and child nodes |
|
1819 of the adopted node. |
|
1820 |
|
1821 Creator: IBM |
|
1822 Autor Neil Delima |
|
1823 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
1824 " |
|
1825 | |
|
1826 doc "Document" |
|
1827 newDoc "Document" |
|
1828 domImpl "DOMImplementation" |
|
1829 attrOwnerElem "Element" |
|
1830 element "Element" |
|
1831 attr "Attr" |
|
1832 childList "NodeList" |
|
1833 adoptedclass "Node" |
|
1834 attrsParent "Node" |
|
1835 nodeName "String" |
|
1836 nodeType "SmallInteger" |
|
1837 nodeValue "String" |
|
1838 isSpecified "Boolean" |
|
1839 nullDocType "DocumentType" |
|
1840 firstChild "Text" |
|
1841 firstChildValue "String" |
|
1842 secondChild "EntityReference" |
|
1843 secondChildType "SmallInteger" |
|
1844 secondChildName "String" |
|
1845 docElem "Element" |
|
1846 rootNS "String" |
|
1847 rootName "String" |
|
1848 | |
|
1849 nullDocType := nil. |
|
1850 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
1851 docElem := doc documentElement. |
|
1852 rootName := docElem tagName. |
|
1853 rootNS := docElem namespaceURI. |
|
1854 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
1855 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
1856 childList := doc getElementsByTagName: 'acronym'. |
|
1857 element := childList item:3. |
|
1858 attr := element getAttributeNode:'class'. |
|
1859 adoptedclass := newDoc adoptNode: attr. |
|
1860 "if" |
|
1861 ( adoptedclass notNil ) ifTrue: [ |
|
1862 self assert:false description:'Method "equals" is not supported yet'. |
|
1863 secondChild := firstChild nextSibling. |
|
1864 self assert: secondChild notNil. |
|
1865 secondChildType := secondChild nodeType. |
|
1866 self assert: ( secondChildType = 5 ). |
|
1867 secondChildName := secondChild nodeName. |
|
1868 self assert: ( secondChildName = 'alpha' ). |
|
1869 self assert:false description:'Method "else" is not supported yet'. |
|
1870 ]. |
|
1871 |
|
1872 ! |
|
1873 |
|
1874 test_documentadoptnode03 |
|
1875 " |
|
1876 Invoke adoptNode on this document to adopt the a new namespace aware attribute node. Check |
|
1877 if this attribute has been adopted successfully by verifying the nodeName, namespaceURI, prefix, |
|
1878 specified and ownerElement attributes of the adopted node. |
|
1879 |
|
1880 Creator: IBM |
|
1881 Autor Neil Delima |
|
1882 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
1883 " |
|
1884 | |
|
1885 doc "Document" |
|
1886 newAttr "Attr" |
|
1887 adoptedAttr "Attr" |
|
1888 nodeName "String" |
|
1889 nodeNamespaceURI "String" |
|
1890 nodePrefix "String" |
|
1891 attrOwnerElem "Element" |
|
1892 isSpecified "Boolean" |
|
1893 xmlNS "String" |
|
1894 | |
|
1895 xmlNS := 'http://www.w3.org/XML/1998/namespace'. |
|
1896 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
1897 newAttr := doc createAttribute:'xml:lang' ns:xmlNS. |
|
1898 adoptedAttr := doc adoptNode: newAttr. |
|
1899 "if" |
|
1900 ( adoptedAttr notNil ) ifTrue: [ |
|
1901 ]. |
|
1902 |
|
1903 ! |
|
1904 |
|
1905 test_documentadoptnode04 |
|
1906 " |
|
1907 Invoke adoptNode on a new document to adopt a new namespace aware attribute node created by |
|
1908 this document. Check if this attribute has been adopted successfully by verifying the nodeName, |
|
1909 namespaceURI, prefix, specified and ownerElement attributes of the adopted node. |
|
1910 |
|
1911 Creator: IBM |
|
1912 Autor Neil Delima |
|
1913 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
1914 " |
|
1915 | |
|
1916 doc "Document" |
|
1917 newDoc "Document" |
|
1918 domImpl "DOMImplementation" |
|
1919 newAttr "Attr" |
|
1920 adoptedAttr "Attr" |
|
1921 nodeName "String" |
|
1922 nodeNamespaceURI "String" |
|
1923 nodePrefix "String" |
|
1924 attrOwnerElem "Element" |
|
1925 isSpecified "Boolean" |
|
1926 nullDocType "DocumentType" |
|
1927 docElem "Element" |
|
1928 rootNS "String" |
|
1929 rootName "String" |
|
1930 xmlNS "String" |
|
1931 | |
|
1932 nullDocType := nil. |
|
1933 xmlNS := 'http://www.w3.org/XML/1998/namespace'. |
|
1934 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
1935 docElem := doc documentElement. |
|
1936 rootName := docElem tagName. |
|
1937 rootNS := docElem namespaceURI. |
|
1938 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
1939 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
1940 newAttr := doc createAttribute:'xml:lang' ns:xmlNS. |
|
1941 adoptedAttr := newDoc adoptNode: newAttr. |
|
1942 "if" |
|
1943 ( adoptedAttr notNil ) ifTrue: [ |
|
1944 ]. |
|
1945 |
|
1946 ! |
|
1947 |
|
1948 test_documentadoptnode05 |
|
1949 " |
|
1950 Invoke adoptNode on a new document to adopt the default attribute dir . Check if |
|
1951 this attribute has been adopted successfully by verifying the nodeName, namespaceURI, prefix, |
|
1952 specified and ownerElement attributes of the adopted node. |
|
1953 |
|
1954 Creator: IBM |
|
1955 Autor Neil Delima |
|
1956 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
1957 " |
|
1958 | |
|
1959 doc "Document" |
|
1960 newDoc "Document" |
|
1961 domImpl "DOMImplementation" |
|
1962 elementEmp "Element" |
|
1963 childList "NodeList" |
|
1964 dir "Attr" |
|
1965 adoptedAttr "Node" |
|
1966 nodeName "String" |
|
1967 nodeNamespaceURI "String" |
|
1968 nodePrefix "String" |
|
1969 attrOwnerElem "Element" |
|
1970 isSpecified "Boolean" |
|
1971 nullDocType "DocumentType" |
|
1972 docElem "Element" |
|
1973 rootNS "String" |
|
1974 rootName "String" |
|
1975 | |
|
1976 nullDocType := nil. |
|
1977 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
1978 docElem := doc documentElement. |
|
1979 rootName := docElem tagName. |
|
1980 rootNS := docElem namespaceURI. |
|
1981 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
1982 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
1983 childList := doc getElementsByTagName: 'p'. |
|
1984 elementEmp := childList item:3. |
|
1985 dir := elementEmp getAttributeNode:'dir'. |
|
1986 adoptedAttr := newDoc adoptNode: dir. |
|
1987 "if" |
|
1988 ( adoptedAttr notNil ) ifTrue: [ |
|
1989 ]. |
|
1990 |
|
1991 ! |
|
1992 |
|
1993 test_documentadoptnode06 |
|
1994 " |
|
1995 Invoke adoptNode on a new document to adopt the a new Attribute node having a Text and an EntityReference |
|
1996 child. Check if this attribute has been adopted successfully by verifying the nodeName, namespaceURI, prefix, |
|
1997 specified and ownerElement attributes of the adopted node. Also verify the ownerDocument attribute |
|
1998 of the adopted node and the adopted children of the attribute node. |
|
1999 |
|
2000 Creator: IBM |
|
2001 Autor Neil Delima |
|
2002 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2003 " |
|
2004 | |
|
2005 doc "Document" |
|
2006 newDoc "Document" |
|
2007 domImpl "DOMImplementation" |
|
2008 newAttr "Attr" |
|
2009 newText "Text" |
|
2010 newEntRef "EntityReference" |
|
2011 adoptedAttr "Attr" |
|
2012 adoptText "Text" |
|
2013 adoptEntRef "EntityReference" |
|
2014 nodeList "NodeList" |
|
2015 nodeName "String" |
|
2016 nodeNamespaceURI "String" |
|
2017 nodePrefix "String" |
|
2018 attrOwnerElem "Element" |
|
2019 isSpecified "Boolean" |
|
2020 adoptedTextNodeValue "String" |
|
2021 adoptedEntRefNodeValue "String" |
|
2022 nullDocType "DocumentType" |
|
2023 appendedChild "Node" |
|
2024 docElem "Element" |
|
2025 rootNS "String" |
|
2026 rootName "String" |
|
2027 xmlNS "String" |
|
2028 | |
|
2029 nullDocType := nil. |
|
2030 xmlNS := 'http://www.w3.org/XML/1998/namespace'. |
|
2031 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2032 docElem := doc documentElement. |
|
2033 rootName := docElem tagName. |
|
2034 rootNS := docElem namespaceURI. |
|
2035 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2036 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2037 newAttr := doc createAttribute:'xml:lang' ns:xmlNS. |
|
2038 newText := doc createTextNode:'Text Node'. |
|
2039 newEntRef := doc createEntityReference:'alpha'. |
|
2040 appendedChild := newAttr appendChild:newText. |
|
2041 appendedChild := newAttr appendChild:newEntRef. |
|
2042 adoptedAttr := newDoc adoptNode: newAttr. |
|
2043 "if" |
|
2044 ( adoptedAttr notNil ) ifTrue: [ |
|
2045 ]. |
|
2046 |
|
2047 ! |
|
2048 |
|
2049 test_documentadoptnode07 |
|
2050 " |
|
2051 Invoke the adoptNode method on this document with the value of the source parameter as itself. |
|
2052 Verify if a NOT_SUPPORTED_ERR is thrown. |
|
2053 |
|
2054 Creator: IBM |
|
2055 Autor Neil Delima |
|
2056 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2057 " |
|
2058 | |
|
2059 doc "Document" |
|
2060 adoptedDoc "Node" |
|
2061 | |
|
2062 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2063 "assertDOMException..." |
|
2064 self should:[ |
|
2065 adoptedDoc := doc adoptNode: doc. |
|
2066 ] raise: DOMException. |
|
2067 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
2068 "end of assertDOMException..." |
|
2069 |
|
2070 ! |
|
2071 |
|
2072 test_documentadoptnode08 |
|
2073 " |
|
2074 Invoke the adoptNode method on this document with a new document as the value of the |
|
2075 source parameter. Verify if a NOT_SUPPORTED_ERR is thrown. |
|
2076 |
|
2077 Creator: IBM |
|
2078 Autor Neil Delima |
|
2079 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2080 " |
|
2081 | |
|
2082 doc "Document" |
|
2083 newDoc "Document" |
|
2084 domImpl "DOMImplementation" |
|
2085 adoptedDoc "Node" |
|
2086 nullDocType "DocumentType" |
|
2087 docElem "Element" |
|
2088 rootNS "String" |
|
2089 rootName "String" |
|
2090 | |
|
2091 nullDocType := nil. |
|
2092 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2093 docElem := doc documentElement. |
|
2094 rootName := docElem tagName. |
|
2095 rootNS := docElem namespaceURI. |
|
2096 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2097 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2098 "assertDOMException..." |
|
2099 self should:[ |
|
2100 adoptedDoc := doc adoptNode: newDoc. |
|
2101 ] raise: DOMException. |
|
2102 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
2103 "end of assertDOMException..." |
|
2104 |
|
2105 ! |
|
2106 |
|
2107 test_documentadoptnode09 |
|
2108 " |
|
2109 Invoke the adoptNode method on a new document with this document as the value of the |
|
2110 source parameter. Verify if a NOT_SUPPORTED_ERR is thrown. |
|
2111 |
|
2112 Creator: IBM |
|
2113 Autor Neil Delima |
|
2114 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2115 " |
|
2116 | |
|
2117 doc "Document" |
|
2118 newDoc "Document" |
|
2119 domImpl "DOMImplementation" |
|
2120 adoptedDoc "Node" |
|
2121 nullDocType "DocumentType" |
|
2122 docElem "Element" |
|
2123 rootNS "String" |
|
2124 rootName "String" |
|
2125 | |
|
2126 nullDocType := nil. |
|
2127 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2128 docElem := doc documentElement. |
|
2129 rootName := docElem tagName. |
|
2130 rootNS := docElem namespaceURI. |
|
2131 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2132 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2133 "assertDOMException..." |
|
2134 self should:[ |
|
2135 adoptedDoc := newDoc adoptNode: doc. |
|
2136 ] raise: DOMException. |
|
2137 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
2138 "end of assertDOMException..." |
|
2139 |
|
2140 ! |
|
2141 |
|
2142 test_documentadoptnode10 |
|
2143 " |
|
2144 Invoke the adoptNode method on this document with the value of the source parameter as this |
|
2145 documents doctype node. Verify if a NOT_SUPPORTED_ERR is thrown. |
|
2146 |
|
2147 Creator: IBM |
|
2148 Autor Neil Delima |
|
2149 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2150 " |
|
2151 | |
|
2152 doc "Document" |
|
2153 docType "DocumentType" |
|
2154 adoptedDocType "Node" |
|
2155 | |
|
2156 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2157 docType := doc doctype. |
|
2158 "assertDOMException..." |
|
2159 self should:[ |
|
2160 adoptedDocType := doc adoptNode: docType. |
|
2161 ] raise: DOMException. |
|
2162 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
2163 "end of assertDOMException..." |
|
2164 |
|
2165 ! |
|
2166 |
|
2167 test_documentadoptnode11 |
|
2168 " |
|
2169 Invoke the adoptNode method on this document with the value of the source parameter equal to a new |
|
2170 doctype node. Verify if a NOT_SUPPORTED_ERR is thrown. |
|
2171 |
|
2172 Creator: IBM |
|
2173 Autor Neil Delima |
|
2174 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2175 " |
|
2176 | |
|
2177 doc "Document" |
|
2178 domImpl "DOMImplementation" |
|
2179 docType "DocumentType" |
|
2180 adoptedDocType "Node" |
|
2181 nullPubID "String" |
|
2182 nullSysID "String" |
|
2183 docElem "Element" |
|
2184 rootName "String" |
|
2185 | |
|
2186 nullPubID := nil. |
|
2187 nullSysID := nil. |
|
2188 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2189 docElem := doc documentElement. |
|
2190 rootName := docElem tagName. |
|
2191 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2192 docType := domImpl createDocumentType:rootName publicId:nullPubID systemId:nullSysID. |
|
2193 "assertDOMException..." |
|
2194 self should:[ |
|
2195 adoptedDocType := doc adoptNode: docType. |
|
2196 ] raise: DOMException. |
|
2197 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
2198 "end of assertDOMException..." |
|
2199 |
|
2200 ! |
|
2201 |
|
2202 test_documentadoptnode12 |
|
2203 " |
|
2204 Invoke the adoptNode method on a new document with the value of the source parameter equal to a new |
|
2205 doctype node. Verify if a NOT_SUPPORTED_ERR is thrown. |
|
2206 |
|
2207 Creator: IBM |
|
2208 Autor Neil Delima |
|
2209 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2210 " |
|
2211 | |
|
2212 doc "Document" |
|
2213 newDoc "Document" |
|
2214 domImpl "DOMImplementation" |
|
2215 docType "DocumentType" |
|
2216 adoptedDocType "Node" |
|
2217 nullPubID "String" |
|
2218 nullSysID "String" |
|
2219 docElem "Element" |
|
2220 rootNS "String" |
|
2221 rootName "String" |
|
2222 | |
|
2223 nullPubID := nil. |
|
2224 nullSysID := nil. |
|
2225 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2226 docElem := doc documentElement. |
|
2227 rootName := docElem tagName. |
|
2228 rootNS := docElem namespaceURI. |
|
2229 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2230 docType := domImpl createDocumentType:rootName publicId:nullPubID systemId:nullSysID. |
|
2231 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: docType. |
|
2232 "assertDOMException..." |
|
2233 self should:[ |
|
2234 adoptedDocType := newDoc adoptNode: docType. |
|
2235 ] raise: DOMException. |
|
2236 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
2237 "end of assertDOMException..." |
|
2238 |
|
2239 ! |
|
2240 |
|
2241 test_documentadoptnode13 |
|
2242 " |
|
2243 Using the method adoptNode, adopt a newly created DocumentFragment node populated with |
|
2244 with the first acronym element of this Document. Since the decendants of a documentFragment |
|
2245 are recursively adopted, check if the adopted node has children. |
|
2246 |
|
2247 Creator: IBM |
|
2248 Autor Neil Delima |
|
2249 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2250 " |
|
2251 | |
|
2252 doc "Document" |
|
2253 docFragment "DocumentFragment" |
|
2254 childList "NodeList" |
|
2255 success "Boolean" |
|
2256 acronymNode "Node" |
|
2257 appendedChild "Node" |
|
2258 adoptedDocFrag "Node" |
|
2259 | |
|
2260 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2261 docFragment := doc createDocumentFragment. |
|
2262 childList := doc getElementsByTagName: 'acronym'. |
|
2263 acronymNode := childList item:0. |
|
2264 appendedChild := docFragment appendChild:acronymNode. |
|
2265 adoptedDocFrag := doc adoptNode: docFragment. |
|
2266 "if" |
|
2267 ( adoptedDocFrag notNil ) ifTrue: [ |
|
2268 ]. |
|
2269 |
|
2270 ! |
|
2271 |
|
2272 test_documentadoptnode14 |
|
2273 " |
|
2274 Using the method adoptNode in a new Document, adopt a newly created DocumentFragment node populated with |
|
2275 with the first acronym element of this Document as its newChild. Since the decendants of a documentFragment |
|
2276 are recursively adopted, check if the adopted node has children. |
|
2277 |
|
2278 Creator: IBM |
|
2279 Autor Neil Delima |
|
2280 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2281 " |
|
2282 | |
|
2283 doc "Document" |
|
2284 newDoc "Document" |
|
2285 docElem "Element" |
|
2286 domImpl "DOMImplementation" |
|
2287 docFragment "DocumentFragment" |
|
2288 childList "NodeList" |
|
2289 success "Boolean" |
|
2290 acronymNode "Node" |
|
2291 adoptedDocFrag "Node" |
|
2292 appendedChild "Node" |
|
2293 nullDocType "DocumentType" |
|
2294 imported "Node" |
|
2295 rootNS "String" |
|
2296 rootName "String" |
|
2297 | |
|
2298 nullDocType := nil. |
|
2299 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2300 docElem := doc documentElement. |
|
2301 rootName := docElem tagName. |
|
2302 rootNS := docElem namespaceURI. |
|
2303 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2304 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2305 docFragment := newDoc createDocumentFragment. |
|
2306 imported := newDoc importNode:docElem deep:true. |
|
2307 docElem := newDoc documentElement. |
|
2308 appendedChild := docElem appendChild:imported. |
|
2309 childList := newDoc getElementsByTagName: 'acronym'. |
|
2310 acronymNode := childList item:0. |
|
2311 appendedChild := docFragment appendChild:acronymNode. |
|
2312 adoptedDocFrag := newDoc adoptNode: docFragment. |
|
2313 "if" |
|
2314 ( adoptedDocFrag notNil ) ifTrue: [ |
|
2315 ]. |
|
2316 |
|
2317 ! |
|
2318 |
|
2319 test_documentadoptnode15 |
|
2320 " |
|
2321 Using the method adoptNode, adopt a newly created DocumentFragment node without any children. |
|
2322 Check if the adopted node has no children. |
|
2323 |
|
2324 Creator: IBM |
|
2325 Autor Neil Delima |
|
2326 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2327 " |
|
2328 | |
|
2329 doc "Document" |
|
2330 docFragment "DocumentFragment" |
|
2331 success "Boolean" |
|
2332 adoptedDocFrag "Node" |
|
2333 | |
|
2334 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2335 docFragment := doc createDocumentFragment. |
|
2336 adoptedDocFrag := doc adoptNode: docFragment. |
|
2337 "if" |
|
2338 ( adoptedDocFrag notNil ) ifTrue: [ |
|
2339 ]. |
|
2340 |
|
2341 ! |
|
2342 |
|
2343 test_documentadoptnode16 |
|
2344 " |
|
2345 Create a document fragment with an entity reference, adopt the node and check |
|
2346 that the entity reference value comes from the adopting documents DTD. |
|
2347 |
|
2348 Creator: IBM |
|
2349 Autor Neil Delima |
|
2350 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2351 " |
|
2352 | |
|
2353 doc "Document" |
|
2354 docFragment "DocumentFragment" |
|
2355 childList "NodeList" |
|
2356 parent "Element" |
|
2357 child "Element" |
|
2358 childsAttr "Attr" |
|
2359 entRef "EntityReference" |
|
2360 textNode "Text" |
|
2361 adopted "Node" |
|
2362 parentImp "Element" |
|
2363 childImp "Element" |
|
2364 attributes "NamedNodeMap" |
|
2365 childAttrImp "Attr" |
|
2366 nodeValue "String" |
|
2367 appendedChild "Node" |
|
2368 attrNode "Attr" |
|
2369 firstChild "Node" |
|
2370 firstChildType "SmallInteger" |
|
2371 firstChildName "String" |
|
2372 firstChildValue "String" |
|
2373 | |
|
2374 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2375 docFragment := doc createDocumentFragment. |
|
2376 parent := doc createElement:'parent'. |
|
2377 child := doc createElement:'child'. |
|
2378 childsAttr := doc createAttribute:'state'. |
|
2379 entRef := doc createEntityReference:'gamma'. |
|
2380 textNode := doc createTextNode:'Test'. |
|
2381 appendedChild := childsAttr appendChild:entRef. |
|
2382 attrNode := child setAttributeNode:childsAttr. |
|
2383 appendedChild := child appendChild:textNode. |
|
2384 appendedChild := parent appendChild:child. |
|
2385 appendedChild := docFragment appendChild:parent. |
|
2386 adopted := doc adoptNode: docFragment. |
|
2387 "if" |
|
2388 ( adopted notNil ) ifTrue: [ |
|
2389 self assert:false description:'Method "equals" is not supported yet'. |
|
2390 self assert: ( firstChildName = 'gamma' ). |
|
2391 self assert:false description:'Method "else" is not supported yet'. |
|
2392 ]. |
|
2393 |
|
2394 ! |
|
2395 |
|
2396 test_documentadoptnode17 |
|
2397 " |
|
2398 Invoke the adoptNode method on this document with the entity ent1 as the source. Since this is |
|
2399 read-only verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
2400 |
|
2401 Creator: IBM |
|
2402 Autor Neil Delima |
|
2403 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2404 " |
|
2405 | |
|
2406 doc "Document" |
|
2407 docType "DocumentType" |
|
2408 entityMap "NamedNodeMap" |
|
2409 ent "Entity" |
|
2410 adoptedEnt "Node" |
|
2411 | |
|
2412 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2413 docType := doc doctype. |
|
2414 entityMap := docType entities. |
|
2415 ent := entityMap getNamedItem:'alpha'. |
|
2416 "assertDOMException..." |
|
2417 self should:[ |
|
2418 adoptedEnt := doc adoptNode: ent. |
|
2419 ] raise: DOMException. |
|
2420 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
2421 "end of assertDOMException..." |
|
2422 |
|
2423 ! |
|
2424 |
|
2425 test_documentadoptnode18 |
|
2426 " |
|
2427 Invoke the adoptNode method on a new document with the entity ent4 as the source. Since this is |
|
2428 read-only verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
2429 |
|
2430 Creator: IBM |
|
2431 Autor Neil Delima |
|
2432 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2433 " |
|
2434 | |
|
2435 doc "Document" |
|
2436 newDoc "Document" |
|
2437 domImpl "DOMImplementation" |
|
2438 docType "DocumentType" |
|
2439 entityMap "NamedNodeMap" |
|
2440 ent "Entity" |
|
2441 adoptedEnt "Node" |
|
2442 nullDocType "DocumentType" |
|
2443 docElem "Element" |
|
2444 rootNS "String" |
|
2445 rootName "String" |
|
2446 | |
|
2447 nullDocType := nil. |
|
2448 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2449 docElem := doc documentElement. |
|
2450 rootName := docElem tagName. |
|
2451 rootNS := docElem namespaceURI. |
|
2452 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2453 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2454 docType := doc doctype. |
|
2455 entityMap := docType entities. |
|
2456 ent := entityMap getNamedItem:'delta'. |
|
2457 "assertDOMException..." |
|
2458 self should:[ |
|
2459 adoptedEnt := newDoc adoptNode: ent. |
|
2460 ] raise: DOMException. |
|
2461 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
2462 "end of assertDOMException..." |
|
2463 |
|
2464 ! |
|
2465 |
|
2466 test_documentadoptnode19 |
|
2467 " |
|
2468 Invoke the adoptNode method on this document with the notation notation1 as the source. Since this is |
|
2469 read-only verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
2470 |
|
2471 Creator: IBM |
|
2472 Autor Neil Delima |
|
2473 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2474 " |
|
2475 | |
|
2476 doc "Document" |
|
2477 docType "DocumentType" |
|
2478 notationMap "NamedNodeMap" |
|
2479 notation "Notation" |
|
2480 adoptedNotaion "Node" |
|
2481 | |
|
2482 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2483 docType := doc doctype. |
|
2484 notationMap := docType notations. |
|
2485 notation := notationMap getNamedItem:'notation1'. |
|
2486 "assertDOMException..." |
|
2487 self should:[ |
|
2488 adoptedNotaion := doc adoptNode: notation. |
|
2489 ] raise: DOMException. |
|
2490 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
2491 "end of assertDOMException..." |
|
2492 |
|
2493 ! |
|
2494 |
|
2495 test_documentadoptnode20 |
|
2496 " |
|
2497 Invoke the adoptNode method on a new document with the notation notation2 as the source. Since this is |
|
2498 read-only verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
2499 |
|
2500 Creator: IBM |
|
2501 Autor Neil Delima |
|
2502 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2503 " |
|
2504 | |
|
2505 doc "Document" |
|
2506 newDoc "Document" |
|
2507 domImpl "DOMImplementation" |
|
2508 docType "DocumentType" |
|
2509 notationMap "NamedNodeMap" |
|
2510 notation "Notation" |
|
2511 adoptedNotation "Node" |
|
2512 nullDocType "DocumentType" |
|
2513 docElem "Element" |
|
2514 rootNS "String" |
|
2515 rootName "String" |
|
2516 | |
|
2517 nullDocType := nil. |
|
2518 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2519 docElem := doc documentElement. |
|
2520 rootName := docElem tagName. |
|
2521 rootNS := docElem namespaceURI. |
|
2522 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2523 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2524 docType := doc doctype. |
|
2525 notationMap := docType notations. |
|
2526 notation := notationMap getNamedItem:'notation2'. |
|
2527 "assertDOMException..." |
|
2528 self should:[ |
|
2529 adoptedNotation := newDoc adoptNode: notation. |
|
2530 ] raise: DOMException. |
|
2531 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
2532 "end of assertDOMException..." |
|
2533 |
|
2534 ! |
|
2535 |
|
2536 test_documentadoptnode21 |
|
2537 " |
|
2538 The adoptNode method changes the ownerDocument of a node, its children, as well as the |
|
2539 attached attribute nodes if there are any. If the node has a parent it is first removed |
|
2540 from its parent child list. |
|
2541 |
|
2542 Invoke the adoptNode method on this Document with the source node being an existing attribute |
|
2543 that is a part of this Document. Verify that the returned adopted node's nodeName, nodeValue |
|
2544 and nodeType are as expected and that the ownerElement attribute of the returned attribute node |
|
2545 was set to null. |
|
2546 |
|
2547 Creator: IBM |
|
2548 Autor Neil Delima |
|
2549 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2550 " |
|
2551 | |
|
2552 doc "Document" |
|
2553 attrOwnerElem "Element" |
|
2554 element "Element" |
|
2555 attr "Attr" |
|
2556 childList "NodeList" |
|
2557 adoptedTitle "Node" |
|
2558 attrsParent "Node" |
|
2559 nodeName "String" |
|
2560 nodeType "SmallInteger" |
|
2561 nodeValue "String" |
|
2562 | |
|
2563 "implementationAttribute not supported: namespaceAware" |
|
2564 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2565 childList := doc getElementsByTagName: 'acronym'. |
|
2566 element := childList item:0. |
|
2567 attr := element getAttributeNode:'title'. |
|
2568 adoptedTitle := doc adoptNode: attr. |
|
2569 nodeName := adoptedTitle nodeName. |
|
2570 nodeValue := adoptedTitle nodeValue. |
|
2571 nodeType := adoptedTitle nodeType. |
|
2572 attrOwnerElem := adoptedTitle ownerElement. |
|
2573 self assert: ( nodeName = 'title' ). |
|
2574 self assert: ( nodeType = 2 ). |
|
2575 self assert: ( nodeValue = 'Yes' ). |
|
2576 self assert: attrOwnerElem isNil. |
|
2577 |
|
2578 ! |
|
2579 |
|
2580 test_documentadoptnode22 |
|
2581 " |
|
2582 Invoke the adoptNode method on this document with the documentElement as the source. |
|
2583 Verify if the node has been adopted correctly by its nodeName. |
|
2584 |
|
2585 Creator: IBM |
|
2586 Autor Neil Delima |
|
2587 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2588 " |
|
2589 | |
|
2590 doc "Document" |
|
2591 docElement "Element" |
|
2592 adoptedNode "Node" |
|
2593 success "Boolean" |
|
2594 nodeNameOrig "String" |
|
2595 nodeName "String" |
|
2596 | |
|
2597 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2598 docElement := doc documentElement. |
|
2599 adoptedNode := doc adoptNode: docElement. |
|
2600 "if" |
|
2601 ( adoptedNode notNil ) ifTrue: [ |
|
2602 ]. |
|
2603 |
|
2604 ! |
|
2605 |
|
2606 test_documentadoptnode23 |
|
2607 " |
|
2608 Invoke the adoptNode method on this document with the first acronym element node of this |
|
2609 Document as the source. Verify if the node has been adopted correctly by checking the |
|
2610 length of the this elements childNode list before and after. |
|
2611 |
|
2612 Creator: IBM |
|
2613 Autor Neil Delima |
|
2614 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2615 " |
|
2616 | |
|
2617 doc "Document" |
|
2618 childList "NodeList" |
|
2619 adoptedNode "Node" |
|
2620 acronymElem "Node" |
|
2621 acronymElemLen "SmallInteger" |
|
2622 adoptedLen "SmallInteger" |
|
2623 acronymElemChild "NodeList" |
|
2624 adoptedNodeChild "NodeList" |
|
2625 | |
|
2626 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2627 childList := doc getElementsByTagName: 'acronym'. |
|
2628 acronymElem := childList item:0. |
|
2629 adoptedNode := doc adoptNode: acronymElem. |
|
2630 "if" |
|
2631 ( adoptedNode notNil ) ifTrue: [ |
|
2632 ]. |
|
2633 |
|
2634 ! |
|
2635 |
|
2636 test_documentadoptnode24 |
|
2637 " |
|
2638 The adoptNode method changes the ownerDocument of a node, its children, as well as the |
|
2639 attached attribute nodes if there are any. If the node has a parent it is first removed |
|
2640 from its parent child list. |
|
2641 For Element Nodes, specified attribute nodes of the source element are adopted, Default |
|
2642 attributes are discarded and descendants of the source element are recursively adopted. |
|
2643 |
|
2644 Invoke the adoptNode method on a new document with the first code element node of this |
|
2645 Document as the source. Verify if the node has been adopted correctly by checking the |
|
2646 length of the this elements childNode list before and after. |
|
2647 |
|
2648 Creator: IBM |
|
2649 Autor Neil Delima |
|
2650 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2651 " |
|
2652 | |
|
2653 doc "Document" |
|
2654 newDoc "Document" |
|
2655 domImpl "DOMImplementation" |
|
2656 childList "NodeList" |
|
2657 adoptedNode "Node" |
|
2658 codeElem "Element" |
|
2659 codeElemChildren "NodeList" |
|
2660 adoptedChildren "NodeList" |
|
2661 codeElemLen "SmallInteger" |
|
2662 adoptedLen "SmallInteger" |
|
2663 nullDocType "DocumentType" |
|
2664 | |
|
2665 "implementationAttribute not supported: namespaceAware" |
|
2666 nullDocType := nil. |
|
2667 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2668 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2669 newDoc := domImpl createDocumentNS: 'http://www.w3.org/DOM/Test' qualifiedName: 'dom:test' doctype: nullDocType. |
|
2670 childList := doc getElementsByTagName: 'code' ns: '*'. |
|
2671 codeElem := childList item:0. |
|
2672 adoptedNode := newDoc adoptNode: codeElem. |
|
2673 codeElemChildren := codeElem childNodes. |
|
2674 adoptedChildren := adoptedNode childNodes. |
|
2675 codeElemLen := codeElemChildren length. |
|
2676 adoptedLen := adoptedChildren length. |
|
2677 self assert: ( codeElemLen = adoptedLen ). |
|
2678 |
|
2679 ! |
|
2680 |
|
2681 test_documentadoptnode25 |
|
2682 " |
|
2683 Invoke the adoptNode method on a new document with a new Element of this |
|
2684 Document as the source. Verify if the node has been adopted correctly by checking the |
|
2685 nodeName of the adopted Element. |
|
2686 |
|
2687 Creator: IBM |
|
2688 Autor Neil Delima |
|
2689 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2690 " |
|
2691 | |
|
2692 doc "Document" |
|
2693 newElem "Element" |
|
2694 newDoc "Document" |
|
2695 domImpl "DOMImplementation" |
|
2696 adoptedNode "Node" |
|
2697 adoptedName "String" |
|
2698 adoptedNS "String" |
|
2699 docElem "Element" |
|
2700 rootNS "String" |
|
2701 rootName "String" |
|
2702 nullDocType "DocumentType" |
|
2703 | |
|
2704 nullDocType := nil. |
|
2705 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2706 docElem := doc documentElement. |
|
2707 rootNS := docElem namespaceURI. |
|
2708 rootName := docElem tagName. |
|
2709 newElem := doc createElement:'th' ns:'http://www.w3.org/1999/xhtml'. |
|
2710 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2711 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2712 adoptedNode := newDoc adoptNode: newElem. |
|
2713 "if" |
|
2714 ( adoptedNode notNil ) ifTrue: [ |
|
2715 ]. |
|
2716 |
|
2717 ! |
|
2718 |
|
2719 test_documentadoptnode26 |
|
2720 " |
|
2721 Invoke the adoptNode method on this document using a new Element and a new attribute created in |
|
2722 a new Document as the source. Verify if the node has been adopted correctly by checking the |
|
2723 nodeName of the adopted Element and by checking if the attribute was adopted. |
|
2724 |
|
2725 Creator: IBM |
|
2726 Autor Neil Delima |
|
2727 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2728 " |
|
2729 | |
|
2730 doc "Document" |
|
2731 docElem "Element" |
|
2732 newElem "Element" |
|
2733 newDoc "Document" |
|
2734 domImpl "DOMImplementation" |
|
2735 adoptedNode "Node" |
|
2736 adoptedName "String" |
|
2737 adoptedNS "String" |
|
2738 nullDocType "DocumentType" |
|
2739 appendedChild "Node" |
|
2740 rootNS "String" |
|
2741 rootTagname "String" |
|
2742 | |
|
2743 nullDocType := nil. |
|
2744 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2745 docElem := doc documentElement. |
|
2746 rootNS := docElem namespaceURI. |
|
2747 rootTagname := docElem tagName. |
|
2748 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2749 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootTagname doctype: nullDocType. |
|
2750 newElem := newDoc createElement:'head' ns:'http://www.w3.org/1999/xhtml'. |
|
2751 newElem setAttribute: 'xml:lang' ns: 'http://www.w3.org/XML/1998/namespace' value: 'en-US'. |
|
2752 docElem := newDoc documentElement. |
|
2753 appendedChild := docElem appendChild:newElem. |
|
2754 adoptedNode := doc adoptNode: newElem. |
|
2755 "if" |
|
2756 ( adoptedNode notNil ) ifTrue: [ |
|
2757 ]. |
|
2758 |
|
2759 ! |
|
2760 |
|
2761 test_documentadoptnode27 |
|
2762 " |
|
2763 Invoke the adoptNode method on this document using a new imported Element and a new attribute created in |
|
2764 a new Document as the source. Verify if the node has been adopted correctly by checking the |
|
2765 nodeName of the adopted Element and by checking if the attribute was adopted. |
|
2766 |
|
2767 Creator: IBM |
|
2768 Autor Neil Delima |
|
2769 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2770 " |
|
2771 | |
|
2772 doc "Document" |
|
2773 docElem "Element" |
|
2774 newElem "Element" |
|
2775 newImpElem "Element" |
|
2776 newDoc "Document" |
|
2777 domImpl "DOMImplementation" |
|
2778 adoptedNode "Node" |
|
2779 adoptedName "String" |
|
2780 adoptedNS "String" |
|
2781 appendedChild "Node" |
|
2782 nullDocType "DocumentType" |
|
2783 rootNS "String" |
|
2784 rootTagname "String" |
|
2785 | |
|
2786 nullDocType := nil. |
|
2787 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2788 docElem := doc documentElement. |
|
2789 rootNS := docElem namespaceURI. |
|
2790 rootTagname := docElem tagName. |
|
2791 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2792 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootTagname doctype: nullDocType. |
|
2793 newElem := newDoc createElement:'xhtml:head' ns:'http://www.w3.org/1999/xhtml'. |
|
2794 newElem setAttribute: 'xml:lang' ns: 'http://www.w3.org/XML/1998/namespace' value: 'en-US'. |
|
2795 docElem := newDoc documentElement. |
|
2796 appendedChild := docElem appendChild:newElem. |
|
2797 newImpElem := doc importNode:newElem deep:true. |
|
2798 adoptedNode := doc adoptNode: newImpElem. |
|
2799 "if" |
|
2800 ( adoptedNode notNil ) ifTrue: [ |
|
2801 ]. |
|
2802 |
|
2803 ! |
|
2804 |
|
2805 test_documentadoptnode28 |
|
2806 " |
|
2807 Invoke the adoptNode method on this document using the p element with the default |
|
2808 Attribute dir as the source. Verify if the node has been adopted correctly by |
|
2809 checking the nodeName of the adopted Element and by checking if the attribute was adopted. |
|
2810 Note the default attribute should be adopted in this case. |
|
2811 |
|
2812 Creator: IBM |
|
2813 Autor Neil Delima |
|
2814 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2815 " |
|
2816 | |
|
2817 doc "Document" |
|
2818 childList "NodeList" |
|
2819 adoptedNode "Node" |
|
2820 employeeElem "Node" |
|
2821 attrImp "Attr" |
|
2822 nodeName "String" |
|
2823 nullNSURI "String" |
|
2824 | |
|
2825 nullNSURI := nil. |
|
2826 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2827 childList := doc getElementsByTagName: 'p'. |
|
2828 employeeElem := childList item:3. |
|
2829 adoptedNode := doc adoptNode: employeeElem. |
|
2830 "if" |
|
2831 ( adoptedNode notNil ) ifTrue: [ |
|
2832 ]. |
|
2833 |
|
2834 ! |
|
2835 |
|
2836 test_documentadoptnode30 |
|
2837 " |
|
2838 Invoke the adoptNode method on this document using a new Text node as the source. Verify |
|
2839 if the node has been adopted correctly by checking the nodeValue of the adopted node. |
|
2840 |
|
2841 Creator: IBM |
|
2842 Autor Neil Delima |
|
2843 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2844 " |
|
2845 | |
|
2846 doc "Document" |
|
2847 newText "Text" |
|
2848 adoptedText "Text" |
|
2849 nodeValue "String" |
|
2850 | |
|
2851 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2852 newText := doc createTextNode:'Document.adoptNode test for a TEXT_NODE'. |
|
2853 adoptedText := doc adoptNode: newText. |
|
2854 "if" |
|
2855 ( adoptedText notNil ) ifTrue: [ |
|
2856 ]. |
|
2857 |
|
2858 ! |
|
2859 |
|
2860 test_documentadoptnode31 |
|
2861 " |
|
2862 Invoke the adoptNode method on this document using a new Text node from a new Document as the |
|
2863 source. Verify if the node has been adopted correctly by checking the nodeValue of the adopted |
|
2864 node. |
|
2865 |
|
2866 Creator: IBM |
|
2867 Autor Neil Delima |
|
2868 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2869 " |
|
2870 | |
|
2871 doc "Document" |
|
2872 domImpl "DOMImplementation" |
|
2873 newDoc "Document" |
|
2874 newText "Text" |
|
2875 adoptedText "Text" |
|
2876 nodeValue "String" |
|
2877 nullDocType "DocumentType" |
|
2878 docElem "Element" |
|
2879 rootNS "String" |
|
2880 rootName "String" |
|
2881 | |
|
2882 nullDocType := nil. |
|
2883 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2884 docElem := doc documentElement. |
|
2885 rootName := docElem tagName. |
|
2886 rootNS := docElem namespaceURI. |
|
2887 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2888 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2889 newText := newDoc createTextNode:'new Document.adoptNode test for a TEXT_NODE'. |
|
2890 adoptedText := doc adoptNode: newText. |
|
2891 "if" |
|
2892 ( adoptedText notNil ) ifTrue: [ |
|
2893 ]. |
|
2894 |
|
2895 ! |
|
2896 |
|
2897 test_documentadoptnode32 |
|
2898 " |
|
2899 Invoke the adoptNode method on another document using a new CDataSection node created in this |
|
2900 Document as the source. Verify if the node has been adopted correctly by checking the nodeValue |
|
2901 of the adopted node. |
|
2902 |
|
2903 Creator: IBM |
|
2904 Autor Neil Delima |
|
2905 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2906 " |
|
2907 | |
|
2908 doc "Document" |
|
2909 docAdopter "Document" |
|
2910 newCDATA "Node" |
|
2911 adoptedCDATA "Node" |
|
2912 nodeValue "String" |
|
2913 | |
|
2914 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2915 docAdopter := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2916 newCDATA := doc createCDATASection:'Document.adoptNode test for a CDATASECTION_NODE'. |
|
2917 adoptedCDATA := docAdopter adoptNode: newCDATA. |
|
2918 "if" |
|
2919 ( adoptedCDATA notNil ) ifTrue: [ |
|
2920 ]. |
|
2921 |
|
2922 ! |
|
2923 |
|
2924 test_documentadoptnode33 |
|
2925 " |
|
2926 Invoke the adoptNode method on this document using a new CDataSection node created in a new |
|
2927 Document as the source. Verify if the node has been adopted correctly by checking the nodeValue |
|
2928 of the adopted node. |
|
2929 |
|
2930 Creator: IBM |
|
2931 Autor Neil Delima |
|
2932 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2933 " |
|
2934 | |
|
2935 doc "Document" |
|
2936 domImpl "DOMImplementation" |
|
2937 newDoc "Document" |
|
2938 newCDATA "Node" |
|
2939 adoptedCDATA "Node" |
|
2940 nodeValue "String" |
|
2941 nullDocType "DocumentType" |
|
2942 docElem "Element" |
|
2943 rootNS "String" |
|
2944 rootName "String" |
|
2945 | |
|
2946 nullDocType := nil. |
|
2947 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2948 docElem := doc documentElement. |
|
2949 rootNS := docElem namespaceURI. |
|
2950 rootName := docElem tagName. |
|
2951 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2952 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2953 newCDATA := newDoc createCDATASection:'Document.adoptNode test for a CDATASECTION_NODE'. |
|
2954 adoptedCDATA := doc adoptNode: newCDATA. |
|
2955 "if" |
|
2956 ( adoptedCDATA notNil ) ifTrue: [ |
|
2957 ]. |
|
2958 |
|
2959 ! |
|
2960 |
|
2961 test_documentadoptnode34 |
|
2962 " |
|
2963 Invoke the adoptNode method on a new document using a new Comment node created in it |
|
2964 as the source. Verify if the node has been adopted correctly by checking the nodeValue |
|
2965 of the adopted node. |
|
2966 |
|
2967 Creator: IBM |
|
2968 Autor Neil Delima |
|
2969 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
2970 " |
|
2971 | |
|
2972 doc "Document" |
|
2973 domImpl "DOMImplementation" |
|
2974 newDoc "Document" |
|
2975 newComment "Node" |
|
2976 adoptedComment "Node" |
|
2977 nodeValue "String" |
|
2978 nullDocType "DocumentType" |
|
2979 docElem "Element" |
|
2980 rootNS "String" |
|
2981 rootName "String" |
|
2982 | |
|
2983 nullDocType := nil. |
|
2984 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
2985 docElem := doc documentElement. |
|
2986 rootNS := docElem namespaceURI. |
|
2987 rootName := docElem tagName. |
|
2988 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
2989 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
2990 newComment := newDoc createComment:'Document.adoptNode test for a COMMENT_NODE'. |
|
2991 adoptedComment := newDoc adoptNode: newComment. |
|
2992 "if" |
|
2993 ( adoptedComment notNil ) ifTrue: [ |
|
2994 ]. |
|
2995 |
|
2996 ! |
|
2997 |
|
2998 test_documentadoptnode35 |
|
2999 " |
|
3000 Invoke the adoptNode method on this document using a new PI node created in a new doc |
|
3001 as the source. Verify if the node has been adopted correctly by checking the nodeValue |
|
3002 of the adopted node. |
|
3003 |
|
3004 Creator: IBM |
|
3005 Autor Neil Delima |
|
3006 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
3007 " |
|
3008 | |
|
3009 doc "Document" |
|
3010 domImpl "DOMImplementation" |
|
3011 newDoc "Document" |
|
3012 newPI "ProcessingInstruction" |
|
3013 adoptedPI "ProcessingInstruction" |
|
3014 piTarget "String" |
|
3015 piData "String" |
|
3016 nullDocType "DocumentType" |
|
3017 docElem "Element" |
|
3018 rootNS "String" |
|
3019 rootName "String" |
|
3020 | |
|
3021 nullDocType := nil. |
|
3022 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3023 docElem := doc documentElement. |
|
3024 rootNS := docElem namespaceURI. |
|
3025 rootName := docElem tagName. |
|
3026 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3027 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3028 newPI := newDoc createProcessingInstruction:'PITarget' data:'PIData'. |
|
3029 adoptedPI := doc adoptNode: newPI. |
|
3030 "if" |
|
3031 ( adoptedPI notNil ) ifTrue: [ |
|
3032 ]. |
|
3033 |
|
3034 ! |
|
3035 |
|
3036 test_documentadoptnode36 |
|
3037 " |
|
3038 Invoke the adoptNode method on this document using a new PI node created in a new doc |
|
3039 as the source. Verify if the node has been adopted correctly by checking the nodeValue |
|
3040 of the adopted node. |
|
3041 |
|
3042 Creator: IBM |
|
3043 Autor Neil Delima |
|
3044 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-adoptNode |
|
3045 " |
|
3046 | |
|
3047 doc "Document" |
|
3048 domImpl "DOMImplementation" |
|
3049 newDoc "Document" |
|
3050 newPI1 "ProcessingInstruction" |
|
3051 newPI2 "ProcessingInstruction" |
|
3052 adoptedPI1 "ProcessingInstruction" |
|
3053 adoptedPI2 "ProcessingInstruction" |
|
3054 piTarget "String" |
|
3055 piData "String" |
|
3056 nullDocType "DocumentType" |
|
3057 docElem "Element" |
|
3058 rootNS "String" |
|
3059 rootName "String" |
|
3060 | |
|
3061 nullDocType := nil. |
|
3062 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3063 docElem := doc documentElement. |
|
3064 rootNS := docElem namespaceURI. |
|
3065 rootName := docElem tagName. |
|
3066 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3067 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3068 newPI1 := newDoc createProcessingInstruction:'PITarget' data:'PIData'. |
|
3069 newPI2 := doc createProcessingInstruction:'PITarget' data:'PIData'. |
|
3070 adoptedPI1 := newDoc adoptNode: newPI1. |
|
3071 "if" |
|
3072 ( adoptedPI1 notNil ) ifTrue: [ |
|
3073 self assert:false description:'Method "notNull" is not supported yet'. |
|
3074 piTarget := adoptedPI1 target. |
|
3075 piData := adoptedPI1 data. |
|
3076 self assert: ( piTarget = 'PITarget' ). |
|
3077 self assert: ( piData = 'PIData' ). |
|
3078 piTarget := adoptedPI2 target. |
|
3079 piData := adoptedPI2 data. |
|
3080 self assert: ( piTarget = 'PITarget' ). |
|
3081 self assert: ( piData = 'PIData' ). |
|
3082 ]. |
|
3083 |
|
3084 ! |
|
3085 |
|
3086 test_documentgetdoctype01 |
|
3087 " |
|
3088 Retreive the doctype node, create a new Doctype node, call replaceChild and try replacing the |
|
3089 docType node with a new docType node. Check if the docType node was correctly replaced with |
|
3090 the new one. |
|
3091 |
|
3092 Creator: IBM |
|
3093 Autor Neil Delima |
|
3094 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-B63ED1A31 |
|
3095 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
3096 " |
|
3097 | |
|
3098 doc "Document" |
|
3099 docType "DocumentType" |
|
3100 newDocType "DocumentType" |
|
3101 replacedDocType "DocumentType" |
|
3102 domImpl "DOMImplementation" |
|
3103 newSysID "String" |
|
3104 nullPubID "String" |
|
3105 nullSysID "String" |
|
3106 replaced "Node" |
|
3107 rootName "String" |
|
3108 | |
|
3109 nullPubID := nil. |
|
3110 nullSysID := nil. |
|
3111 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3112 docType := doc doctype. |
|
3113 rootName := docType name. |
|
3114 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3115 newDocType := domImpl createDocumentType:rootName publicId:nullPubID systemId:nullSysID. |
|
3116 "try" |
|
3117 [ |
|
3118 doc replaceChild:docType with: newDocType. |
|
3119 ] on: DOMException do: [:ex| ]. |
|
3120 "end of try" |
|
3121 replacedDocType := doc doctype. |
|
3122 newSysID := replacedDocType systemId. |
|
3123 self assert: newSysID isNil. |
|
3124 |
|
3125 ! |
|
3126 |
|
3127 test_documentgetdocumenturi01 |
|
3128 " |
|
3129 Retreive the documentURI of this document, and verify if it is not null. |
|
3130 |
|
3131 Creator: IBM |
|
3132 Autor Neil Delima |
|
3133 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-documentURI |
|
3134 " |
|
3135 | |
|
3136 doc "Document" |
|
3137 docURI "String" |
|
3138 | |
|
3139 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3140 docURI := doc documentURI. |
|
3141 self assert: docURI notNil. |
|
3142 |
|
3143 ! |
|
3144 |
|
3145 test_documentgetdocumenturi02 |
|
3146 " |
|
3147 Create a new Document, retreive its documentURI, and verify if it is null. |
|
3148 |
|
3149 Creator: IBM |
|
3150 Autor Neil Delima |
|
3151 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-documentURI |
|
3152 " |
|
3153 | |
|
3154 doc "Document" |
|
3155 newDoc "Document" |
|
3156 docURI "String" |
|
3157 domImpl "DOMImplementation" |
|
3158 nullDocType "DocumentType" |
|
3159 docElem "Element" |
|
3160 rootNS "String" |
|
3161 rootName "String" |
|
3162 | |
|
3163 nullDocType := nil. |
|
3164 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3165 docElem := doc documentElement. |
|
3166 rootNS := docElem namespaceURI. |
|
3167 rootName := docElem tagName. |
|
3168 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3169 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3170 docURI := newDoc documentURI. |
|
3171 self assert: docURI isNil. |
|
3172 |
|
3173 ! |
|
3174 |
|
3175 test_documentgetdocumenturi03 |
|
3176 " |
|
3177 Import the documentElement node of this document into a new document. Since this node is |
|
3178 now owned by the importing document, its documentURI attribute value should be null |
|
3179 |
|
3180 Creator: IBM |
|
3181 Autor Neil Delima |
|
3182 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-documentURI |
|
3183 " |
|
3184 | |
|
3185 doc "Document" |
|
3186 newDoc "Document" |
|
3187 importedOwner "Document" |
|
3188 docElem "Element" |
|
3189 docElemImported "Node" |
|
3190 docURI "String" |
|
3191 domImpl "DOMImplementation" |
|
3192 nullDocType "DocumentType" |
|
3193 rootNS "String" |
|
3194 rootName "String" |
|
3195 | |
|
3196 nullDocType := nil. |
|
3197 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3198 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3199 docElem := doc documentElement. |
|
3200 rootNS := docElem namespaceURI. |
|
3201 rootName := docElem tagName. |
|
3202 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3203 docElemImported := newDoc importNode:docElem deep:false. |
|
3204 importedOwner := docElemImported ownerDocument. |
|
3205 docURI := importedOwner documentURI. |
|
3206 self assert: docURI isNil. |
|
3207 |
|
3208 ! |
|
3209 |
|
3210 test_documentgetinputencoding01 |
|
3211 " |
|
3212 Call the getInputEncoding method on a UTF-8 encoded document and check if the |
|
3213 value returned is UTF-8. |
|
3214 |
|
3215 Creator: IBM |
|
3216 Autor Neil Delima |
|
3217 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-inputEncoding |
|
3218 " |
|
3219 | |
|
3220 doc "Document" |
|
3221 encodingName "String" |
|
3222 | |
|
3223 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3224 encodingName := doc inputEncoding. |
|
3225 self assert: ( encodingName asLowercase = 'UTF-8' asLowercase ). |
|
3226 |
|
3227 ! |
|
3228 |
|
3229 test_documentgetinputencoding02 |
|
3230 " |
|
3231 Call the getInputEncoding method on a new document and check if the value returned |
|
3232 is null. |
|
3233 |
|
3234 Creator: IBM |
|
3235 Autor Neil Delima |
|
3236 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-inputEncoding |
|
3237 " |
|
3238 | |
|
3239 doc "Document" |
|
3240 newDoc "Document" |
|
3241 domImpl "DOMImplementation" |
|
3242 encodingName "String" |
|
3243 nullDocType "DocumentType" |
|
3244 docElem "Element" |
|
3245 rootNS "String" |
|
3246 rootName "String" |
|
3247 | |
|
3248 nullDocType := nil. |
|
3249 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3250 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3251 docElem := doc documentElement. |
|
3252 rootNS := docElem namespaceURI. |
|
3253 rootName := docElem tagName. |
|
3254 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3255 encodingName := newDoc inputEncoding. |
|
3256 self assert: encodingName isNil. |
|
3257 |
|
3258 ! |
|
3259 |
|
3260 test_documentgetinputencoding03 |
|
3261 " |
|
3262 Call the getInputEncoding method on a on a UTF-16 (BE) encoded document and check if the value returned |
|
3263 is UTF-16BE. |
|
3264 |
|
3265 Creator: IBM |
|
3266 Autor Neil Delima |
|
3267 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-inputEncoding |
|
3268 " |
|
3269 | |
|
3270 doc "Document" |
|
3271 encodingName "String" |
|
3272 | |
|
3273 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf16'). |
|
3274 encodingName := doc inputEncoding. |
|
3275 self assert: ( encodingName asLowercase = 'UTF-16BE' asLowercase ). |
|
3276 |
|
3277 ! |
|
3278 |
|
3279 test_documentgetinputencoding04 |
|
3280 " |
|
3281 Call the getInputEncoding method on a cloned UTF-8 encoded document |
|
3282 and check if the value returned is UTF-8 or null (implementation dependent). |
|
3283 |
|
3284 Creator: IBM |
|
3285 Autor Neil Delima |
|
3286 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-inputEncoding |
|
3287 " |
|
3288 | |
|
3289 doc "Document" |
|
3290 cloned "Document" |
|
3291 encodingName "String" |
|
3292 | |
|
3293 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf8'). |
|
3294 cloned := doc cloneNode:true. |
|
3295 encodingName := cloned inputEncoding. |
|
3296 self assert: ( encodingName asLowercase = 'UTF-8' asLowercase ) or: [( encodingName isNil ) ]. |
|
3297 |
|
3298 ! |
|
3299 |
|
3300 test_documentgetstricterrorchecking01 |
|
3301 " |
|
3302 Verify if the (default) value of the strictErrorChecking attribute of this document object is true. |
|
3303 |
|
3304 Creator: IBM |
|
3305 Autor Neil Delima |
|
3306 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-strictErrorChecking |
|
3307 " |
|
3308 | |
|
3309 doc "Document" |
|
3310 strictErrorCheckingValue "Boolean" |
|
3311 | |
|
3312 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3313 strictErrorCheckingValue := doc strictErrorChecking. |
|
3314 self assert: strictErrorCheckingValue. |
|
3315 |
|
3316 ! |
|
3317 |
|
3318 test_documentgetstricterrorchecking02 |
|
3319 " |
|
3320 Verify if the (default)value of the strictErrorChecking attribute of a new Document object is true. |
|
3321 |
|
3322 Creator: IBM |
|
3323 Autor Neil Delima |
|
3324 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-strictErrorChecking |
|
3325 " |
|
3326 | |
|
3327 doc "Document" |
|
3328 newDoc "Document" |
|
3329 domImpl "DOMImplementation" |
|
3330 strictErrorCheckingValue "Boolean" |
|
3331 nullDocType "DocumentType" |
|
3332 docElem "Element" |
|
3333 rootNS "String" |
|
3334 rootName "String" |
|
3335 | |
|
3336 nullDocType := nil. |
|
3337 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3338 docElem := doc documentElement. |
|
3339 rootNS := docElem namespaceURI. |
|
3340 rootName := docElem tagName. |
|
3341 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3342 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3343 strictErrorCheckingValue := newDoc strictErrorChecking. |
|
3344 self assert: strictErrorCheckingValue. |
|
3345 |
|
3346 ! |
|
3347 |
|
3348 test_documentgetxmlencoding01 |
|
3349 " |
|
3350 Call the getXmlEncoding method on a UTF-8 encoded XML document in which the encoding pseudo |
|
3351 attribute in its XMLDecl is UTF-8 and check if the value returned is UTF-8. |
|
3352 |
|
3353 Creator: IBM |
|
3354 Autor Neil Delima |
|
3355 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-encoding |
|
3356 " |
|
3357 | |
|
3358 doc "Document" |
|
3359 encodingName "String" |
|
3360 | |
|
3361 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf8'). |
|
3362 encodingName := doc xmlEncoding. |
|
3363 self assert: ( encodingName = 'uTf-8' ). |
|
3364 |
|
3365 ! |
|
3366 |
|
3367 test_documentgetxmlencoding02 |
|
3368 " |
|
3369 Call the getXmlEncoding method on a new document and check if the value returned |
|
3370 is null. |
|
3371 |
|
3372 Creator: IBM |
|
3373 Autor Neil Delima |
|
3374 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-encoding |
|
3375 " |
|
3376 | |
|
3377 doc "Document" |
|
3378 newDoc "Document" |
|
3379 domImpl "DOMImplementation" |
|
3380 encodingName "String" |
|
3381 nullDocType "DocumentType" |
|
3382 docElem "Element" |
|
3383 rootNS "String" |
|
3384 rootName "String" |
|
3385 | |
|
3386 nullDocType := nil. |
|
3387 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3388 docElem := doc documentElement. |
|
3389 rootNS := docElem namespaceURI. |
|
3390 rootName := docElem tagName. |
|
3391 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3392 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3393 encodingName := newDoc xmlEncoding. |
|
3394 self assert: encodingName isNil. |
|
3395 |
|
3396 ! |
|
3397 |
|
3398 test_documentgetxmlencoding03 |
|
3399 " |
|
3400 Call the getXmlEncoding method on a UTF-16 encoded document and check if the value returned |
|
3401 is UTF-16. |
|
3402 |
|
3403 Creator: IBM |
|
3404 Autor Neil Delima |
|
3405 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-encoding |
|
3406 " |
|
3407 | |
|
3408 doc "Document" |
|
3409 encodingName "String" |
|
3410 | |
|
3411 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf16'). |
|
3412 encodingName := doc xmlEncoding. |
|
3413 self assert: ( encodingName = 'uTf-16' ). |
|
3414 |
|
3415 ! |
|
3416 |
|
3417 test_documentgetxmlencoding04 |
|
3418 " |
|
3419 Call the getXmlEncoding method on a UTF-8 encoded XML document that does not contain |
|
3420 the encoding pseudo attribute in its XMLDecl and check if the value returend is null. |
|
3421 |
|
3422 Creator: IBM |
|
3423 Autor Neil Delima |
|
3424 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-encoding |
|
3425 " |
|
3426 | |
|
3427 doc "Document" |
|
3428 encodingName "String" |
|
3429 | |
|
3430 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3431 encodingName := doc xmlEncoding. |
|
3432 self assert: encodingName isNil. |
|
3433 |
|
3434 ! |
|
3435 |
|
3436 test_documentgetxmlencoding05 |
|
3437 " |
|
3438 Call the getXmlEncoding method on a cloned UTF-8 encoded document |
|
3439 and check if the value returned is UTF-8 or null (implementation dependent). |
|
3440 |
|
3441 Creator: IBM |
|
3442 Autor Neil Delima |
|
3443 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-encoding |
|
3444 " |
|
3445 | |
|
3446 doc "Document" |
|
3447 cloned "Document" |
|
3448 encodingName "String" |
|
3449 | |
|
3450 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf8'). |
|
3451 cloned := doc cloneNode:true. |
|
3452 encodingName := cloned xmlEncoding. |
|
3453 self assert: ( encodingName = 'uTf-8' ) or: [( encodingName isNil ) ]. |
|
3454 |
|
3455 ! |
|
3456 |
|
3457 test_documentgetxmlstandalone01 |
|
3458 " |
|
3459 Retreive the xmlStandalone attribute of a document for which standalone was not specified, this |
|
3460 should return false since the default for standalone is no when external markup decls |
|
3461 are present. |
|
3462 |
|
3463 Creator: IBM |
|
3464 Autor Neil Delima |
|
3465 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-standalone |
|
3466 " |
|
3467 | |
|
3468 doc "Document" |
|
3469 standalone "Boolean" |
|
3470 | |
|
3471 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3472 standalone := doc xmlStandalone. |
|
3473 self deny: standalone. |
|
3474 |
|
3475 ! |
|
3476 |
|
3477 test_documentgetxmlstandalone02 |
|
3478 " |
|
3479 The value of the standalone pesudo-attribute for a new Document should be false. |
|
3480 |
|
3481 Creator: IBM |
|
3482 Autor Neil Delima |
|
3483 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-standalone |
|
3484 " |
|
3485 | |
|
3486 doc "Document" |
|
3487 newDoc "Document" |
|
3488 domImpl "DOMImplementation" |
|
3489 standalone "Boolean" |
|
3490 nullDocType "DocumentType" |
|
3491 docElem "Element" |
|
3492 rootNS "String" |
|
3493 rootName "String" |
|
3494 | |
|
3495 nullDocType := nil. |
|
3496 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3497 docElem := doc documentElement. |
|
3498 rootNS := docElem namespaceURI. |
|
3499 rootName := docElem tagName. |
|
3500 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3501 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3502 standalone := newDoc xmlStandalone. |
|
3503 self deny: standalone. |
|
3504 |
|
3505 ! |
|
3506 |
|
3507 test_documentgetxmlstandalone03 |
|
3508 " |
|
3509 The value of the standalone attribute for an XML document with the standalone= no |
|
3510 should be false. |
|
3511 |
|
3512 Creator: IBM |
|
3513 Autor Neil Delima |
|
3514 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-standalone |
|
3515 " |
|
3516 | |
|
3517 doc "Document" |
|
3518 standalone "Boolean" |
|
3519 | |
|
3520 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_standalone_no'). |
|
3521 standalone := doc xmlStandalone. |
|
3522 self deny: standalone. |
|
3523 |
|
3524 ! |
|
3525 |
|
3526 test_documentgetxmlstandalone04 |
|
3527 " |
|
3528 Retreive the documentURI of a document for which standalone was specified as yes , this |
|
3529 should return true. |
|
3530 |
|
3531 Creator: IBM |
|
3532 Autor Neil Delima |
|
3533 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-standalone |
|
3534 " |
|
3535 | |
|
3536 doc "Document" |
|
3537 standalone "Boolean" |
|
3538 | |
|
3539 "implementationAttribute not supported: validating" |
|
3540 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_standalone_yes'). |
|
3541 standalone := doc xmlStandalone. |
|
3542 self assert: standalone. |
|
3543 |
|
3544 ! |
|
3545 |
|
3546 test_documentgetxmlstandalone05 |
|
3547 " |
|
3548 Cretae a new DocumentType node whose systemId is StaffNS.DTD. Create a new Document |
|
3549 node. Check if the value of the standalone attribute on the new Document is false. |
|
3550 |
|
3551 Creator: IBM |
|
3552 Autor Neil Delima |
|
3553 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-standalone |
|
3554 " |
|
3555 | |
|
3556 doc "Document" |
|
3557 newDoc "Document" |
|
3558 newDocType "DocumentType" |
|
3559 domImpl "DOMImplementation" |
|
3560 standalone "Boolean" |
|
3561 nullPubId "String" |
|
3562 docElem "Element" |
|
3563 rootNS "String" |
|
3564 rootName "String" |
|
3565 docType "DocumentType" |
|
3566 sysId "String" |
|
3567 | |
|
3568 nullPubId := nil. |
|
3569 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3570 docElem := doc documentElement. |
|
3571 rootNS := docElem namespaceURI. |
|
3572 rootName := docElem tagName. |
|
3573 docType := doc doctype. |
|
3574 sysId := docType systemId. |
|
3575 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3576 newDocType := domImpl createDocumentType:rootName publicId:nullPubId systemId:sysId. |
|
3577 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: newDocType. |
|
3578 standalone := newDoc xmlStandalone. |
|
3579 self deny: standalone. |
|
3580 |
|
3581 ! |
|
3582 |
|
3583 test_documentgetxmlversion01 |
|
3584 " |
|
3585 Check if the value of the version attribute in the XML declaration of this document |
|
3586 obtained by parsing staffNS.xml is 1.0 . |
|
3587 |
|
3588 Creator: IBM |
|
3589 Autor Neil Delima |
|
3590 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-version |
|
3591 " |
|
3592 | |
|
3593 doc "Document" |
|
3594 versionValue "String" |
|
3595 | |
|
3596 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3597 self assert: ( versionValue = '1.0' ). |
|
3598 |
|
3599 ! |
|
3600 |
|
3601 test_documentgetxmlversion02 |
|
3602 " |
|
3603 Check if the value of the version attribute in the XML declaration of a new document |
|
3604 is 1.0 . |
|
3605 |
|
3606 Creator: IBM |
|
3607 Autor Neil Delima |
|
3608 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-version |
|
3609 " |
|
3610 | |
|
3611 doc "Document" |
|
3612 newDoc "Document" |
|
3613 versionValue "String" |
|
3614 domImpl "DOMImplementation" |
|
3615 nullDocType "DocumentType" |
|
3616 docElem "Element" |
|
3617 rootNS "String" |
|
3618 rootName "String" |
|
3619 | |
|
3620 nullDocType := nil. |
|
3621 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3622 docElem := doc documentElement. |
|
3623 rootNS := docElem namespaceURI. |
|
3624 rootName := docElem tagName. |
|
3625 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
3626 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
3627 self assert: ( versionValue asLowercase = '1.0' asLowercase ). |
|
3628 |
|
3629 ! |
|
3630 |
|
3631 test_documentgetxmlversion03 |
|
3632 " |
|
3633 Check if the value of the version attribute in a XML document without a XMLDecl is |
|
3634 is 1.0 . |
|
3635 |
|
3636 Creator: IBM |
|
3637 Autor Neil Delima |
|
3638 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-version |
|
3639 " |
|
3640 | |
|
3641 doc "Document" |
|
3642 versionValue "String" |
|
3643 | |
|
3644 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3645 self assert: ( versionValue asLowercase = '1.0' asLowercase ). |
|
3646 |
|
3647 ! |
|
3648 |
|
3649 test_documentnormalizedocument01 |
|
3650 " |
|
3651 Invoke the normalizeDocument method on this document. Retreive the documentElement node |
|
3652 and check the nodeName of this node to make sure it has not changed. |
|
3653 |
|
3654 Creator: IBM |
|
3655 Autor Neil Delima |
|
3656 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
3657 " |
|
3658 | |
|
3659 doc "Document" |
|
3660 docElem "Element" |
|
3661 docElemNodeName "String" |
|
3662 origDocElemNodeName "String" |
|
3663 domConfig "DOMConfiguration" |
|
3664 errorMonitor "DOMErrorMonitor" |
|
3665 | |
|
3666 "implementationAttribute not supported: namespaceAware" |
|
3667 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3668 docElem := doc documentElement. |
|
3669 origDocElemNodeName := docElem nodeName. |
|
3670 domConfig := doc domConfig. |
|
3671 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
3672 doc normalizeDocument. |
|
3673 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
3674 docElem := doc documentElement. |
|
3675 docElemNodeName := docElem nodeName. |
|
3676 self assert: ( docElemNodeName = origDocElemNodeName ). |
|
3677 |
|
3678 ! |
|
3679 |
|
3680 test_documentnormalizedocument02 |
|
3681 " |
|
3682 Normalize a document with the 'cdata-sections' parameter set to false and |
|
3683 check if the CDATASection has been preserved. |
|
3684 |
|
3685 Creator: IBM |
|
3686 Autor Neil Delima |
|
3687 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
3688 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-cdata-sections |
|
3689 " |
|
3690 | |
|
3691 doc "Document" |
|
3692 elemList "NodeList" |
|
3693 elemName "Element" |
|
3694 cdata "CDATASection" |
|
3695 text "Text" |
|
3696 nodeName "String" |
|
3697 domConfig "DOMConfiguration" |
|
3698 errorMonitor "DOMErrorMonitor" |
|
3699 | |
|
3700 "implementationAttribute not supported: namespaceAware" |
|
3701 "implementationAttribute not supported: coalescing" |
|
3702 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
3703 elemList := doc getElementsByTagName: 'strong'. |
|
3704 elemName := elemList item:1. |
|
3705 cdata := elemName lastChild. |
|
3706 nodeName := cdata nodeName. |
|
3707 self assert: ( nodeName = '#cdata-section' ). |
|
3708 domConfig := doc domConfig. |
|
3709 domConfig setParameter: 'cdata-sections' value: true. |
|
3710 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
3711 doc normalizeDocument. |
|
3712 errorMonitor assertLowerSeverityFor: self message:'normalizationError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
3713 elemList := doc getElementsByTagName: 'strong'. |
|
3714 elemName := elemList item:1. |
|
3715 cdata := elemName lastChild. |
|
3716 nodeName := cdata nodeName. |
|
3717 self assert: ( nodeName = '#cdata-section' ). |
|
3718 domConfig setParameter: 'cdata-sections' value: false. |
|
3719 doc normalizeDocument. |
|
3720 errorMonitor assertLowerSeverityFor: self message:'normalization2Error' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
3721 elemList := doc getElementsByTagName: 'strong'. |
|
3722 elemName := elemList item:1. |
|
3723 text := elemName lastChild. |
|
3724 nodeName := text nodeName. |
|
3725 self assert: ( nodeName = '#text' ). |
|
3726 |
|
3727 ! |
|
3728 |
|
3729 test_documentnormalizedocument03 |
|
3730 " |
|
3731 Normalize a document with a created CDATA section with the |
|
3732 'cdata-sections' parameter set to true then to false and check if |
|
3733 the CDATASection has been preserved and then coalesced. |
|
3734 |
|
3735 Creator: IBM |
|
3736 Autor Neil Delima |
|
3737 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
3738 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=416 |
|
3739 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-cdata-sections |
|
3740 " |
|
3741 | |
|
3742 doc "Document" |
|
3743 elem "Element" |
|
3744 newCdata "CDATASection" |
|
3745 cdata "CDATASection" |
|
3746 text "Node" |
|
3747 nodeName "String" |
|
3748 nodeValue "String" |
|
3749 appendedChild "Node" |
|
3750 domConfig "DOMConfiguration" |
|
3751 pList "NodeList" |
|
3752 errorMonitor "DOMErrorMonitor" |
|
3753 | |
|
3754 "implementationAttribute not supported: namespaceAware" |
|
3755 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3756 pList := doc getElementsByTagName: 'p'. |
|
3757 elem := pList item:0. |
|
3758 newCdata := doc createCDATASection:'CDATA'. |
|
3759 appendedChild := elem appendChild:newCdata. |
|
3760 domConfig := doc domConfig. |
|
3761 domConfig setParameter: 'cdata-sections' value: true. |
|
3762 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
3763 doc normalizeDocument. |
|
3764 errorMonitor assertLowerSeverityFor: self message:'normalizationError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
3765 pList := doc getElementsByTagName: 'p'. |
|
3766 elem := pList item:0. |
|
3767 cdata := elem lastChild. |
|
3768 nodeName := cdata nodeName. |
|
3769 self assert: ( nodeName = '#cdata-section' ). |
|
3770 domConfig setParameter: 'cdata-sections' value: false. |
|
3771 doc normalizeDocument. |
|
3772 errorMonitor assertLowerSeverityFor: self message:'normalization2Error' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
3773 pList := doc getElementsByTagName: 'p'. |
|
3774 elem := pList item:0. |
|
3775 text := elem lastChild. |
|
3776 nodeName := text nodeName. |
|
3777 self assert: ( nodeName = '#text' ). |
|
3778 nodeValue := text nodeValue. |
|
3779 self assert: ( nodeValue = 'barCDATA' ). |
|
3780 |
|
3781 ! |
|
3782 |
|
3783 test_documentnormalizedocument04 |
|
3784 " |
|
3785 Append a Comment node and normalize with comments set to false. |
|
3786 |
|
3787 Creator: IBM |
|
3788 Autor Neil Delima |
|
3789 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
3790 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=416 |
|
3791 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-comments |
|
3792 " |
|
3793 | |
|
3794 doc "Document" |
|
3795 elem "Element" |
|
3796 newComment "Comment" |
|
3797 lastChild "Node" |
|
3798 text "Text" |
|
3799 nodeName "String" |
|
3800 appendedChild "Node" |
|
3801 domConfig "DOMConfiguration" |
|
3802 errorMonitor "DOMErrorMonitor" |
|
3803 pList "NodeList" |
|
3804 | |
|
3805 "implementationAttribute not supported: namespaceAware" |
|
3806 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3807 pList := doc getElementsByTagName: 'p'. |
|
3808 elem := pList item:0. |
|
3809 newComment := doc createComment:'COMMENT_NODE'. |
|
3810 appendedChild := elem appendChild:newComment. |
|
3811 domConfig := doc domConfig. |
|
3812 domConfig setParameter: 'comments' value: true. |
|
3813 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
3814 doc normalizeDocument. |
|
3815 errorMonitor assertLowerSeverityFor: self message:'normalizationError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
3816 pList := doc getElementsByTagName: 'p'. |
|
3817 elem := pList item:0. |
|
3818 lastChild := elem lastChild. |
|
3819 nodeName := lastChild nodeName. |
|
3820 self assert: ( nodeName = '#comment' ). |
|
3821 domConfig setParameter: 'comments' value: false. |
|
3822 doc normalizeDocument. |
|
3823 errorMonitor assertLowerSeverityFor: self message:'normalization2Error' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
3824 pList := doc getElementsByTagName: 'p'. |
|
3825 elem := pList item:0. |
|
3826 lastChild := elem lastChild. |
|
3827 nodeName := lastChild nodeName. |
|
3828 self assert: ( nodeName = '#text' ). |
|
3829 |
|
3830 ! |
|
3831 |
|
3832 test_documentnormalizedocument05 |
|
3833 " |
|
3834 Add a L1 element to a L2 namespace aware document and perform namespace normalization. Should result |
|
3835 in an error. |
|
3836 |
|
3837 Creator: Curt Arnold |
|
3838 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
3839 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algorithms#normalizeDocumentAlgo |
|
3840 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespaces |
|
3841 " |
|
3842 | |
|
3843 doc "Document" |
|
3844 elem "Element" |
|
3845 domConfig "DOMConfiguration" |
|
3846 pList "NodeList" |
|
3847 newChild "Element" |
|
3848 retval "Element" |
|
3849 errorMonitor "DOMErrorMonitor" |
|
3850 errors "List" |
|
3851 error "DOMError" |
|
3852 errorCount "SmallInteger" |
|
3853 severity "SmallInteger" |
|
3854 problemNode "Node" |
|
3855 location "DOMLocator" |
|
3856 lineNumber "SmallInteger" |
|
3857 columnNumber "SmallInteger" |
|
3858 byteOffset "SmallInteger" |
|
3859 utf16Offset "SmallInteger" |
|
3860 uri "String" |
|
3861 type "String" |
|
3862 message "String" |
|
3863 relatedException "DOMObject" |
|
3864 relatedData "DOMObject" |
|
3865 length "SmallInteger" |
|
3866 | |
|
3867 "implementationAttribute not supported: namespaceAware" |
|
3868 errorCount := 0. |
|
3869 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3870 pList := doc getElementsByTagName: 'p'. |
|
3871 elem := pList item:0. |
|
3872 newChild := doc createElement:'br'. |
|
3873 retval := elem appendChild:newChild. |
|
3874 domConfig := doc domConfig. |
|
3875 domConfig setParameter: 'namespaces' value: true. |
|
3876 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
3877 doc normalizeDocument. |
|
3878 errors := errorMonitor errors. |
|
3879 errors do: [error| |
|
3880 severity := error severity. |
|
3881 "if" |
|
3882 ( severity = 2 ) ifTrue: [ |
|
3883 self assert:false description:'Method "greater" is not supported yet'. |
|
3884 ]. |
|
3885 ]. |
|
3886 self assert: ( errorCount = 1 ). |
|
3887 |
|
3888 ! |
|
3889 |
|
3890 test_documentnormalizedocument06 |
|
3891 " |
|
3892 Add a CDATASection containing ]]> perform normalization with split-cdata-sections=true. Should result |
|
3893 in an warning. |
|
3894 |
|
3895 Creator: Curt Arnold |
|
3896 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
3897 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections |
|
3898 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-severity |
|
3899 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-message |
|
3900 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-type |
|
3901 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-relatedException |
|
3902 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-relatedData |
|
3903 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-location |
|
3904 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-line-number |
|
3905 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-column-number |
|
3906 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-byteOffset |
|
3907 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-utf16Offset |
|
3908 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-node |
|
3909 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-uri |
|
3910 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=542 |
|
3911 " |
|
3912 | |
|
3913 doc "Document" |
|
3914 elem "Element" |
|
3915 domConfig "DOMConfiguration" |
|
3916 elemList "NodeList" |
|
3917 newChild "CDATASection" |
|
3918 oldChild "Node" |
|
3919 retval "Node" |
|
3920 errorMonitor "DOMErrorMonitor" |
|
3921 errors "List" |
|
3922 error "DOMError" |
|
3923 splittedCount "SmallInteger" |
|
3924 severity "SmallInteger" |
|
3925 problemNode "Node" |
|
3926 location "DOMLocator" |
|
3927 lineNumber "SmallInteger" |
|
3928 columnNumber "SmallInteger" |
|
3929 byteOffset "SmallInteger" |
|
3930 utf16Offset "SmallInteger" |
|
3931 uri "String" |
|
3932 type "String" |
|
3933 message "String" |
|
3934 relatedException "DOMObject" |
|
3935 relatedData "DOMObject" |
|
3936 length "SmallInteger" |
|
3937 nodeType "SmallInteger" |
|
3938 nodeValue "String" |
|
3939 | |
|
3940 "implementationAttribute not supported: namespaceAware" |
|
3941 splittedCount := 0. |
|
3942 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
3943 elemList := doc getElementsByTagName: 'p'. |
|
3944 elem := elemList item:0. |
|
3945 newChild := doc createCDATASection:'this is not ]]> good'. |
|
3946 oldChild := elem firstChild. |
|
3947 elem replaceChild:oldChild with: newChild. |
|
3948 domConfig := doc domConfig. |
|
3949 domConfig setParameter: 'split-cdata-sections' value: true. |
|
3950 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
3951 doc normalizeDocument. |
|
3952 newChild := elem firstChild. |
|
3953 nodeValue := newChild nodeValue. |
|
3954 nodeType := newChild nodeType. |
|
3955 self deny: ( nodeType = 4 ) and: [false "no template for element contains" ]. |
|
3956 errors := errorMonitor errors. |
|
3957 errors do: [error| |
|
3958 type := error type. |
|
3959 severity := error severity. |
|
3960 "if" |
|
3961 ( type = 'cdata-sections-splitted' ) ifTrue: [ |
|
3962 self assert:false description:'Method "greater" is not supported yet'. |
|
3963 ]. |
|
3964 ]. |
|
3965 self assert: ( splittedCount = 1 ). |
|
3966 |
|
3967 ! |
|
3968 |
|
3969 test_documentnormalizedocument07 |
|
3970 " |
|
3971 Add a CDATASection containing ]]> and perform normalization with split-cdata-sections=false. Should result |
|
3972 in an error. |
|
3973 |
|
3974 Creator: Curt Arnold |
|
3975 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
3976 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections |
|
3977 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-severity |
|
3978 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-message |
|
3979 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-type |
|
3980 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-relatedException |
|
3981 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-relatedData |
|
3982 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ERROR-DOMError-location |
|
3983 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-line-number |
|
3984 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-column-number |
|
3985 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-byteOffset |
|
3986 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-utf16Offset |
|
3987 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-node |
|
3988 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMLocator-uri |
|
3989 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=542 |
|
3990 " |
|
3991 | |
|
3992 doc "Document" |
|
3993 elem "Element" |
|
3994 domConfig "DOMConfiguration" |
|
3995 elemList "NodeList" |
|
3996 newChild "CDATASection" |
|
3997 oldChild "Node" |
|
3998 retval "Node" |
|
3999 errorMonitor "DOMErrorMonitor" |
|
4000 errors "List" |
|
4001 error "DOMError" |
|
4002 errorCount "SmallInteger" |
|
4003 severity "SmallInteger" |
|
4004 problemNode "Node" |
|
4005 location "DOMLocator" |
|
4006 lineNumber "SmallInteger" |
|
4007 columnNumber "SmallInteger" |
|
4008 byteOffset "SmallInteger" |
|
4009 utf16Offset "SmallInteger" |
|
4010 uri "String" |
|
4011 type "String" |
|
4012 message "String" |
|
4013 relatedException "DOMObject" |
|
4014 relatedData "DOMObject" |
|
4015 length "SmallInteger" |
|
4016 | |
|
4017 errorCount := 0. |
|
4018 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
4019 elemList := doc getElementsByTagName: 'p'. |
|
4020 elem := elemList item:0. |
|
4021 oldChild := elem firstChild. |
|
4022 newChild := doc createCDATASection:'this is not ]]> good'. |
|
4023 elem replaceChild:oldChild with: newChild. |
|
4024 domConfig := doc domConfig. |
|
4025 domConfig setParameter: 'split-cdata-sections' value: false. |
|
4026 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
4027 doc normalizeDocument. |
|
4028 errors := errorMonitor errors. |
|
4029 errors do: [error| |
|
4030 severity := error severity. |
|
4031 "if" |
|
4032 ( severity = 2 ) ifTrue: [ |
|
4033 self assert:false description:'Method "greater" is not supported yet'. |
|
4034 ]. |
|
4035 ]. |
|
4036 self assert: ( errorCount = 1 ). |
|
4037 |
|
4038 ! |
|
4039 |
|
4040 test_documentnormalizedocument08 |
|
4041 " |
|
4042 Add two CDATASections containing ]]> perform normalization with split-cdata-sections=true. |
|
4043 Should result in two warnings and at least 4 nodes. |
|
4044 |
|
4045 Creator: Curt Arnold |
|
4046 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
4047 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections |
|
4048 " |
|
4049 | |
|
4050 doc "Document" |
|
4051 elem "Element" |
|
4052 domConfig "DOMConfiguration" |
|
4053 elemList "NodeList" |
|
4054 newChild "CDATASection" |
|
4055 oldChild "Node" |
|
4056 retval "Node" |
|
4057 errorMonitor "DOMErrorMonitor" |
|
4058 errors "List" |
|
4059 error "DOMError" |
|
4060 length "SmallInteger" |
|
4061 childNodes "NodeList" |
|
4062 type "String" |
|
4063 splittedCount "SmallInteger" |
|
4064 severity "SmallInteger" |
|
4065 | |
|
4066 "implementationAttribute not supported: namespaceAware" |
|
4067 splittedCount := 0. |
|
4068 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
4069 elemList := doc getElementsByTagName: 'p'. |
|
4070 elem := elemList item:0. |
|
4071 newChild := doc createCDATASection:'this is not ]]> good'. |
|
4072 oldChild := elem firstChild. |
|
4073 elem replaceChild:oldChild with: newChild. |
|
4074 newChild := doc createCDATASection:'this is not ]]> good'. |
|
4075 retval := elem appendChild:newChild. |
|
4076 domConfig := doc domConfig. |
|
4077 domConfig setParameter: 'split-cdata-sections' value: true. |
|
4078 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
4079 doc normalizeDocument. |
|
4080 errors := errorMonitor errors. |
|
4081 errors do: [error| |
|
4082 type := error type. |
|
4083 severity := error severity. |
|
4084 "if" |
|
4085 ( type = 'cdata-sections-splitted' ) ifTrue: [ |
|
4086 ]. |
|
4087 ]. |
|
4088 self assert: ( splittedCount = 2 ). |
|
4089 elemList := doc getElementsByTagName: 'p'. |
|
4090 elem := elemList item:0. |
|
4091 childNodes := elem childNodes. |
|
4092 length := childNodes length. |
|
4093 self assert: ( length > 3 ). |
|
4094 |
|
4095 ! |
|
4096 |
|
4097 test_documentnormalizedocument09 |
|
4098 " |
|
4099 The normalizeDocument method method acts as if the document was going through a save |
|
4100 and load cycle, putting the document in a normal form. |
|
4101 |
|
4102 Set the validate-if-schema feature to true. Invoke the normalizeDocument method on this |
|
4103 document. Retreive the documentElement node and check the nodeName of this node |
|
4104 to make sure it has not changed. Now set validate to false and verify the same. |
|
4105 Register an error handler on this Document and in each case make sure that it does |
|
4106 not get called. |
|
4107 |
|
4108 Creator: IBM |
|
4109 Autor Neil Delima |
|
4110 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
4111 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-validate-if-schema |
|
4112 " |
|
4113 | |
|
4114 doc "Document" |
|
4115 docElem "Element" |
|
4116 docElemNodeName "String" |
|
4117 canSet "Boolean" |
|
4118 errorHandler "DOMErrorHandler" |
|
4119 errHandler "DOMErrorHandler" |
|
4120 domConfig "DOMConfiguration" |
|
4121 | |
|
4122 "implementationAttribute not supported: namespaceAware" |
|
4123 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4124 domConfig := doc domConfig. |
|
4125 domConfig setParameter: 'error-handler' value: errHandler. |
|
4126 canSet := domConfig canSetParameter: 'validate-if-schema' value: true. |
|
4127 "if" |
|
4128 (canSet) ifTrue: [ |
|
4129 ]. |
|
4130 domConfig setParameter: 'validate-if-schema' value: false. |
|
4131 doc normalizeDocument. |
|
4132 docElem := doc documentElement. |
|
4133 docElemNodeName := docElem nodeName. |
|
4134 self assert: ( docElemNodeName = 'html' ). |
|
4135 |
|
4136 ! |
|
4137 |
|
4138 test_documentnormalizedocument10 |
|
4139 " |
|
4140 The normalizeDocument method method acts as if the document was going through a save |
|
4141 and load cycle, putting the document in a normal form. |
|
4142 |
|
4143 Create an Element and a text node and verify the nodeValue of this text node and append these to |
|
4144 this Document. If supported, invoke the setParameter method on this domconfiguration object to set the |
|
4145 element-content-whitespace feature to false. Invoke the normalizeDocument method and verify if |
|
4146 the text node has been discarded. |
|
4147 |
|
4148 Creator: IBM |
|
4149 Autor Neil Delima |
|
4150 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
4151 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-element-content-whitespace |
|
4152 " |
|
4153 | |
|
4154 doc "Document" |
|
4155 elem "Element" |
|
4156 newText "Text" |
|
4157 text "Text" |
|
4158 nodeValue "String" |
|
4159 canSet "Boolean" |
|
4160 appendedChild "Node" |
|
4161 domConfig "DOMConfiguration" |
|
4162 | |
|
4163 "implementationAttribute not supported: namespaceAware" |
|
4164 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4165 elem := doc createElement:'newElem'. |
|
4166 newText := doc createTextNode:'Text Node'. |
|
4167 appendedChild := elem appendChild:newText. |
|
4168 appendedChild := doc appendChild:elem. |
|
4169 text := elem firstChild. |
|
4170 nodeValue := text nodeValue. |
|
4171 self assert: ( nodeValue = 'Text Node' ). |
|
4172 domConfig := doc domConfig. |
|
4173 canSet := domConfig canSetParameter: 'element-content-whitespace' value: true. |
|
4174 self assert: canSet. |
|
4175 domConfig setParameter: 'element-content-whitespace' value: true. |
|
4176 doc normalizeDocument. |
|
4177 text := elem firstChild. |
|
4178 nodeValue := text nodeValue. |
|
4179 self assert: ( nodeValue = 'Text Node' ). |
|
4180 canSet := domConfig canSetParameter: 'element-content-whitespace' value: false. |
|
4181 "if" |
|
4182 (canSet) ifTrue: [ |
|
4183 ]. |
|
4184 |
|
4185 ! |
|
4186 |
|
4187 test_documentnormalizedocument11 |
|
4188 " |
|
4189 The normalizeDocument method method acts as if the document was going through a save |
|
4190 and load cycle, putting the document in a normal form. |
|
4191 The feature namespace-declarations when set to false, discards all namespace declaration attributes, |
|
4192 although namespace prefixes are still retained. |
|
4193 |
|
4194 Set the normalization feature namespace-declarations to false, invoke normalizeDocument and verify |
|
4195 the nodeName of element acquired by tagname. |
|
4196 |
|
4197 Creator: IBM |
|
4198 Autor Neil Delima |
|
4199 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
4200 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespace-declarations |
|
4201 " |
|
4202 | |
|
4203 doc "Document" |
|
4204 elemList "NodeList" |
|
4205 elemName "Element" |
|
4206 nodeName "String" |
|
4207 canSet "Boolean" |
|
4208 domConfig "DOMConfiguration" |
|
4209 | |
|
4210 "implementationAttribute not supported: namespaceAware" |
|
4211 ^self. "ignoringElementContentWhitespace supported" |
|
4212 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4213 domConfig := doc domConfig. |
|
4214 domConfig setParameter: 'namespace-declarations' value: true. |
|
4215 doc normalizeDocument. |
|
4216 elemList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
4217 elemName := elemList item:1. |
|
4218 self assert: elemName notNil. |
|
4219 canSet := domConfig canSetParameter: 'namespace-declarations' value: false. |
|
4220 "if" |
|
4221 (canSet) ifTrue: [ |
|
4222 ]. |
|
4223 |
|
4224 ! |
|
4225 |
|
4226 test_documentnormalizedocument12 |
|
4227 " |
|
4228 The normalizeDocument method method acts as if the document was going through a save |
|
4229 and load cycle, putting the document in a normal form. |
|
4230 |
|
4231 Set the validate feature to true. Invoke the normalizeDocument method on this |
|
4232 document. Retreive the documentElement node and check the nodeName of this node |
|
4233 to make sure it has not changed. Now set validate to false and verify the same. |
|
4234 Register an error handler on this Document and in each case make sure that it does |
|
4235 not get called. |
|
4236 |
|
4237 Creator: IBM |
|
4238 Autor Neil Delima |
|
4239 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
4240 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-validate |
|
4241 " |
|
4242 | |
|
4243 doc "Document" |
|
4244 docElem "Element" |
|
4245 docElemNodeName "String" |
|
4246 canSet "Boolean" |
|
4247 domConfig "DOMConfiguration" |
|
4248 errorHandler "DOMErrorHandler" |
|
4249 errHandler "DOMErrorHandler" |
|
4250 | |
|
4251 ^self. "Validation not supported" |
|
4252 ^self. "Schema validation not supported" |
|
4253 "implementationAttribute not supported: namespaceAware" |
|
4254 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4255 domConfig := doc domConfig. |
|
4256 domConfig setParameter: 'error-handler' value: errHandler. |
|
4257 canSet := domConfig canSetParameter: 'validate' value: true. |
|
4258 "if" |
|
4259 (canSet) ifTrue: [ |
|
4260 ]. |
|
4261 domConfig setParameter: 'validate' value: false. |
|
4262 doc normalizeDocument. |
|
4263 docElem := doc documentElement. |
|
4264 docElemNodeName := docElem nodeName. |
|
4265 self assert: ( docElemNodeName = 'html' ). |
|
4266 |
|
4267 ! |
|
4268 |
|
4269 test_documentnormalizedocument13 |
|
4270 " |
|
4271 Add a L1 attribute to a L2 namespace aware document and perform namespace normalization. Should result |
|
4272 in an error. |
|
4273 |
|
4274 Creator: Curt Arnold |
|
4275 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
4276 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algorithms#normalizeDocumentAlgo |
|
4277 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespaces |
|
4278 " |
|
4279 | |
|
4280 doc "Document" |
|
4281 elem "Element" |
|
4282 domConfig "DOMConfiguration" |
|
4283 pList "NodeList" |
|
4284 newAttr "Attr" |
|
4285 retval "Element" |
|
4286 errorMonitor "DOMErrorMonitor" |
|
4287 errors "List" |
|
4288 error "DOMError" |
|
4289 errorCount "SmallInteger" |
|
4290 severity "SmallInteger" |
|
4291 problemNode "Node" |
|
4292 location "DOMLocator" |
|
4293 lineNumber "SmallInteger" |
|
4294 columnNumber "SmallInteger" |
|
4295 byteOffset "SmallInteger" |
|
4296 utf16Offset "SmallInteger" |
|
4297 uri "String" |
|
4298 type "String" |
|
4299 message "String" |
|
4300 relatedException "DOMObject" |
|
4301 relatedData "DOMObject" |
|
4302 length "SmallInteger" |
|
4303 | |
|
4304 "implementationAttribute not supported: namespaceAware" |
|
4305 errorCount := 0. |
|
4306 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
4307 pList := doc getElementsByTagName: 'p'. |
|
4308 elem := pList item:0. |
|
4309 elem setAttribute:'title' value:'DOM L1 Attribute'. |
|
4310 newAttr := elem getAttributeNode:'title'. |
|
4311 domConfig := doc domConfig. |
|
4312 domConfig setParameter: 'namespaces' value: true. |
|
4313 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
4314 doc normalizeDocument. |
|
4315 errors := errorMonitor errors. |
|
4316 errors do: [error| |
|
4317 severity := error severity. |
|
4318 "if" |
|
4319 ( severity = 2 ) ifTrue: [ |
|
4320 self assert:false description:'Method "greater" is not supported yet'. |
|
4321 ]. |
|
4322 ]. |
|
4323 self assert: ( errorCount = 1 ). |
|
4324 |
|
4325 ! |
|
4326 |
|
4327 test_documentrenamenode01 |
|
4328 " |
|
4329 Invoke the renameNode method to rename the class attribute node of the |
|
4330 second element whose localName is acronym and namespaceURI http://www.nist.gov |
|
4331 with the new namespaceURI as http://www.w3.org/DOM/Test and name as pre0fix:renamedNode. |
|
4332 Check if this attribute has been renamed successfully by verifying the |
|
4333 nodeName, namespaceURI, nodeType attributes of the renamed node. |
|
4334 |
|
4335 Creator: IBM |
|
4336 Autor Neil Delima |
|
4337 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4338 " |
|
4339 | |
|
4340 doc "Document" |
|
4341 element "Element" |
|
4342 attr "Attr" |
|
4343 childList "NodeList" |
|
4344 renamedclass "Node" |
|
4345 nodeName "String" |
|
4346 nodeType "SmallInteger" |
|
4347 namespaceURI "String" |
|
4348 | |
|
4349 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4350 childList := doc getElementsByTagName: 'acronym'. |
|
4351 element := childList item:1. |
|
4352 attr := element getAttributeNode:'class'. |
|
4353 renamedclass := doc renameNode:attr namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'renamedNode'. |
|
4354 nodeName := renamedclass nodeName. |
|
4355 namespaceURI := renamedclass namespaceURI. |
|
4356 nodeType := renamedclass nodeType. |
|
4357 self assert: ( nodeName = 'renamedNode' ). |
|
4358 self assert: ( nodeType = 2 ). |
|
4359 self assert: ( namespaceURI = 'http://www.w3.org/DOM/Test' ). |
|
4360 |
|
4361 ! |
|
4362 |
|
4363 test_documentrenamenode02 |
|
4364 " |
|
4365 Invoke the renameNode method to rename the class attribute node of the |
|
4366 second element whose localName is acronym and namespaceURI http://www.nist.gov |
|
4367 with the new namespaceURI as http://www.w3.org/DOM/Test and name as prefi0x:renamedNode. |
|
4368 Check if this attribute has been renamed successfully by verifying the |
|
4369 nodeName, namespaceURI, nodeType attributes of the renamed node. |
|
4370 |
|
4371 Creator: IBM |
|
4372 Autor Neil Delima |
|
4373 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4374 " |
|
4375 | |
|
4376 doc "Document" |
|
4377 element "Element" |
|
4378 attr "Attr" |
|
4379 childList "NodeList" |
|
4380 renamedclass "Node" |
|
4381 nodeName "String" |
|
4382 nodeType "SmallInteger" |
|
4383 namespaceURI "String" |
|
4384 | |
|
4385 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4386 childList := doc getElementsByTagName: 'acronym'. |
|
4387 element := childList item:1. |
|
4388 attr := element getAttributeNode:'class'. |
|
4389 renamedclass := doc renameNode:attr namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'prefi0x:renamedNode'. |
|
4390 nodeName := renamedclass nodeName. |
|
4391 namespaceURI := renamedclass namespaceURI. |
|
4392 nodeType := renamedclass nodeType. |
|
4393 self assert: ( nodeName = 'prefi0x:renamedNode' ). |
|
4394 self assert: ( namespaceURI = 'http://www.w3.org/DOM/Test' ). |
|
4395 |
|
4396 ! |
|
4397 |
|
4398 test_documentrenamenode03 |
|
4399 " |
|
4400 Invoke the renameNode method to rename a new attribute node to one whose |
|
4401 namespaceURI is http://www.w3.org/DOM/Test and name is pre0:fix1. |
|
4402 Check if this attribute has been renamed successfully by verifying the |
|
4403 nodeName, namespaceURI, nodeType attributes of the renamed node. |
|
4404 |
|
4405 Creator: IBM |
|
4406 Autor Neil Delima |
|
4407 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4408 " |
|
4409 | |
|
4410 doc "Document" |
|
4411 attr "Attr" |
|
4412 renamedNode "Node" |
|
4413 nodeName "String" |
|
4414 namespaceURI "String" |
|
4415 nullNSURI "String" |
|
4416 | |
|
4417 nullNSURI := nil. |
|
4418 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4419 attr := doc createAttribute:'test' ns:nullNSURI. |
|
4420 renamedNode := doc renameNode:attr namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'pre0:fix1'. |
|
4421 nodeName := renamedNode nodeName. |
|
4422 namespaceURI := renamedNode namespaceURI. |
|
4423 self assert: ( nodeName = 'pre0:fix1' ). |
|
4424 self assert: ( namespaceURI = 'http://www.w3.org/DOM/Test' ). |
|
4425 |
|
4426 ! |
|
4427 |
|
4428 test_documentrenamenode04 |
|
4429 " |
|
4430 Invoke the renameNode method to rename a new attribute node to one whose |
|
4431 namespaceURI is null and name is pf. |
|
4432 Check if this attribute has been renamed successfully by verifying the |
|
4433 nodeName, namespaceURI, nodeType attributes of the renamed node. |
|
4434 |
|
4435 Creator: IBM |
|
4436 Autor Neil Delima |
|
4437 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4438 " |
|
4439 | |
|
4440 doc "Document" |
|
4441 attr "Attr" |
|
4442 renamedNode "Node" |
|
4443 nodeName "String" |
|
4444 namespaceURI "String" |
|
4445 | |
|
4446 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4447 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
4448 renamedNode := doc renameNode:attr namespaceUri:'' qualifiedName:'title'. |
|
4449 nodeName := renamedNode nodeName. |
|
4450 namespaceURI := renamedNode namespaceURI. |
|
4451 self assert: ( nodeName = 'title' ). |
|
4452 self assert: namespaceURI isNil. |
|
4453 |
|
4454 ! |
|
4455 |
|
4456 test_documentrenamenode05 |
|
4457 " |
|
4458 Invoke the renameNode method to rename a new attribute node to one whose |
|
4459 namespaceURI is null and name is rened. |
|
4460 Check if this attribute has been renamed successfully by verifying the |
|
4461 nodeName, namespaceURI, nodeType attributes of the renamed node. |
|
4462 |
|
4463 Creator: IBM |
|
4464 Autor Neil Delima |
|
4465 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4466 " |
|
4467 | |
|
4468 doc "Document" |
|
4469 attr "Attr" |
|
4470 renamedNode "Node" |
|
4471 nodeName "String" |
|
4472 namespaceURI "String" |
|
4473 nullNSURI "String" |
|
4474 | |
|
4475 nullNSURI := nil. |
|
4476 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4477 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
4478 renamedNode := doc renameNode:attr namespaceUri:nullNSURI qualifiedName:'title'. |
|
4479 nodeName := renamedNode nodeName. |
|
4480 namespaceURI := renamedNode namespaceURI. |
|
4481 self assert: namespaceURI isNil. |
|
4482 self assert: ( nodeName = 'title' ). |
|
4483 |
|
4484 ! |
|
4485 |
|
4486 test_documentrenamenode06 |
|
4487 " |
|
4488 Invoke the renameNode method to rename the default attribute dir to xsi:schemaLocation. |
|
4489 Check if this attribute has been renamed successfully by verifying the |
|
4490 nodeName, namespaceURI, nodeType attributes of the renamed node. |
|
4491 |
|
4492 Creator: IBM |
|
4493 Autor Neil Delima |
|
4494 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4495 " |
|
4496 | |
|
4497 doc "Document" |
|
4498 element "Element" |
|
4499 attr "Attr" |
|
4500 childList "NodeList" |
|
4501 renamedclass "Node" |
|
4502 nodeName "String" |
|
4503 nodeType "SmallInteger" |
|
4504 namespaceURI "String" |
|
4505 | |
|
4506 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4507 childList := doc getElementsByTagName: 'p'. |
|
4508 element := childList item:3. |
|
4509 attr := element getAttributeNode:'dir'. |
|
4510 renamedclass := doc renameNode:attr namespaceUri:'http://www.w3.org/2001/XMLSchema-instance' qualifiedName:'xsi:schemaLocation'. |
|
4511 nodeName := renamedclass nodeName. |
|
4512 namespaceURI := renamedclass namespaceURI. |
|
4513 nodeType := renamedclass nodeType. |
|
4514 self assert: ( nodeName = 'xsi:schemaLocation' ). |
|
4515 self assert: ( nodeType = 2 ). |
|
4516 self assert: ( namespaceURI = 'http://www.w3.org/2001/XMLSchema-instance' ). |
|
4517 |
|
4518 ! |
|
4519 |
|
4520 test_documentrenamenode07 |
|
4521 " |
|
4522 Invoke the renameNode method on a new document node to rename a new attribute node |
|
4523 to one whose namespaceURI is http://www.w3.org/XML/1998/namespace and name is xml:dom. |
|
4524 Check if this attribute has been renamed successfully by verifying the |
|
4525 nodeName and namespaceURI attributes of the renamed node. |
|
4526 |
|
4527 Creator: IBM |
|
4528 Autor Neil Delima |
|
4529 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4530 " |
|
4531 | |
|
4532 doc "Document" |
|
4533 newDoc "Document" |
|
4534 domImpl "DOMImplementation" |
|
4535 attr "Attr" |
|
4536 renamedNode "Node" |
|
4537 nodeName "String" |
|
4538 namespaceURI "String" |
|
4539 nullDocType "DocumentType" |
|
4540 docElem "Element" |
|
4541 rootNS "String" |
|
4542 rootName "String" |
|
4543 | |
|
4544 nullDocType := nil. |
|
4545 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4546 docElem := doc documentElement. |
|
4547 rootNS := docElem namespaceURI. |
|
4548 rootName := docElem tagName. |
|
4549 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
4550 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
4551 attr := newDoc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
4552 renamedNode := newDoc renameNode:attr namespaceUri:'http://www.w3.org/XML/1998/namespace' qualifiedName:'xml:dom'. |
|
4553 nodeName := renamedNode nodeName. |
|
4554 namespaceURI := renamedNode namespaceURI. |
|
4555 self assert: ( nodeName = 'xml:dom' ). |
|
4556 self assert: ( namespaceURI = 'http://www.w3.org/XML/1998/namespace' ). |
|
4557 |
|
4558 ! |
|
4559 |
|
4560 test_documentrenamenode08 |
|
4561 " |
|
4562 Invoke the renameNode method on a new document node and try to rename the default |
|
4563 attribute dir |
|
4564 Check if a WRONG_DOCUMENT_ERR gets thrown. |
|
4565 |
|
4566 Creator: IBM |
|
4567 Autor Neil Delima |
|
4568 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4569 " |
|
4570 | |
|
4571 doc "Document" |
|
4572 newDoc "Document" |
|
4573 domImpl "DOMImplementation" |
|
4574 element "Element" |
|
4575 attr "Attr" |
|
4576 childList "NodeList" |
|
4577 renamedNode "Node" |
|
4578 nullDocType "DocumentType" |
|
4579 docElem "Element" |
|
4580 docElemNS "String" |
|
4581 docElemName "String" |
|
4582 | |
|
4583 nullDocType := nil. |
|
4584 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4585 childList := doc getElementsByTagName: 'p'. |
|
4586 element := childList item:3. |
|
4587 attr := element getAttributeNode:'dir'. |
|
4588 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
4589 docElem := doc documentElement. |
|
4590 docElemNS := docElem namespaceURI. |
|
4591 docElemName := docElem tagName. |
|
4592 newDoc := domImpl createDocumentNS: docElemNS qualifiedName: docElemName doctype: nullDocType. |
|
4593 "assertDOMException..." |
|
4594 self should:[ |
|
4595 renamedNode := newDoc renameNode:attr namespaceUri:'http://www.w3.org/XML/1998/namespace' qualifiedName:'xml:lang'. |
|
4596 ] raise: DOMException. |
|
4597 self assert: (lastException code == DOMException WRONG_DOCUMENT_ERR). |
|
4598 "end of assertDOMException..." |
|
4599 |
|
4600 ! |
|
4601 |
|
4602 test_documentrenamenode09 |
|
4603 " |
|
4604 The method renameNode renames an existing node. When the specified node was created |
|
4605 from a different document than this document, a WRONG_DOCUMENT_ERR exception is thrown. |
|
4606 |
|
4607 Invoke the renameNode method on a new Document node to rename a new attribute node |
|
4608 created in the original Document, but later adopted by this new document node. The |
|
4609 ownerDocument attribute of this attribute has now changed, such that the attribute node is considered to |
|
4610 be created from this new document node. Verify that no exception is thrown upon renaming and verify |
|
4611 the new nodeName of this attribute node. |
|
4612 |
|
4613 Creator: IBM |
|
4614 Autor Neil Delima |
|
4615 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4616 " |
|
4617 | |
|
4618 doc "Document" |
|
4619 newDoc "Document" |
|
4620 domImpl "DOMImplementation" |
|
4621 attr "Attr" |
|
4622 renamedNode "Node" |
|
4623 adopted "Node" |
|
4624 nullDocType "DocumentType" |
|
4625 attrNodeName "String" |
|
4626 | |
|
4627 "implementationAttribute not supported: namespaceAware" |
|
4628 nullDocType := nil. |
|
4629 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4630 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
4631 newDoc := domImpl createDocumentNS: 'http://www.w3.org/DOM/Test' qualifiedName: 'dom:newD' doctype: nullDocType. |
|
4632 attr := doc createAttribute:'test' ns:'http://www.w3.org/DOM/Test'. |
|
4633 adopted := newDoc adoptNode: attr. |
|
4634 renamedNode := newDoc renameNode:attr namespaceUri:'http://www.w3.org/2000/xmlns/' qualifiedName:'xmlns:xmlns'. |
|
4635 attrNodeName := renamedNode nodeName. |
|
4636 self assert: ( attrNodeName = 'xmlns:xmlns' ). |
|
4637 |
|
4638 ! |
|
4639 |
|
4640 test_documentrenamenode10 |
|
4641 " |
|
4642 The method renameNode renames an existing node and raises a NAMESPACE_ERR |
|
4643 if the qualifiedName has a prefix and the namespaceURI is null but a |
|
4644 NOT_SUPPORTED_ERR should be raised since the the type of the specified node is |
|
4645 neither ELEMENT_NODE nor ATTRIBUTE_NODE. |
|
4646 |
|
4647 Invoke the renameNode method on a new document node to rename a node to nodes |
|
4648 with malformed qualifiedNames. |
|
4649 Check if a NOT_SUPPORTED_ERR gets thrown instead of a NAMESPACE_ERR. |
|
4650 |
|
4651 Creator: IBM |
|
4652 Autor Neil Delima |
|
4653 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4654 " |
|
4655 | |
|
4656 doc "Document" |
|
4657 textEntry "String" |
|
4658 textNode "Text" |
|
4659 renamedNode "Node" |
|
4660 qualifiedName "String" |
|
4661 nullDocType "DocumentType" |
|
4662 qualifiedNames "List" |
|
4663 | |
|
4664 "implementationAttribute not supported: namespaceAware" |
|
4665 textEntry := 'hello'. |
|
4666 nullDocType := nil. |
|
4667 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4668 textNode := doc createTextNode:textEntry. |
|
4669 qualifiedNames do: [qualifiedName| |
|
4670 "assertDOMException..." |
|
4671 self should:[ |
|
4672 renamedNode := doc renameNode:textNode namespaceUri:'http://www.w3.org/XML/1998/namespace' qualifiedName:qualifiedName. |
|
4673 ] raise: DOMException. |
|
4674 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
4675 "end of assertDOMException..." |
|
4676 ]. |
|
4677 |
|
4678 ! |
|
4679 |
|
4680 test_documentrenamenode11 |
|
4681 " |
|
4682 The method renameNode renames an existing node and raises a NAMESPACE_ERR |
|
4683 if the qualifiedName has a prefix and the namespaceURI is null but a |
|
4684 NOT_SUPPORTED_ERR should be raised since the the type of the specified node is |
|
4685 neither ELEMENT_NODE nor ATTRIBUTE_NODE. |
|
4686 |
|
4687 Invoke the renameNode method on this document node to rename a text node such that its |
|
4688 qualifiedName has a prefix and namespaceURI is null. |
|
4689 Check if a NOT_SUPPORTED_ERR gets thrown instead of a NAMESPACE_ERR. |
|
4690 |
|
4691 Creator: IBM |
|
4692 Autor Neil Delima |
|
4693 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4694 " |
|
4695 | |
|
4696 doc "Document" |
|
4697 textEntry "String" |
|
4698 textNode "Text" |
|
4699 renamedNode "Node" |
|
4700 nullDocType "DocumentType" |
|
4701 nullNSURI "String" |
|
4702 | |
|
4703 "implementationAttribute not supported: namespaceAware" |
|
4704 textEntry := 'hello'. |
|
4705 nullDocType := nil. |
|
4706 nullNSURI := nil. |
|
4707 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4708 textNode := doc createTextNode:textEntry. |
|
4709 "assertDOMException..." |
|
4710 self should:[ |
|
4711 renamedNode := doc renameNode:textNode namespaceUri:nullNSURI qualifiedName:'pre:fix'. |
|
4712 ] raise: DOMException. |
|
4713 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
4714 "end of assertDOMException..." |
|
4715 |
|
4716 ! |
|
4717 |
|
4718 test_documentrenamenode12 |
|
4719 " |
|
4720 The method renameNode renames an existing node and raises a NAMESPACE_ERR |
|
4721 if the qualifiedName has a prefix and the namespaceURI is null but a |
|
4722 NOT_SUPPORTED_ERR should be raised since the the type of the specified node is |
|
4723 neither ELEMENT_NODE nor ATTRIBUTE_NODE. |
|
4724 |
|
4725 Invoke the renameNode method on this document node to rename a text node such that its |
|
4726 qualifiedName has a prefix that is xml and namespaceURI is http://www.w3.org/XML/1999/namespace . |
|
4727 Check if a NOT_SUPPORTED_ERR gets thrown instead of a NAMESPACE_ERR since the type of node is not valid |
|
4728 for this method. |
|
4729 |
|
4730 Creator: IBM |
|
4731 Autor Neil Delima |
|
4732 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4733 " |
|
4734 | |
|
4735 doc "Document" |
|
4736 renamedNode "Node" |
|
4737 textEntry "String" |
|
4738 textNode "Text" |
|
4739 | |
|
4740 "implementationAttribute not supported: namespaceAware" |
|
4741 textEntry := 'hello'. |
|
4742 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4743 textNode := doc createTextNode:textEntry. |
|
4744 "assertDOMException..." |
|
4745 self should:[ |
|
4746 renamedNode := doc renameNode:textNode namespaceUri:'http://www.w3.org/XML/1999/namespace' qualifiedName:'xml:prefix'. |
|
4747 ] raise: DOMException. |
|
4748 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
4749 "end of assertDOMException..." |
|
4750 |
|
4751 ! |
|
4752 |
|
4753 test_documentrenamenode13 |
|
4754 " |
|
4755 The method renameNode renames an existing node and raises a NAMESPACE_ERR |
|
4756 if the qualifiedName has a prefix and the namespaceURI is null but a |
|
4757 NOT_SUPPORTED_ERR should be raised since the the type of the specified node is |
|
4758 neither ELEMENT_NODE nor ATTRIBUTE_NODE. |
|
4759 |
|
4760 Invoke the renameNode method on this document node to rename a text node such that its |
|
4761 qualifiedName has a prefix that is xmlns and namespaceURI is http://www.w3.org/XML/1998/namespace . |
|
4762 Check if a NOT_SUPPORTED_ERR gets thrown instead of a NAMESPACE_ERR since the type of node is not valid |
|
4763 for this method. |
|
4764 |
|
4765 Creator: IBM |
|
4766 Autor Neil Delima |
|
4767 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4768 " |
|
4769 | |
|
4770 doc "Document" |
|
4771 textEntry "String" |
|
4772 textNode "Text" |
|
4773 renamedNode "Node" |
|
4774 | |
|
4775 "implementationAttribute not supported: namespaceAware" |
|
4776 textEntry := 'hello'. |
|
4777 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4778 textNode := doc createTextNode:textEntry. |
|
4779 "assertDOMException..." |
|
4780 self should:[ |
|
4781 renamedNode := doc renameNode:textNode namespaceUri:'http://www.w3.org/XML/1998/namespace' qualifiedName:'xmlns:prefix'. |
|
4782 ] raise: DOMException. |
|
4783 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
4784 "end of assertDOMException..." |
|
4785 |
|
4786 ! |
|
4787 |
|
4788 test_documentrenamenode14 |
|
4789 " |
|
4790 The method renameNode renames an existing node and raises a NAMESPACE_ERR |
|
4791 if the qualifiedName has a prefix and the namespaceURI is null but a |
|
4792 NOT_SUPPORTED_ERR should be raised since the the type of the specified node is |
|
4793 neither ELEMENT_NODE nor ATTRIBUTE_NODE. |
|
4794 |
|
4795 Invoke the renameNode method on this document node to rename a text node such that its |
|
4796 qualifiedName is xmlns and namespaceURI is http://www.w3.org/2000/xmlns . |
|
4797 Check if a NOT_SUPPORTED_ERR gets thrown instead of a NAMESPACE_ERR since the type of node is |
|
4798 not valid for this method. |
|
4799 |
|
4800 Creator: IBM |
|
4801 Autor Neil Delima |
|
4802 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4803 " |
|
4804 | |
|
4805 doc "Document" |
|
4806 renamedNode "Node" |
|
4807 nullDocType "DocumentType" |
|
4808 textEntry "String" |
|
4809 textNode "Text" |
|
4810 | |
|
4811 "implementationAttribute not supported: namespaceAware" |
|
4812 nullDocType := nil. |
|
4813 textEntry := 'hello'. |
|
4814 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4815 textNode := doc createTextNode:textEntry. |
|
4816 "assertDOMException..." |
|
4817 self should:[ |
|
4818 renamedNode := doc renameNode:textNode namespaceUri:'http://www.w3.org/2000/xmlns' qualifiedName:'xmlns'. |
|
4819 ] raise: DOMException. |
|
4820 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
4821 "end of assertDOMException..." |
|
4822 |
|
4823 ! |
|
4824 |
|
4825 test_documentrenamenode15 |
|
4826 " |
|
4827 Rename the fourth acronym element to svg:rect and verify the |
|
4828 nodeName, namespaceURI, nodeType attributes of the renamed node. |
|
4829 |
|
4830 Creator: IBM |
|
4831 Autor Neil Delima |
|
4832 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4833 " |
|
4834 | |
|
4835 doc "Document" |
|
4836 element "Element" |
|
4837 childList "NodeList" |
|
4838 renamedclass "Node" |
|
4839 nodeName "String" |
|
4840 nodeType "SmallInteger" |
|
4841 namespaceURI "String" |
|
4842 | |
|
4843 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4844 childList := doc getElementsByTagName: 'acronym'. |
|
4845 element := childList item:3. |
|
4846 renamedclass := doc renameNode:element namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'qnam:renamedNode'. |
|
4847 nodeName := renamedclass nodeName. |
|
4848 namespaceURI := renamedclass namespaceURI. |
|
4849 nodeType := renamedclass nodeType. |
|
4850 self assert: ( nodeName = 'qnam:renamedNode' ). |
|
4851 self assert: ( nodeType = 1 ). |
|
4852 self assert: ( namespaceURI = 'http://www.w3.org/DOM/Test' ). |
|
4853 |
|
4854 ! |
|
4855 |
|
4856 test_documentrenamenode16 |
|
4857 " |
|
4858 Invoke the renameNode method to rename the fourth |
|
4859 acronym element with a new namespaceURI that is |
|
4860 null and qualifiedName that is renamedNode. |
|
4861 Check if this element has been renamed successfully by verifying the |
|
4862 nodeName, attributes of the renamed node. |
|
4863 |
|
4864 Creator: IBM |
|
4865 Autor Neil Delima |
|
4866 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4867 " |
|
4868 | |
|
4869 doc "Document" |
|
4870 element "Element" |
|
4871 childList "NodeList" |
|
4872 renamedclass "Node" |
|
4873 nodeName "String" |
|
4874 nodeType "SmallInteger" |
|
4875 namespaceURI "String" |
|
4876 nullNSURI "String" |
|
4877 | |
|
4878 nullNSURI := nil. |
|
4879 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4880 childList := doc getElementsByTagName: 'acronym'. |
|
4881 element := childList item:3. |
|
4882 renamedclass := doc renameNode:element namespaceUri:nullNSURI qualifiedName:'renamedNode'. |
|
4883 nodeName := renamedclass nodeName. |
|
4884 namespaceURI := renamedclass namespaceURI. |
|
4885 nodeType := renamedclass nodeType. |
|
4886 self assert: ( nodeName = 'renamedNode' ). |
|
4887 self assert: ( nodeType = 1 ). |
|
4888 self assert: namespaceURI isNil. |
|
4889 |
|
4890 ! |
|
4891 |
|
4892 test_documentrenamenode17 |
|
4893 " |
|
4894 Invoke the renameNode method to rename a new element node of a new document so that |
|
4895 its namespaceURI is http://www.w3.org/2000/xmlns/ and qualifiedName is xmlns:xmlns. |
|
4896 Check if this element has been renamed successfully by verifying the |
|
4897 nodeName, attributes of the renamed node. |
|
4898 |
|
4899 Creator: IBM |
|
4900 Autor Neil Delima |
|
4901 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4902 " |
|
4903 | |
|
4904 doc "Document" |
|
4905 newDoc "Document" |
|
4906 domImpl "DOMImplementation" |
|
4907 element "Element" |
|
4908 renamedNode "Node" |
|
4909 nodeName "String" |
|
4910 nodeType "SmallInteger" |
|
4911 namespaceURI "String" |
|
4912 docElem "Element" |
|
4913 rootNS "String" |
|
4914 rootTagname "String" |
|
4915 nullDocType "DocumentType" |
|
4916 | |
|
4917 nullDocType := nil. |
|
4918 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
4919 docElem := doc documentElement. |
|
4920 rootNS := docElem namespaceURI. |
|
4921 rootTagname := docElem tagName. |
|
4922 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
4923 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootTagname doctype: nullDocType. |
|
4924 element := newDoc createElement:'body' ns:'http://www.w3.org/1999/xhtml'. |
|
4925 renamedNode := newDoc renameNode:element namespaceUri:'http://www.w3.org/1999/xhtml' qualifiedName:'xhtml:head'. |
|
4926 nodeName := renamedNode nodeName. |
|
4927 namespaceURI := renamedNode namespaceURI. |
|
4928 nodeType := renamedNode nodeType. |
|
4929 self assert: ( nodeName = 'xhtml:head' ). |
|
4930 self assert: ( nodeType = 1 ). |
|
4931 self assert: ( namespaceURI = 'http://www.w3.org/1999/xhtml' ). |
|
4932 |
|
4933 ! |
|
4934 |
|
4935 test_documentrenamenode18 |
|
4936 " |
|
4937 Invoke the renameNode method on this document and try to rename a new element |
|
4938 node of a new document. |
|
4939 Check if a WRONG_DOCUMENT_ERR gets thrown. |
|
4940 |
|
4941 Creator: IBM |
|
4942 Autor Neil Delima |
|
4943 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4944 " |
|
4945 | |
|
4946 doc "Document" |
|
4947 newDoc "Document" |
|
4948 domImpl "DOMImplementation" |
|
4949 element "Element" |
|
4950 renamedNode "Node" |
|
4951 docElem "Element" |
|
4952 rootNS "String" |
|
4953 rootTagname "String" |
|
4954 nullDocType "DocumentType" |
|
4955 | |
|
4956 nullDocType := nil. |
|
4957 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
4958 docElem := doc documentElement. |
|
4959 rootNS := docElem namespaceURI. |
|
4960 rootTagname := docElem tagName. |
|
4961 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
4962 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootTagname doctype: nullDocType. |
|
4963 element := newDoc createElement:'body' ns:'http://www.w3.org/1999/xhtml'. |
|
4964 "assertDOMException..." |
|
4965 self should:[ |
|
4966 renamedNode := doc renameNode:element namespaceUri:'http://www.w3.org/1999/xhtml' qualifiedName:'head'. |
|
4967 ] raise: DOMException. |
|
4968 self assert: (lastException code == DOMException WRONG_DOCUMENT_ERR). |
|
4969 "end of assertDOMException..." |
|
4970 |
|
4971 ! |
|
4972 |
|
4973 test_documentrenamenode19 |
|
4974 " |
|
4975 The method renameNode renames an existing node and raises a NAMESPACE_ERR |
|
4976 if the qualifiedName is malformed per the Namespaces in XML specification. |
|
4977 |
|
4978 Invoke the renameNode method on a new document node to rename a node to nodes |
|
4979 with malformed qualifiedNames. |
|
4980 Check if a NAMESPACE_ERR gets thrown. |
|
4981 |
|
4982 Creator: IBM |
|
4983 Autor Neil Delima |
|
4984 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
4985 " |
|
4986 | |
|
4987 doc "Document" |
|
4988 newDoc "Document" |
|
4989 domImpl "DOMImplementation" |
|
4990 element "Element" |
|
4991 renamedNode "Node" |
|
4992 qualifiedName "String" |
|
4993 nullDocType "DocumentType" |
|
4994 qualifiedNames "List" |
|
4995 | |
|
4996 "implementationAttribute not supported: namespaceAware" |
|
4997 nullDocType := nil. |
|
4998 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
4999 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5000 newDoc := domImpl createDocumentNS: 'http://www.w3.org/DOM/Test' qualifiedName: 'newD' doctype: nullDocType. |
|
5001 element := doc createElement:'test' ns:'http://www.w3.org/DOM/Test'. |
|
5002 qualifiedNames do: [qualifiedName| |
|
5003 "assertDOMException..." |
|
5004 self should:[ |
|
5005 renamedNode := doc renameNode:element namespaceUri:'http://www.w3.org/2000/XMLNS' qualifiedName:qualifiedName. |
|
5006 ] raise: DOMException. |
|
5007 self assert: (lastException code == DOMException NAMESPACE_ERR). |
|
5008 "end of assertDOMException..." |
|
5009 ]. |
|
5010 |
|
5011 ! |
|
5012 |
|
5013 test_documentrenamenode20 |
|
5014 " |
|
5015 Invoke the renameNode method on this document node to rename a node such that its |
|
5016 qualifiedName has a prefix that is xml:html and namespaceURI is |
|
5017 http://www.example.com/namespace . |
|
5018 Check if a NAMESPACE_ERR gets thrown. |
|
5019 |
|
5020 Creator: IBM |
|
5021 Autor Neil Delima |
|
5022 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5023 " |
|
5024 | |
|
5025 doc "Document" |
|
5026 element "Element" |
|
5027 renamedNode "Node" |
|
5028 docElem "Element" |
|
5029 rootNS "String" |
|
5030 rootTagname "String" |
|
5031 | |
|
5032 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
5033 docElem := doc documentElement. |
|
5034 rootNS := docElem namespaceURI. |
|
5035 rootTagname := docElem tagName. |
|
5036 docElem := doc documentElement. |
|
5037 rootNS := docElem namespaceURI. |
|
5038 rootTagname := docElem tagName. |
|
5039 element := doc createElement:rootTagname ns:rootNS. |
|
5040 "assertDOMException..." |
|
5041 self should:[ |
|
5042 renamedNode := doc renameNode:element namespaceUri:'http://www.example.com/xml' qualifiedName:'xml:html'. |
|
5043 ] raise: DOMException. |
|
5044 self assert: (lastException code == DOMException NAMESPACE_ERR). |
|
5045 "end of assertDOMException..." |
|
5046 |
|
5047 ! |
|
5048 |
|
5049 test_documentrenamenode21 |
|
5050 " |
|
5051 Invoke the renameNode method on this document node to rename a node such that its |
|
5052 qualifiedName has a prefix that is xmlns:xml and namespaceURI is http://www.w3.org/2000/XMLNS/ . |
|
5053 Check if a NAMESPACE_ERR gets thrown. |
|
5054 |
|
5055 Creator: IBM |
|
5056 Autor Neil Delima |
|
5057 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5058 " |
|
5059 | |
|
5060 doc "Document" |
|
5061 newDoc "Document" |
|
5062 domImpl "DOMImplementation" |
|
5063 attr "Attr" |
|
5064 renamedNode "Node" |
|
5065 nullDocType "DocumentType" |
|
5066 docElem "Element" |
|
5067 rootNS "String" |
|
5068 rootName "String" |
|
5069 | |
|
5070 nullDocType := nil. |
|
5071 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5072 docElem := doc documentElement. |
|
5073 rootNS := docElem namespaceURI. |
|
5074 rootName := docElem tagName. |
|
5075 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5076 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
5077 attr := newDoc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
5078 "assertDOMException..." |
|
5079 self should:[ |
|
5080 renamedNode := newDoc renameNode:attr namespaceUri:'http://www.w3.org/2000/XMLNS/' qualifiedName:'xmlns:xml'. |
|
5081 ] raise: DOMException. |
|
5082 self assert: (lastException code == DOMException NAMESPACE_ERR). |
|
5083 "end of assertDOMException..." |
|
5084 |
|
5085 ! |
|
5086 |
|
5087 test_documentrenamenode22 |
|
5088 " |
|
5089 Invoke the renameNode method on this document node to rename a node such that its |
|
5090 qualifiedName is xmlns and namespaceURI is http://www.w3.org/1999/xmlns/ . |
|
5091 Check if a NAMESPACE_ERR gets thrown. |
|
5092 |
|
5093 Creator: IBM |
|
5094 Autor Neil Delima |
|
5095 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5096 " |
|
5097 | |
|
5098 doc "Document" |
|
5099 attr "Attr" |
|
5100 renamedNode "Node" |
|
5101 | |
|
5102 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5103 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
5104 "assertDOMException..." |
|
5105 self should:[ |
|
5106 renamedNode := doc renameNode:attr namespaceUri:'http://www.w3.org/1999/xmlns/' qualifiedName:'xmlns'. |
|
5107 ] raise: DOMException. |
|
5108 self assert: (lastException code == DOMException NAMESPACE_ERR). |
|
5109 "end of assertDOMException..." |
|
5110 |
|
5111 ! |
|
5112 |
|
5113 test_documentrenamenode23 |
|
5114 " |
|
5115 The method renameNode renames an existing node and raises a NOT_SUPPORTED_ERR |
|
5116 if the type of the specified node is neither ELEMENT_NODE nor ATTRIBUTE_NODE. |
|
5117 |
|
5118 Invoke the renameNode method on this document node to attempt to rename itself. |
|
5119 Check if a NOT_SUPPORTED_ERR gets thrown. |
|
5120 |
|
5121 Creator: IBM |
|
5122 Autor Neil Delima |
|
5123 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5124 " |
|
5125 | |
|
5126 doc "Document" |
|
5127 renamedNode "Node" |
|
5128 docowner "Document" |
|
5129 | |
|
5130 "implementationAttribute not supported: namespaceAware" |
|
5131 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5132 "assertDOMException..." |
|
5133 self should:[ |
|
5134 renamedNode := doc renameNode:doc namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'root'. |
|
5135 ] raise: DOMException. |
|
5136 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5137 "end of assertDOMException..." |
|
5138 |
|
5139 ! |
|
5140 |
|
5141 test_documentrenamenode24 |
|
5142 " |
|
5143 The method renameNode renames an existing node and raises a NOT_SUPPORTED_ERR |
|
5144 if the type of the specified node is neither ELEMENT_NODE nor ATTRIBUTE_NODE. |
|
5145 |
|
5146 Invoke the renameNode method on this document node to attempt to rename itself. |
|
5147 The namespaceURI specified here is null and the name has a prefix. |
|
5148 Check if a NOT_SUPPORTED_ERR gets thrown. |
|
5149 |
|
5150 Creator: IBM |
|
5151 Autor Neil Delima |
|
5152 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5153 " |
|
5154 | |
|
5155 doc "Document" |
|
5156 renamedNode "Node" |
|
5157 nullNSURI "String" |
|
5158 docowner "Document" |
|
5159 | |
|
5160 "implementationAttribute not supported: namespaceAware" |
|
5161 nullNSURI := nil. |
|
5162 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5163 "assertDOMException..." |
|
5164 self should:[ |
|
5165 renamedNode := doc renameNode:doc namespaceUri:nullNSURI qualifiedName:'doc:root'. |
|
5166 ] raise: DOMException. |
|
5167 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5168 "end of assertDOMException..." |
|
5169 |
|
5170 ! |
|
5171 |
|
5172 test_documentrenamenode25 |
|
5173 " |
|
5174 Invoke the renameNode method to attempt to rename a DOcumentType node of this Document. |
|
5175 Check if a NOT_SUPPORTED_ERR gets thrown. |
|
5176 |
|
5177 Creator: IBM |
|
5178 Autor Neil Delima |
|
5179 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5180 " |
|
5181 | |
|
5182 doc "Document" |
|
5183 docType "DocumentType" |
|
5184 renamedNode "Node" |
|
5185 | |
|
5186 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5187 docType := doc doctype. |
|
5188 "assertDOMException..." |
|
5189 self should:[ |
|
5190 renamedNode := doc renameNode:docType namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'root'. |
|
5191 ] raise: DOMException. |
|
5192 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5193 "end of assertDOMException..." |
|
5194 |
|
5195 ! |
|
5196 |
|
5197 test_documentrenamenode26 |
|
5198 " |
|
5199 Invoke the renameNode method oto attempt to rename a new DocumentFragment node |
|
5200 of this Document. |
|
5201 Check if a NOT_SUPPORTED_ERR gets thrown. |
|
5202 |
|
5203 Creator: IBM |
|
5204 Autor Neil Delima |
|
5205 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5206 " |
|
5207 | |
|
5208 doc "Document" |
|
5209 docFrag "DocumentFragment" |
|
5210 renamedNode "Node" |
|
5211 | |
|
5212 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5213 docFrag := doc createDocumentFragment. |
|
5214 "assertDOMException..." |
|
5215 self should:[ |
|
5216 renamedNode := doc renameNode:docFrag namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'root'. |
|
5217 ] raise: DOMException. |
|
5218 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5219 "end of assertDOMException..." |
|
5220 |
|
5221 ! |
|
5222 |
|
5223 test_documentrenamenode27 |
|
5224 " |
|
5225 Invoke the renameNode method to attempt to rename new Text, Comment, CDataSection, |
|
5226 ProcessingInstruction and EntityReference nodes of a new Document. |
|
5227 Check if a NOT_SUPPORTED_ERR is thrown. |
|
5228 |
|
5229 Creator: IBM |
|
5230 Autor Neil Delima |
|
5231 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5232 " |
|
5233 | |
|
5234 doc "Document" |
|
5235 newDoc "Document" |
|
5236 domImpl "DOMImplementation" |
|
5237 text "Text" |
|
5238 comment "Comment" |
|
5239 cdata "CDATASection" |
|
5240 pi "ProcessingInstruction" |
|
5241 entref "EntityReference" |
|
5242 renamedTxt "Node" |
|
5243 renamedComment "Node" |
|
5244 renamedCdata "Node" |
|
5245 renamedPi "Node" |
|
5246 renamedEntRef "Node" |
|
5247 nullDocType "DocumentType" |
|
5248 docElem "Element" |
|
5249 rootNS "String" |
|
5250 rootName "String" |
|
5251 | |
|
5252 nullDocType := nil. |
|
5253 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5254 docElem := doc documentElement. |
|
5255 rootNS := docElem namespaceURI. |
|
5256 rootName := docElem tagName. |
|
5257 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5258 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
5259 text := newDoc createTextNode:'text'. |
|
5260 comment := newDoc createComment:'comment'. |
|
5261 cdata := newDoc createCDATASection:'cdata'. |
|
5262 pi := newDoc createProcessingInstruction:'pit' data:'pid'. |
|
5263 entref := newDoc createEntityReference:'alpha'. |
|
5264 "assertDOMException..." |
|
5265 self should:[ |
|
5266 renamedTxt := newDoc renameNode:text namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'text'. |
|
5267 ] raise: DOMException. |
|
5268 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5269 "end of assertDOMException..." |
|
5270 "assertDOMException..." |
|
5271 self should:[ |
|
5272 renamedComment := newDoc renameNode:comment namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'comment'. |
|
5273 ] raise: DOMException. |
|
5274 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5275 "end of assertDOMException..." |
|
5276 "assertDOMException..." |
|
5277 self should:[ |
|
5278 renamedCdata := newDoc renameNode:cdata namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'cdata'. |
|
5279 ] raise: DOMException. |
|
5280 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5281 "end of assertDOMException..." |
|
5282 "assertDOMException..." |
|
5283 self should:[ |
|
5284 renamedPi := newDoc renameNode:pi namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'pi'. |
|
5285 ] raise: DOMException. |
|
5286 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5287 "end of assertDOMException..." |
|
5288 "assertDOMException..." |
|
5289 self should:[ |
|
5290 renamedEntRef := newDoc renameNode:entref namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'entref'. |
|
5291 ] raise: DOMException. |
|
5292 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5293 "end of assertDOMException..." |
|
5294 |
|
5295 ! |
|
5296 |
|
5297 test_documentrenamenode28 |
|
5298 " |
|
5299 Invoke the renameNode method to attempt to rename a Entity and Notation nodes of this Document. |
|
5300 Check if a NOT_SUPPORTED_ERR gets thrown. |
|
5301 |
|
5302 Creator: IBM |
|
5303 Autor Neil Delima |
|
5304 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5305 " |
|
5306 | |
|
5307 doc "Document" |
|
5308 docType "DocumentType" |
|
5309 entityNodeMap "NamedNodeMap" |
|
5310 notationNodeMap "NamedNodeMap" |
|
5311 entity "Entity" |
|
5312 notation "Notation" |
|
5313 renamedEntityNode "Node" |
|
5314 renamedNotationNode "Node" |
|
5315 | |
|
5316 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5317 docType := doc doctype. |
|
5318 entityNodeMap := docType entities. |
|
5319 notationNodeMap := docType notations. |
|
5320 entity := entityNodeMap getNamedItem:'alpha'. |
|
5321 notation := notationNodeMap getNamedItem:'notation1'. |
|
5322 "assertDOMException..." |
|
5323 self should:[ |
|
5324 renamedEntityNode := doc renameNode:entity namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'beta'. |
|
5325 ] raise: DOMException. |
|
5326 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5327 "end of assertDOMException..." |
|
5328 "assertDOMException..." |
|
5329 self should:[ |
|
5330 renamedNotationNode := doc renameNode:notation namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'notation2'. |
|
5331 ] raise: DOMException. |
|
5332 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5333 "end of assertDOMException..." |
|
5334 |
|
5335 ! |
|
5336 |
|
5337 test_documentrenamenode29 |
|
5338 " |
|
5339 Invoke the renameNode method to attempt to rename an Element node of a XML1.0 document |
|
5340 with a name that contains an invalid XML 1.0 character and check if a INVALID_CHARACTER_ERR |
|
5341 gets thrown. |
|
5342 |
|
5343 Creator: IBM |
|
5344 Autor Neil Delima |
|
5345 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-renameNode |
|
5346 " |
|
5347 | |
|
5348 doc "Document" |
|
5349 docElem "Element" |
|
5350 renamed "Node" |
|
5351 | |
|
5352 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5353 docElem := doc documentElement. |
|
5354 "assertDOMException..." |
|
5355 self should:[ |
|
5356 renamed := doc renameNode:docElem namespaceUri:'http://www.w3.org/DOM/Test' qualifiedName:'@'. |
|
5357 ] raise: DOMException. |
|
5358 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
5359 "end of assertDOMException..." |
|
5360 |
|
5361 ! |
|
5362 |
|
5363 test_documentsetdocumenturi01 |
|
5364 " |
|
5365 The setDocmentURI method set the location of the document. |
|
5366 |
|
5367 Set the documentURI to a valid string and retreive the documentURI of this |
|
5368 document and verify if it is was correctly set. |
|
5369 |
|
5370 Creator: IBM |
|
5371 Autor Neil Delima |
|
5372 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-documentURI |
|
5373 " |
|
5374 | |
|
5375 doc "Document" |
|
5376 docURI "String" |
|
5377 | |
|
5378 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5379 doc documentURI:'file:///test'. |
|
5380 docURI := doc documentURI. |
|
5381 self assert: ( docURI = 'file:///test' ). |
|
5382 |
|
5383 ! |
|
5384 |
|
5385 test_documentsetdocumenturi02 |
|
5386 " |
|
5387 The setDocmentURI method set the location of the document. |
|
5388 |
|
5389 Set the documentURI to null and retreive the documentURI of this document and verify |
|
5390 if it is was set to null. |
|
5391 |
|
5392 Creator: IBM |
|
5393 Autor Neil Delima |
|
5394 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-documentURI |
|
5395 " |
|
5396 | |
|
5397 doc "Document" |
|
5398 docURI "String" |
|
5399 nullValue "String" |
|
5400 | |
|
5401 nullValue := nil. |
|
5402 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5403 doc documentURI:nullValue. |
|
5404 docURI := doc documentURI. |
|
5405 self assert: docURI isNil. |
|
5406 |
|
5407 ! |
|
5408 |
|
5409 test_documentsetdocumenturi03 |
|
5410 " |
|
5411 The setDocmentURI method set the location of the document. |
|
5412 |
|
5413 Create a new document and set its documentURI to a valid string. Retreive the documentURI |
|
5414 and verify if it is was correctly set. |
|
5415 |
|
5416 Creator: IBM |
|
5417 Autor Neil Delima |
|
5418 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-documentURI |
|
5419 " |
|
5420 | |
|
5421 doc "Document" |
|
5422 newDoc "Document" |
|
5423 domImpl "DOMImplementation" |
|
5424 docURI "String" |
|
5425 nullDocType "DocumentType" |
|
5426 docElem "Element" |
|
5427 rootNS "String" |
|
5428 rootName "String" |
|
5429 | |
|
5430 nullDocType := nil. |
|
5431 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
5432 docElem := doc documentElement. |
|
5433 rootNS := docElem namespaceURI. |
|
5434 rootName := docElem tagName. |
|
5435 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5436 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
5437 newDoc documentURI:'somestring'. |
|
5438 docURI := newDoc documentURI. |
|
5439 self assert: ( docURI = 'somestring' ). |
|
5440 |
|
5441 ! |
|
5442 |
|
5443 test_documentsetstricterrorchecking01 |
|
5444 " |
|
5445 Set the strictErrorChecking attribute value on this documentNode to false and then to true. |
|
5446 Call the createAttributeNS method on this document with an illegal character in the qualifiedName |
|
5447 and check if the INVALID_CHARACTER_ERR is thrown. |
|
5448 |
|
5449 Creator: IBM |
|
5450 Autor Neil Delima |
|
5451 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-strictErrorChecking |
|
5452 " |
|
5453 | |
|
5454 doc "Document" |
|
5455 newAttr "Attr" |
|
5456 | |
|
5457 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5458 doc strictErrorChecking:false. |
|
5459 doc strictErrorChecking:true. |
|
5460 "assertDOMException..." |
|
5461 self should:[ |
|
5462 newAttr := doc createAttribute:'@' ns:'http://www.w3.org/DOM/Test'. |
|
5463 ] raise: DOMException. |
|
5464 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
5465 "end of assertDOMException..." |
|
5466 |
|
5467 ! |
|
5468 |
|
5469 test_documentsetstricterrorchecking02 |
|
5470 " |
|
5471 Set the strictErrorChecking attribute value on a new Document to true. |
|
5472 Call the createAttributeNS method on this document with a a null namespaceURI and a qualified name |
|
5473 with a prefix and check if the NAMESPACE_ERR is thrown. |
|
5474 |
|
5475 Creator: IBM |
|
5476 Autor Neil Delima |
|
5477 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-strictErrorChecking |
|
5478 " |
|
5479 | |
|
5480 doc "Document" |
|
5481 newAttr "Attr" |
|
5482 nullValue "String" |
|
5483 | |
|
5484 nullValue := nil. |
|
5485 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5486 doc strictErrorChecking:true. |
|
5487 "assertDOMException..." |
|
5488 self should:[ |
|
5489 newAttr := doc createAttribute:'dom:test' ns:nullValue. |
|
5490 ] raise: DOMException. |
|
5491 self assert: (lastException code == DOMException NAMESPACE_ERR). |
|
5492 "end of assertDOMException..." |
|
5493 |
|
5494 ! |
|
5495 |
|
5496 test_documentsetstricterrorchecking03 |
|
5497 " |
|
5498 Set the strictErrorChecking attribute value on a new Document to false and check if it was |
|
5499 correctly set using getStrictErrorChecking. |
|
5500 |
|
5501 Creator: IBM |
|
5502 Autor Neil Delima |
|
5503 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-strictErrorChecking |
|
5504 " |
|
5505 | |
|
5506 doc "Document" |
|
5507 strictErrorCheckingValue "Boolean" |
|
5508 | |
|
5509 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5510 doc strictErrorChecking:false. |
|
5511 strictErrorCheckingValue := doc strictErrorChecking. |
|
5512 self deny: strictErrorCheckingValue. |
|
5513 |
|
5514 ! |
|
5515 |
|
5516 test_documentsetxmlstandalone01 |
|
5517 " |
|
5518 Set the standalone attribute of this document to true and verify if the attribute was correctly |
|
5519 set. |
|
5520 |
|
5521 Creator: IBM |
|
5522 Autor Neil Delima |
|
5523 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-standalone |
|
5524 " |
|
5525 | |
|
5526 doc "Document" |
|
5527 standalone "Boolean" |
|
5528 | |
|
5529 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5530 doc xmlStandalone:true. |
|
5531 standalone := doc xmlStandalone. |
|
5532 self assert: standalone. |
|
5533 |
|
5534 ! |
|
5535 |
|
5536 test_documentsetxmlstandalone02 |
|
5537 " |
|
5538 Create a new document object and set standalone to false and check if it was correctly set. |
|
5539 Then repeat this by setting it to true. |
|
5540 |
|
5541 Creator: IBM |
|
5542 Autor Neil Delima |
|
5543 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-standalone |
|
5544 " |
|
5545 | |
|
5546 doc "Document" |
|
5547 newDoc "Document" |
|
5548 domImpl "DOMImplementation" |
|
5549 standalone "Boolean" |
|
5550 nullDocType "DocumentType" |
|
5551 docElem "Element" |
|
5552 rootNS "String" |
|
5553 rootName "String" |
|
5554 | |
|
5555 nullDocType := nil. |
|
5556 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
5557 docElem := doc documentElement. |
|
5558 rootNS := docElem namespaceURI. |
|
5559 rootName := docElem tagName. |
|
5560 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5561 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
5562 newDoc xmlStandalone:false. |
|
5563 standalone := newDoc xmlStandalone. |
|
5564 self deny: standalone. |
|
5565 newDoc xmlStandalone:true. |
|
5566 standalone := newDoc xmlStandalone. |
|
5567 self assert: standalone. |
|
5568 |
|
5569 ! |
|
5570 |
|
5571 test_documentsetxmlversion01 |
|
5572 " |
|
5573 Set the value of the version attribute of the XML declaration of this document to |
|
5574 various invalid characters and verify if a NOT_SUPPORTED_ERR is thrown. |
|
5575 |
|
5576 Creator: IBM |
|
5577 Autor Neil Delima |
|
5578 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-version |
|
5579 " |
|
5580 | |
|
5581 doc "Document" |
|
5582 versionValue "String" |
|
5583 illegalVersion "List" |
|
5584 | |
|
5585 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
5586 illegalVersion do: [versionValue| |
|
5587 "assertDOMException..." |
|
5588 self should:[ |
|
5589 ] raise: DOMException. |
|
5590 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5591 "end of assertDOMException..." |
|
5592 ]. |
|
5593 |
|
5594 ! |
|
5595 |
|
5596 test_documentsetxmlversion02 |
|
5597 " |
|
5598 Set the value of the version attribute of the XML declaration of a new document to 1.0 |
|
5599 and check if it was correctly set. |
|
5600 |
|
5601 Creator: IBM |
|
5602 Autor Neil Delima |
|
5603 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-version |
|
5604 " |
|
5605 | |
|
5606 doc "Document" |
|
5607 versionValue "String" |
|
5608 newDoc "Document" |
|
5609 domImpl "DOMImplementation" |
|
5610 nullDocType "DocumentType" |
|
5611 docElem "Element" |
|
5612 rootNS "String" |
|
5613 rootName "String" |
|
5614 | |
|
5615 nullDocType := nil. |
|
5616 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
5617 docElem := doc documentElement. |
|
5618 rootNS := docElem namespaceURI. |
|
5619 rootName := docElem tagName. |
|
5620 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5621 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
5622 self assert: ( versionValue = '1.0' ). |
|
5623 |
|
5624 ! |
|
5625 |
|
5626 test_documentsetxmlversion03 |
|
5627 " |
|
5628 Set the value of the version attribute of the XML declaration of a new document to 1.0 |
|
5629 and check if it was correctly set. |
|
5630 |
|
5631 Creator: IBM |
|
5632 Autor Neil Delima |
|
5633 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-version |
|
5634 " |
|
5635 | |
|
5636 doc "Document" |
|
5637 versionValue "String" |
|
5638 newDoc "Document" |
|
5639 domImpl "DOMImplementation" |
|
5640 nullDocType "DocumentType" |
|
5641 docElem "Element" |
|
5642 rootNS "String" |
|
5643 rootName "String" |
|
5644 | |
|
5645 nullDocType := nil. |
|
5646 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
5647 docElem := doc documentElement. |
|
5648 rootNS := docElem namespaceURI. |
|
5649 rootName := docElem tagName. |
|
5650 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5651 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
5652 self assert: ( versionValue = '1.1' ). |
|
5653 |
|
5654 ! |
|
5655 |
|
5656 test_documentsetxmlversion05 |
|
5657 " |
|
5658 Set the value of the version attribute of the XML declaration of a new document to - |
|
5659 and check if a NOT_SUPPORTED_ERR is thrown. |
|
5660 |
|
5661 Creator: IBM |
|
5662 Autor Neil Delima |
|
5663 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-version |
|
5664 " |
|
5665 | |
|
5666 doc "Document" |
|
5667 newDoc "Document" |
|
5668 domImpl "DOMImplementation" |
|
5669 nullDocType "DocumentType" |
|
5670 docElem "Element" |
|
5671 rootNS "String" |
|
5672 rootName "String" |
|
5673 | |
|
5674 nullDocType := nil. |
|
5675 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
5676 docElem := doc documentElement. |
|
5677 rootNS := docElem namespaceURI. |
|
5678 rootName := docElem tagName. |
|
5679 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5680 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
5681 "assertDOMException..." |
|
5682 self should:[ |
|
5683 ] raise: DOMException. |
|
5684 self assert: (lastException code == DOMException NOT_SUPPORTED_ERR). |
|
5685 "end of assertDOMException..." |
|
5686 |
|
5687 ! |
|
5688 |
|
5689 test_domconfigcanonicalform1 |
|
5690 "Checks behavior of canonical-form configuration parameter. |
|
5691 Creator: Curt Arnold |
|
5692 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
5693 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
5694 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-property |
|
5695 " |
|
5696 | |
|
5697 domImpl "DOMImplementation" |
|
5698 doc "Document" |
|
5699 domConfig "DOMConfiguration" |
|
5700 nullDocType "DocumentType" |
|
5701 canSet "Boolean" |
|
5702 state "Boolean" |
|
5703 parameter "String" |
|
5704 | |
|
5705 nullDocType := nil. |
|
5706 parameter := 'cAnOnical-form'. |
|
5707 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5708 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5709 domConfig := doc domConfig. |
|
5710 state := domConfig getParameter: parameter. |
|
5711 self deny: state. |
|
5712 canSet := domConfig canSetParameter: parameter value: false. |
|
5713 self assert: canSet. |
|
5714 canSet := domConfig canSetParameter: parameter value: true. |
|
5715 "if" |
|
5716 (canSet) ifTrue: [ |
|
5717 ]. |
|
5718 domConfig setParameter: parameter value: false. |
|
5719 |
|
5720 ! |
|
5721 |
|
5722 test_domconfigcdatasections1 |
|
5723 "Checks behavior of cdata-sections configuration parameter. |
|
5724 Creator: Curt Arnold |
|
5725 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-cdata-sections |
|
5726 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
5727 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
5728 " |
|
5729 | |
|
5730 domImpl "DOMImplementation" |
|
5731 doc "Document" |
|
5732 domConfig "DOMConfiguration" |
|
5733 nullDocType "DocumentType" |
|
5734 canSet "Boolean" |
|
5735 state "Boolean" |
|
5736 parameter "String" |
|
5737 | |
|
5738 nullDocType := nil. |
|
5739 parameter := 'cDaTa-sections'. |
|
5740 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5741 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5742 domConfig := doc domConfig. |
|
5743 state := domConfig getParameter: parameter. |
|
5744 self assert: state. |
|
5745 canSet := domConfig canSetParameter: parameter value: false. |
|
5746 self assert: canSet. |
|
5747 canSet := domConfig canSetParameter: parameter value: true. |
|
5748 self assert: canSet. |
|
5749 domConfig setParameter: parameter value: false. |
|
5750 state := domConfig getParameter: parameter. |
|
5751 self deny: state. |
|
5752 domConfig setParameter: parameter value: true. |
|
5753 state := domConfig getParameter: parameter. |
|
5754 self assert: state. |
|
5755 |
|
5756 ! |
|
5757 |
|
5758 test_domconfigcheckcharacternormalization1 |
|
5759 "Checks behavior of check-character-normalization configuration parameter. |
|
5760 Creator: Curt Arnold |
|
5761 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-check-character-normalization |
|
5762 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
5763 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
5764 " |
|
5765 | |
|
5766 domImpl "DOMImplementation" |
|
5767 doc "Document" |
|
5768 domConfig "DOMConfiguration" |
|
5769 nullDocType "DocumentType" |
|
5770 canSet "Boolean" |
|
5771 state "Boolean" |
|
5772 parameter "String" |
|
5773 | |
|
5774 nullDocType := nil. |
|
5775 parameter := 'cHeCk-character-normalization'. |
|
5776 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5777 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5778 domConfig := doc domConfig. |
|
5779 state := domConfig getParameter: parameter. |
|
5780 self deny: state. |
|
5781 canSet := domConfig canSetParameter: parameter value: false. |
|
5782 self assert: canSet. |
|
5783 canSet := domConfig canSetParameter: parameter value: true. |
|
5784 "if" |
|
5785 (canSet) ifTrue: [ |
|
5786 ]. |
|
5787 domConfig setParameter: parameter value: false. |
|
5788 |
|
5789 ! |
|
5790 |
|
5791 test_domconfigcomments1 |
|
5792 "Checks behavior of comments configuration parameter. |
|
5793 Creator: Curt Arnold |
|
5794 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-comments |
|
5795 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration |
|
5796 " |
|
5797 | |
|
5798 domImpl "DOMImplementation" |
|
5799 doc "Document" |
|
5800 domConfig "DOMConfiguration" |
|
5801 nullDocType "DocumentType" |
|
5802 canSet "Boolean" |
|
5803 state "Boolean" |
|
5804 parameter "String" |
|
5805 | |
|
5806 nullDocType := nil. |
|
5807 parameter := 'cOmments'. |
|
5808 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5809 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5810 domConfig := doc domConfig. |
|
5811 state := domConfig getParameter: parameter. |
|
5812 self assert: state. |
|
5813 canSet := domConfig canSetParameter: parameter value: false. |
|
5814 self assert: canSet. |
|
5815 canSet := domConfig canSetParameter: parameter value: true. |
|
5816 self assert: canSet. |
|
5817 domConfig setParameter: parameter value: false. |
|
5818 state := domConfig getParameter: parameter. |
|
5819 self deny: state. |
|
5820 domConfig setParameter: parameter value: true. |
|
5821 state := domConfig getParameter: parameter. |
|
5822 self assert: state. |
|
5823 |
|
5824 ! |
|
5825 |
|
5826 test_domconfigdatatypenormalization1 |
|
5827 "Checks behavior of datatype-normalization configuration parameter. |
|
5828 Creator: Curt Arnold |
|
5829 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
5830 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration |
|
5831 " |
|
5832 | |
|
5833 domImpl "DOMImplementation" |
|
5834 doc "Document" |
|
5835 domConfig "DOMConfiguration" |
|
5836 nullDocType "DocumentType" |
|
5837 canSet "Boolean" |
|
5838 state "Boolean" |
|
5839 parameter "String" |
|
5840 | |
|
5841 nullDocType := nil. |
|
5842 parameter := 'dAtAtype-normalization'. |
|
5843 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5844 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5845 domConfig := doc domConfig. |
|
5846 state := domConfig getParameter: parameter. |
|
5847 self deny: state. |
|
5848 canSet := domConfig canSetParameter: parameter value: false. |
|
5849 self assert: canSet. |
|
5850 canSet := domConfig canSetParameter: parameter value: true. |
|
5851 "if" |
|
5852 (canSet) ifTrue: [ |
|
5853 ]. |
|
5854 domConfig setParameter: parameter value: false. |
|
5855 |
|
5856 ! |
|
5857 |
|
5858 test_domconfigdatatypenormalization2 |
|
5859 "Setting datatype-normalization to true also forces validate to true. |
|
5860 Creator: Curt Arnold |
|
5861 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
5862 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration |
|
5863 " |
|
5864 | |
|
5865 domImpl "DOMImplementation" |
|
5866 doc "Document" |
|
5867 domConfig "DOMConfiguration" |
|
5868 nullDocType "DocumentType" |
|
5869 canSet "Boolean" |
|
5870 state "Boolean" |
|
5871 parameter "String" |
|
5872 | |
|
5873 nullDocType := nil. |
|
5874 parameter := 'datatype-normalization'. |
|
5875 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5876 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5877 domConfig := doc domConfig. |
|
5878 domConfig setParameter: 'validate' value: false. |
|
5879 canSet := domConfig canSetParameter: parameter value: true. |
|
5880 "if" |
|
5881 (canSet) ifTrue: [ |
|
5882 ]. |
|
5883 |
|
5884 ! |
|
5885 |
|
5886 test_domconfigelementcontentwhitespace1 |
|
5887 "Checks behavior of element-content-whitespace configuration parameter. |
|
5888 Creator: Curt Arnold |
|
5889 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-element-content-whitespace |
|
5890 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
5891 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
5892 " |
|
5893 | |
|
5894 domImpl "DOMImplementation" |
|
5895 doc "Document" |
|
5896 domConfig "DOMConfiguration" |
|
5897 nullDocType "DocumentType" |
|
5898 canSet "Boolean" |
|
5899 state "Boolean" |
|
5900 parameter "String" |
|
5901 | |
|
5902 nullDocType := nil. |
|
5903 parameter := 'eLeMent-content-whitespace'. |
|
5904 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5905 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5906 domConfig := doc domConfig. |
|
5907 state := domConfig getParameter: parameter. |
|
5908 self assert: state. |
|
5909 canSet := domConfig canSetParameter: parameter value: true. |
|
5910 self assert: canSet. |
|
5911 canSet := domConfig canSetParameter: parameter value: false. |
|
5912 "if" |
|
5913 (canSet) ifTrue: [ |
|
5914 ]. |
|
5915 domConfig setParameter: parameter value: true. |
|
5916 |
|
5917 ! |
|
5918 |
|
5919 test_domconfigentities1 |
|
5920 "Checks behavior of entities configuration parameter. |
|
5921 Creator: Curt Arnold |
|
5922 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-entities |
|
5923 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
5924 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
5925 " |
|
5926 | |
|
5927 domImpl "DOMImplementation" |
|
5928 doc "Document" |
|
5929 domConfig "DOMConfiguration" |
|
5930 nullDocType "DocumentType" |
|
5931 canSet "Boolean" |
|
5932 state "Boolean" |
|
5933 parameter "String" |
|
5934 | |
|
5935 nullDocType := nil. |
|
5936 parameter := 'eNtIties'. |
|
5937 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5938 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5939 domConfig := doc domConfig. |
|
5940 state := domConfig getParameter: parameter. |
|
5941 self assert: state. |
|
5942 canSet := domConfig canSetParameter: parameter value: false. |
|
5943 self assert: canSet. |
|
5944 canSet := domConfig canSetParameter: parameter value: true. |
|
5945 self assert: canSet. |
|
5946 domConfig setParameter: parameter value: false. |
|
5947 state := domConfig getParameter: parameter. |
|
5948 self deny: state. |
|
5949 domConfig setParameter: parameter value: true. |
|
5950 state := domConfig getParameter: parameter. |
|
5951 self assert: state. |
|
5952 |
|
5953 ! |
|
5954 |
|
5955 test_domconfigerrorhandler1 |
|
5956 "Checks behavior of error-handler configuration parameter. |
|
5957 Creator: Curt Arnold |
|
5958 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-error-handler |
|
5959 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
5960 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
5961 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=544 |
|
5962 " |
|
5963 | |
|
5964 domImpl "DOMImplementation" |
|
5965 doc "Document" |
|
5966 domConfig "DOMConfiguration" |
|
5967 nullDocType "DocumentType" |
|
5968 canSet "Boolean" |
|
5969 origHandler "DOMErrorHandler" |
|
5970 state "DOMErrorHandler" |
|
5971 parameter "String" |
|
5972 errorHandler "DOMErrorHandler" |
|
5973 | |
|
5974 nullDocType := nil. |
|
5975 parameter := 'eRrOr-handler'. |
|
5976 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
5977 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
5978 domConfig := doc domConfig. |
|
5979 origHandler := domConfig getParameter: parameter. |
|
5980 canSet := domConfig canSetParameter: parameter value: errorHandler. |
|
5981 self assert: canSet. |
|
5982 canSet := domConfig canSetParameter: parameter value: origHandler. |
|
5983 self assert: canSet. |
|
5984 domConfig setParameter: parameter value: errorHandler. |
|
5985 state := domConfig getParameter: parameter. |
|
5986 self assert: state == errorHandler. |
|
5987 domConfig setParameter: parameter value: origHandler. |
|
5988 state := domConfig getParameter: parameter. |
|
5989 self assert: state == origHandler. |
|
5990 canSet := domConfig canSetParameter: parameter value: true. |
|
5991 "if" |
|
5992 (canSet) ifTrue: [ |
|
5993 ]. |
|
5994 |
|
5995 ! |
|
5996 |
|
5997 test_domconfigerrorhandler2 |
|
5998 "Calls DOMConfiguration.setParameter( error-handler , null). Spec |
|
5999 does not explicitly address the case. |
|
6000 Creator: Curt Arnold |
|
6001 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-error-handler |
|
6002 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6003 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6004 " |
|
6005 | |
|
6006 domImpl "DOMImplementation" |
|
6007 doc "Document" |
|
6008 domConfig "DOMConfiguration" |
|
6009 nullDocType "DocumentType" |
|
6010 canSet "Boolean" |
|
6011 errorHandler "DOMErrorHandler" |
|
6012 parameter "String" |
|
6013 state "DOMErrorHandler" |
|
6014 | |
|
6015 nullDocType := nil. |
|
6016 errorHandler := nil. |
|
6017 parameter := 'error-handler'. |
|
6018 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6019 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6020 domConfig := doc domConfig. |
|
6021 canSet := domConfig canSetParameter: parameter value: errorHandler. |
|
6022 self assert: canSet. |
|
6023 domConfig setParameter: parameter value: errorHandler. |
|
6024 state := domConfig getParameter: parameter. |
|
6025 self assert: state isNil. |
|
6026 |
|
6027 ! |
|
6028 |
|
6029 test_domconfiginfoset1 |
|
6030 "Checks behavior of infoset configuration parameter. |
|
6031 Creator: Curt Arnold |
|
6032 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
6033 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6034 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6035 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-cdata-sections |
|
6036 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-entities |
|
6037 " |
|
6038 | |
|
6039 domImpl "DOMImplementation" |
|
6040 doc "Document" |
|
6041 domConfig "DOMConfiguration" |
|
6042 nullDocType "DocumentType" |
|
6043 canSet "Boolean" |
|
6044 state "Boolean" |
|
6045 parameter "String" |
|
6046 | |
|
6047 nullDocType := nil. |
|
6048 parameter := 'iNfOset'. |
|
6049 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6050 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6051 domConfig := doc domConfig. |
|
6052 state := domConfig getParameter: parameter. |
|
6053 self deny: state. |
|
6054 canSet := domConfig canSetParameter: parameter value: false. |
|
6055 self assert: canSet. |
|
6056 canSet := domConfig canSetParameter: parameter value: true. |
|
6057 self assert: canSet. |
|
6058 domConfig setParameter: parameter value: true. |
|
6059 state := domConfig getParameter: parameter. |
|
6060 self assert: state. |
|
6061 state := domConfig getParameter: 'entities'. |
|
6062 self deny: state. |
|
6063 state := domConfig getParameter: 'cdata-sections'. |
|
6064 self deny: state. |
|
6065 domConfig setParameter: parameter value: false. |
|
6066 state := domConfig getParameter: parameter. |
|
6067 self assert: state. |
|
6068 domConfig setParameter: 'entities' value: true. |
|
6069 state := domConfig getParameter: parameter. |
|
6070 self deny: state. |
|
6071 |
|
6072 ! |
|
6073 |
|
6074 test_domconfignamespacedeclarations1 |
|
6075 "Checks behavior of namespace-declarations configuration parameter. |
|
6076 Creator: Curt Arnold |
|
6077 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespace-declarations |
|
6078 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6079 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6080 " |
|
6081 | |
|
6082 domImpl "DOMImplementation" |
|
6083 doc "Document" |
|
6084 domConfig "DOMConfiguration" |
|
6085 nullDocType "DocumentType" |
|
6086 canSet "Boolean" |
|
6087 state "Boolean" |
|
6088 parameter "String" |
|
6089 | |
|
6090 nullDocType := nil. |
|
6091 parameter := 'nAmEspace-declarations'. |
|
6092 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6093 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6094 domConfig := doc domConfig. |
|
6095 state := domConfig getParameter: parameter. |
|
6096 self assert: state. |
|
6097 canSet := domConfig canSetParameter: parameter value: false. |
|
6098 self assert: canSet. |
|
6099 canSet := domConfig canSetParameter: parameter value: true. |
|
6100 self assert: canSet. |
|
6101 domConfig setParameter: parameter value: false. |
|
6102 state := domConfig getParameter: parameter. |
|
6103 self deny: state. |
|
6104 domConfig setParameter: parameter value: true. |
|
6105 state := domConfig getParameter: parameter. |
|
6106 self assert: state. |
|
6107 |
|
6108 ! |
|
6109 |
|
6110 test_domconfignamespaces1 |
|
6111 "Checks behavior of namespaces configuration parameter. |
|
6112 Creator: Curt Arnold |
|
6113 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespaces |
|
6114 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration |
|
6115 " |
|
6116 | |
|
6117 domImpl "DOMImplementation" |
|
6118 doc "Document" |
|
6119 domConfig "DOMConfiguration" |
|
6120 nullDocType "DocumentType" |
|
6121 canSet "Boolean" |
|
6122 state "Boolean" |
|
6123 parameter "String" |
|
6124 | |
|
6125 nullDocType := nil. |
|
6126 parameter := 'nAmEspaces'. |
|
6127 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6128 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6129 domConfig := doc domConfig. |
|
6130 state := domConfig getParameter: parameter. |
|
6131 self assert: state. |
|
6132 canSet := domConfig canSetParameter: parameter value: true. |
|
6133 self assert: canSet. |
|
6134 canSet := domConfig canSetParameter: parameter value: false. |
|
6135 "if" |
|
6136 (canSet) ifTrue: [ |
|
6137 ]. |
|
6138 domConfig setParameter: parameter value: true. |
|
6139 |
|
6140 ! |
|
6141 |
|
6142 test_domconfignamespaces2 |
|
6143 "Document.getParameter( namespaces ) should be true regardles if the |
|
6144 parse that created the document was namespace aware. |
|
6145 Creator: Curt Arnold |
|
6146 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespaces |
|
6147 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration |
|
6148 " |
|
6149 | |
|
6150 doc "Document" |
|
6151 domConfig "DOMConfiguration" |
|
6152 state "Boolean" |
|
6153 | |
|
6154 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
6155 domConfig := doc domConfig. |
|
6156 state := domConfig getParameter: 'namespaces'. |
|
6157 self assert: state. |
|
6158 |
|
6159 ! |
|
6160 |
|
6161 test_domconfignormalizecharacters1 |
|
6162 "Checks behavior of normalize-characters configuration parameter. |
|
6163 Creator: Curt Arnold |
|
6164 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
6165 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6166 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6167 " |
|
6168 | |
|
6169 domImpl "DOMImplementation" |
|
6170 doc "Document" |
|
6171 domConfig "DOMConfiguration" |
|
6172 nullDocType "DocumentType" |
|
6173 canSet "Boolean" |
|
6174 state "Boolean" |
|
6175 parameter "String" |
|
6176 | |
|
6177 nullDocType := nil. |
|
6178 parameter := 'nOrMalize-characters'. |
|
6179 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6180 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6181 domConfig := doc domConfig. |
|
6182 state := domConfig getParameter: parameter. |
|
6183 self deny: state. |
|
6184 canSet := domConfig canSetParameter: parameter value: false. |
|
6185 self assert: canSet. |
|
6186 canSet := domConfig canSetParameter: parameter value: true. |
|
6187 "if" |
|
6188 (canSet) ifTrue: [ |
|
6189 ]. |
|
6190 domConfig setParameter: parameter value: false. |
|
6191 |
|
6192 ! |
|
6193 |
|
6194 test_domconfigparameternames01 |
|
6195 "Checks getParameterNames and canSetParameter for Document.domConfig. |
|
6196 Creator: Curt Arnold |
|
6197 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-domConfig |
|
6198 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-parameterNames |
|
6199 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-canonical-form |
|
6200 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-cdata-sections |
|
6201 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-check-character-normalization |
|
6202 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-comments |
|
6203 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-datatype-normalization |
|
6204 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-entities |
|
6205 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-error-handler |
|
6206 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
6207 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespaces |
|
6208 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespace-declarations |
|
6209 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
6210 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections |
|
6211 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-validate |
|
6212 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-validate-if-schema |
|
6213 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-well-formed |
|
6214 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-element-content-whitespace |
|
6215 " |
|
6216 | |
|
6217 domImpl "DOMImplementation" |
|
6218 doc "Document" |
|
6219 config "DOMConfiguration" |
|
6220 state "Boolean" |
|
6221 parameterNames "DOMStringList" |
|
6222 parameterName "String" |
|
6223 matchCount "SmallInteger" |
|
6224 paramValue "DOMUserData" |
|
6225 canSet "Boolean" |
|
6226 | |
|
6227 matchCount := 0. |
|
6228 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
6229 config := doc domConfig. |
|
6230 self assert: config notNil. |
|
6231 parameterNames := config parameterNames. |
|
6232 self assert: parameterNames notNil. |
|
6233 parameterNames do: [parameterName| |
|
6234 paramValue := config getParameter: parameterName. |
|
6235 canSet := config canSetParameter: parameterName value: paramValue. |
|
6236 self assert: canSet. |
|
6237 config setParameter: parameterName value: paramValue. |
|
6238 "if" |
|
6239 ( parameterName asLowercase = 'canonical-form' asLowercase ) or: [( parameterName asLowercase = 'cdata-sections' asLowercase ) or: [( parameterName asLowercase = 'check-character-normalization' asLowercase ) or: [( parameterName asLowercase = 'comments' asLowercase ) or: [( parameterName asLowercase = 'datatype-normalization' asLowercase ) or: [( parameterName asLowercase = 'entities' asLowercase ) or: [( parameterName asLowercase = 'error-handler' asLowercase ) or: [( parameterName asLowercase = 'infoset' asLowercase ) or: [( parameterName asLowercase = 'namespaces' asLowercase ) or: [( parameterName asLowercase = 'namespace-declarations' asLowercase ) or: [( parameterName asLowercase = 'normalize-characters' asLowercase ) or: [( parameterName asLowercase = 'split-cdata-sections' asLowercase ) or: [( parameterName asLowercase = 'validate' asLowercase ) or: [( parameterName asLowercase = 'validate-if-schema' asLowercase ) or: [( parameterName asLowercase = 'well-formed' asLowercase ) or: [( parameterName asLowercase = 'element-content-whitespace' asLowercase )]]]]]]]]]]]]]]] ifTrue: [ |
|
6240 ]. |
|
6241 ]. |
|
6242 self assert: ( matchCount = 16 ). |
|
6243 |
|
6244 ! |
|
6245 |
|
6246 test_domconfigschemalocation1 |
|
6247 "Checks behavior of schema-location configuration parameter. |
|
6248 Creator: Curt Arnold |
|
6249 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-schema-location |
|
6250 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6251 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6252 " |
|
6253 | |
|
6254 domImpl "DOMImplementation" |
|
6255 doc "Document" |
|
6256 domConfig "DOMConfiguration" |
|
6257 nullDocType "DocumentType" |
|
6258 canSet "Boolean" |
|
6259 state "String" |
|
6260 parameter "String" |
|
6261 nullSchemaLocation "String" |
|
6262 sampleSchemaLocation "String" |
|
6263 | |
|
6264 nullDocType := nil. |
|
6265 parameter := 'sChEma-location'. |
|
6266 nullSchemaLocation := nil. |
|
6267 sampleSchemaLocation := 'http://www.example.com/schemas/sampleschema.xsd'. |
|
6268 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6269 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6270 domConfig := doc domConfig. |
|
6271 canSet := domConfig canSetParameter: parameter value: true. |
|
6272 self deny: canSet. |
|
6273 "try" |
|
6274 [ |
|
6275 state := domConfig getParameter: parameter. |
|
6276 self assert: state isNil. |
|
6277 ] on: DOMException do: [:ex| ]. |
|
6278 "end of try" |
|
6279 canSet := domConfig canSetParameter: parameter value: sampleSchemaLocation. |
|
6280 self assert: canSet. |
|
6281 canSet := domConfig canSetParameter: parameter value: nullSchemaLocation. |
|
6282 self assert: canSet. |
|
6283 domConfig setParameter: parameter value: sampleSchemaLocation. |
|
6284 state := domConfig getParameter: parameter. |
|
6285 self assert: ( state = sampleSchemaLocation ). |
|
6286 domConfig setParameter: parameter value: nullSchemaLocation. |
|
6287 state := domConfig getParameter: parameter. |
|
6288 self assert: state isNil. |
|
6289 |
|
6290 ! |
|
6291 |
|
6292 test_domconfigschematype1 |
|
6293 "Checks behavior of schema-type configuration parameter. |
|
6294 Creator: Curt Arnold |
|
6295 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-schema-type |
|
6296 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6297 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6298 " |
|
6299 | |
|
6300 domImpl "DOMImplementation" |
|
6301 doc "Document" |
|
6302 domConfig "DOMConfiguration" |
|
6303 nullDocType "DocumentType" |
|
6304 canSet "Boolean" |
|
6305 state "String" |
|
6306 parameter "String" |
|
6307 xmlSchemaType "String" |
|
6308 dtdType "String" |
|
6309 | |
|
6310 nullDocType := nil. |
|
6311 parameter := 'sChEma-type'. |
|
6312 xmlSchemaType := 'http://www.w3.org/2001/XMLSchema'. |
|
6313 dtdType := 'http://www.w3.org/TR/REC-xml'. |
|
6314 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6315 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6316 domConfig := doc domConfig. |
|
6317 canSet := domConfig canSetParameter: parameter value: true. |
|
6318 self deny: canSet. |
|
6319 "try" |
|
6320 [ |
|
6321 state := domConfig getParameter: parameter. |
|
6322 ] on: DOMException do: [:ex| ]. |
|
6323 "end of try" |
|
6324 canSet := domConfig canSetParameter: parameter value: dtdType. |
|
6325 "if" |
|
6326 (canSet) ifTrue: [ |
|
6327 ]. |
|
6328 canSet := domConfig canSetParameter: parameter value: xmlSchemaType. |
|
6329 "if" |
|
6330 (canSet) ifTrue: [ |
|
6331 ]. |
|
6332 |
|
6333 ! |
|
6334 |
|
6335 test_domconfigsplitcdatasections1 |
|
6336 "Checks behavior of split-cdata-sections configuration parameter. |
|
6337 Creator: Curt Arnold |
|
6338 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections |
|
6339 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6340 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6341 " |
|
6342 | |
|
6343 domImpl "DOMImplementation" |
|
6344 doc "Document" |
|
6345 domConfig "DOMConfiguration" |
|
6346 nullDocType "DocumentType" |
|
6347 canSet "Boolean" |
|
6348 state "Boolean" |
|
6349 parameter "String" |
|
6350 | |
|
6351 nullDocType := nil. |
|
6352 parameter := 'sPlIt-cdata-sections'. |
|
6353 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6354 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6355 domConfig := doc domConfig. |
|
6356 state := domConfig getParameter: parameter. |
|
6357 self assert: state. |
|
6358 canSet := domConfig canSetParameter: parameter value: false. |
|
6359 self assert: canSet. |
|
6360 canSet := domConfig canSetParameter: parameter value: true. |
|
6361 self assert: canSet. |
|
6362 domConfig setParameter: parameter value: false. |
|
6363 state := domConfig getParameter: parameter. |
|
6364 self deny: state. |
|
6365 domConfig setParameter: parameter value: true. |
|
6366 state := domConfig getParameter: parameter. |
|
6367 self assert: state. |
|
6368 |
|
6369 ! |
|
6370 |
|
6371 test_domconfigurationcansetparameter01 |
|
6372 " |
|
6373 The parameter commments is turned on by default. Check to see if this feature can be set |
|
6374 to false by invoking canSetParameter method. Also check that this method does not change the |
|
6375 value of parameter. |
|
6376 |
|
6377 Creator: IBM |
|
6378 Autor Jenny Hsu |
|
6379 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-canSetParameter |
|
6380 " |
|
6381 | |
|
6382 doc "Document" |
|
6383 domConfig "DOMConfiguration" |
|
6384 canSet "Boolean" |
|
6385 newCommentNode "Comment" |
|
6386 docElem "Element" |
|
6387 appendedChild "Node" |
|
6388 lastChild "Node" |
|
6389 commentValue "String" |
|
6390 | |
|
6391 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6392 newCommentNode := doc createComment:'This is a new Comment node'. |
|
6393 docElem := doc documentElement. |
|
6394 appendedChild := docElem appendChild:newCommentNode. |
|
6395 domConfig := doc domConfig. |
|
6396 canSet := domConfig canSetParameter: 'comments' value: false. |
|
6397 self assert: canSet. |
|
6398 doc normalizeDocument. |
|
6399 lastChild := docElem lastChild. |
|
6400 commentValue := lastChild nodeValue. |
|
6401 self assert: ( commentValue = 'This is a new Comment node' ). |
|
6402 |
|
6403 ! |
|
6404 |
|
6405 test_domconfigurationcansetparameter02 |
|
6406 " |
|
6407 Check that canSetParameter('cdata-sections') returns true for both true and false |
|
6408 and that calls to the method do not actually change the parameter value. |
|
6409 |
|
6410 Creator: IBM |
|
6411 Autor Jenny Hsu |
|
6412 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-canSetParameter |
|
6413 " |
|
6414 | |
|
6415 doc "Document" |
|
6416 domConfig "DOMConfiguration" |
|
6417 canSet "Boolean" |
|
6418 paramVal "Boolean" |
|
6419 | |
|
6420 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6421 domConfig := doc domConfig. |
|
6422 canSet := domConfig canSetParameter: 'cdata-sections' value: false. |
|
6423 self assert: canSet. |
|
6424 paramVal := domConfig getParameter: 'cdata-sections'. |
|
6425 self assert: paramVal. |
|
6426 canSet := domConfig canSetParameter: 'cdata-sections' value: true. |
|
6427 self assert: canSet. |
|
6428 domConfig setParameter: 'cdata-sections' value: false. |
|
6429 canSet := domConfig canSetParameter: 'cdata-sections' value: true. |
|
6430 self assert: canSet. |
|
6431 paramVal := domConfig getParameter: 'cdata-sections'. |
|
6432 self deny: paramVal. |
|
6433 canSet := domConfig canSetParameter: 'cdata-sections' value: false. |
|
6434 self assert: canSet. |
|
6435 |
|
6436 ! |
|
6437 |
|
6438 test_domconfigurationcansetparameter03 |
|
6439 " |
|
6440 The canSetParameter method checks if setting a parameter to a specific value is supported. |
|
6441 |
|
6442 The parameter entities is turned on by default. Check to see if this feature can be set |
|
6443 to false by invoking canSetParameter method. Also check that this method does not change the |
|
6444 value of parameter by checking if entities still exist in the document. |
|
6445 |
|
6446 Creator: IBM |
|
6447 Autor Jenny Hsu |
|
6448 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-canSetParameter |
|
6449 " |
|
6450 | |
|
6451 doc "Document" |
|
6452 domConfig "DOMConfiguration" |
|
6453 docType "DocumentType" |
|
6454 entitiesMap "NamedNodeMap" |
|
6455 nullNS "String" |
|
6456 entity "Entity" |
|
6457 entityName "String" |
|
6458 canSet "Boolean" |
|
6459 | |
|
6460 "implementationAttribute not supported: namespaceAware" |
|
6461 nullNS := nil. |
|
6462 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6463 domConfig := doc domConfig. |
|
6464 canSet := domConfig canSetParameter: 'entities' value: false. |
|
6465 self assert: canSet. |
|
6466 doc normalizeDocument. |
|
6467 docType := doc doctype. |
|
6468 entitiesMap := docType entities. |
|
6469 entity := entitiesMap getNamedItem:'epsilon'. |
|
6470 self assert: entity notNil. |
|
6471 entityName := entity nodeName. |
|
6472 self assert: ( entityName = 'epsilon' ). |
|
6473 |
|
6474 ! |
|
6475 |
|
6476 test_domconfigurationcansetparameter04 |
|
6477 " |
|
6478 The parameter entities is turned on by default. Check to see if this feature can be set |
|
6479 to false by invoking canSetParameter method. Also check that this method does not change the |
|
6480 value of parameter by checking if entity references still exist in the document. |
|
6481 |
|
6482 Creator: IBM |
|
6483 Autor Jenny Hsu |
|
6484 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-canSetParameter |
|
6485 " |
|
6486 | |
|
6487 doc "Document" |
|
6488 domConfig "DOMConfiguration" |
|
6489 acronymList "NodeList" |
|
6490 acronymElem "Node" |
|
6491 nodeType "SmallInteger" |
|
6492 first "Node" |
|
6493 canSet "Boolean" |
|
6494 paramVal "Boolean" |
|
6495 | |
|
6496 "implementationAttribute not supported: expandEntityReferences" |
|
6497 "implementationAttribute not supported: namespaceAware" |
|
6498 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6499 domConfig := doc domConfig. |
|
6500 canSet := domConfig canSetParameter: 'entities' value: false. |
|
6501 self assert: canSet. |
|
6502 paramVal := domConfig getParameter: 'entities'. |
|
6503 self assert: paramVal. |
|
6504 doc normalizeDocument. |
|
6505 acronymList := doc getElementsByTagName: 'acronym'. |
|
6506 acronymElem := acronymList item:1. |
|
6507 first := acronymElem firstChild. |
|
6508 nodeType := first nodeType. |
|
6509 self assert: ( nodeType = 5 ). |
|
6510 |
|
6511 ! |
|
6512 |
|
6513 test_domconfigurationcansetparameter06 |
|
6514 " |
|
6515 Check that canSetParameter('element-content-whitespace', true) returns true |
|
6516 and that canSetParameter('element-content-whitespace) does not change value of |
|
6517 parameter. |
|
6518 |
|
6519 Creator: IBM |
|
6520 Autor Jenny Hsu |
|
6521 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-canSetParameter |
|
6522 " |
|
6523 | |
|
6524 doc "Document" |
|
6525 domConfig "DOMConfiguration" |
|
6526 itemList "NodeList" |
|
6527 elementBody "Element" |
|
6528 textNode "Text" |
|
6529 canSet "Boolean" |
|
6530 canSetFalse "Boolean" |
|
6531 paramVal "Boolean" |
|
6532 hasWhitespace "Boolean" |
|
6533 | |
|
6534 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
6535 domConfig := doc domConfig. |
|
6536 canSetFalse := domConfig canSetParameter: 'element-content-whitespace' value: false. |
|
6537 paramVal := domConfig getParameter: 'element-content-whitespace'. |
|
6538 self assert: paramVal. |
|
6539 "if" |
|
6540 (canSetFalse) ifTrue: [ |
|
6541 ]. |
|
6542 canSet := domConfig canSetParameter: 'element-content-whitespace' value: true. |
|
6543 self assert: canSet. |
|
6544 "if" |
|
6545 (canSetFalse) ifTrue: [ |
|
6546 ]. |
|
6547 |
|
6548 ! |
|
6549 |
|
6550 test_domconfigurationgetparameter01 |
|
6551 " |
|
6552 The method getParameter returns the value of a parameter if known. |
|
6553 |
|
6554 Get the DOMConfiguration object of a document and verify that the default required features are set |
|
6555 to true. |
|
6556 |
|
6557 Creator: IBM |
|
6558 Autor Jenny Hsu |
|
6559 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6560 " |
|
6561 | |
|
6562 doc "Document" |
|
6563 domConfig "DOMConfiguration" |
|
6564 param "DOMUserData" |
|
6565 | |
|
6566 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6567 domConfig := doc domConfig. |
|
6568 param := domConfig getParameter: 'comments'. |
|
6569 self assert: param. |
|
6570 param := domConfig getParameter: 'cdata-sections'. |
|
6571 self assert: param. |
|
6572 param := domConfig getParameter: 'entities'. |
|
6573 self assert: param. |
|
6574 param := domConfig getParameter: 'namespace-declarations'. |
|
6575 self assert: param. |
|
6576 param := domConfig getParameter: 'infoset'. |
|
6577 self deny: param. |
|
6578 |
|
6579 ! |
|
6580 |
|
6581 test_domconfigurationgetparameter02 |
|
6582 " |
|
6583 The method getParameter returns the value of a parameter if known. |
|
6584 |
|
6585 Get the DOMConfiguration object of a document and verify that a NOT_FOUND_ERR is thrown if the parameter |
|
6586 is not found. |
|
6587 |
|
6588 Creator: IBM |
|
6589 Autor Jenny Hsu |
|
6590 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6591 " |
|
6592 | |
|
6593 doc "Document" |
|
6594 domConfig "DOMConfiguration" |
|
6595 param "DOMUserData" |
|
6596 | |
|
6597 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6598 domConfig := doc domConfig. |
|
6599 "assertDOMException..." |
|
6600 self should:[ |
|
6601 param := domConfig getParameter: 'not-found-param'. |
|
6602 ] raise: DOMException. |
|
6603 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
6604 "end of assertDOMException..." |
|
6605 |
|
6606 ! |
|
6607 |
|
6608 test_domconfigvalidate1 |
|
6609 "Checks behavior of validate configuration parameter. |
|
6610 Creator: Curt Arnold |
|
6611 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-validate |
|
6612 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6613 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6614 " |
|
6615 | |
|
6616 domImpl "DOMImplementation" |
|
6617 doc "Document" |
|
6618 domConfig "DOMConfiguration" |
|
6619 nullDocType "DocumentType" |
|
6620 canSet "Boolean" |
|
6621 state "Boolean" |
|
6622 parameter "String" |
|
6623 | |
|
6624 nullDocType := nil. |
|
6625 parameter := 'vAlIdate'. |
|
6626 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6627 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6628 domConfig := doc domConfig. |
|
6629 state := domConfig getParameter: parameter. |
|
6630 self deny: state. |
|
6631 canSet := domConfig canSetParameter: parameter value: false. |
|
6632 self assert: canSet. |
|
6633 canSet := domConfig canSetParameter: parameter value: true. |
|
6634 "if" |
|
6635 (canSet) ifTrue: [ |
|
6636 ]. |
|
6637 domConfig setParameter: parameter value: false. |
|
6638 |
|
6639 ! |
|
6640 |
|
6641 test_domconfigvalidateifschema1 |
|
6642 "Checks behavior of validate-if-schema configuration parameter. |
|
6643 Creator: Curt Arnold |
|
6644 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-validate-if-schema |
|
6645 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6646 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6647 " |
|
6648 | |
|
6649 domImpl "DOMImplementation" |
|
6650 doc "Document" |
|
6651 domConfig "DOMConfiguration" |
|
6652 nullDocType "DocumentType" |
|
6653 canSet "Boolean" |
|
6654 state "Boolean" |
|
6655 parameter "String" |
|
6656 | |
|
6657 nullDocType := nil. |
|
6658 parameter := 'vAlIdate-if-schema'. |
|
6659 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6660 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6661 domConfig := doc domConfig. |
|
6662 state := domConfig getParameter: parameter. |
|
6663 self deny: state. |
|
6664 canSet := domConfig canSetParameter: parameter value: false. |
|
6665 self assert: canSet. |
|
6666 canSet := domConfig canSetParameter: parameter value: true. |
|
6667 "if" |
|
6668 (canSet) ifTrue: [ |
|
6669 ]. |
|
6670 domConfig setParameter: parameter value: false. |
|
6671 |
|
6672 ! |
|
6673 |
|
6674 test_domconfigwellformed1 |
|
6675 "Checks behavior of well-formed configuration parameter. |
|
6676 Creator: Curt Arnold |
|
6677 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-well-formed |
|
6678 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-getParameter |
|
6679 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-setParameter |
|
6680 " |
|
6681 | |
|
6682 domImpl "DOMImplementation" |
|
6683 doc "Document" |
|
6684 domConfig "DOMConfiguration" |
|
6685 nullDocType "DocumentType" |
|
6686 canSet "Boolean" |
|
6687 state "Boolean" |
|
6688 parameter "String" |
|
6689 | |
|
6690 nullDocType := nil. |
|
6691 parameter := 'wElL-formed'. |
|
6692 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6693 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
6694 domConfig := doc domConfig. |
|
6695 state := domConfig getParameter: parameter. |
|
6696 self assert: state. |
|
6697 canSet := domConfig canSetParameter: parameter value: true. |
|
6698 self assert: canSet. |
|
6699 canSet := domConfig canSetParameter: parameter value: false. |
|
6700 "if" |
|
6701 (canSet) ifTrue: [ |
|
6702 ]. |
|
6703 domConfig setParameter: parameter value: true. |
|
6704 |
|
6705 ! |
|
6706 |
|
6707 test_domimplementationgetfeature01 |
|
6708 " |
|
6709 Invoke getFeature method on this DOMImplementation with the value of the feature parameter |
|
6710 as Core and version as 2.0. This should return a DOMImplmentation object that's not null. |
|
6711 |
|
6712 Creator: IBM |
|
6713 Autor Neil Delima |
|
6714 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMImplementation3-getFeature |
|
6715 " |
|
6716 | |
|
6717 doc "Document" |
|
6718 domImpl "DOMImplementation" |
|
6719 domImplReturned "DOMImplementation" |
|
6720 | |
|
6721 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6722 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6723 domImplReturned := domImpl getFeature:'Core' version:'2.0'. |
|
6724 self assert: domImplReturned notNil. |
|
6725 |
|
6726 ! |
|
6727 |
|
6728 test_domimplementationgetfeature02 |
|
6729 " |
|
6730 Invoke getFeature method on this DOMImplementation with the value of the feature parameter |
|
6731 as Core and version as . This should return a DOMImplementation object that's not null. |
|
6732 |
|
6733 |
|
6734 Creator: IBM |
|
6735 Autor Neil Delima |
|
6736 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMImplementation3-getFeature |
|
6737 " |
|
6738 | |
|
6739 doc "Document" |
|
6740 domImpl "DOMImplementation" |
|
6741 domImplReturned "DOMImplementation" |
|
6742 | |
|
6743 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6744 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6745 domImplReturned := domImpl getFeature:'Core' version:''. |
|
6746 self assert: domImplReturned notNil. |
|
6747 |
|
6748 ! |
|
6749 |
|
6750 test_domimplementationgetfeature03 |
|
6751 " |
|
6752 Invoke getFeature method on this DOMImplementation with the value of the feature parameter |
|
6753 as Core and version as null. This should return a DOMImplementation object that's not null. |
|
6754 |
|
6755 Creator: IBM |
|
6756 Autor Neil Delima |
|
6757 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMImplementation3-getFeature |
|
6758 " |
|
6759 | |
|
6760 doc "Document" |
|
6761 domImpl "DOMImplementation" |
|
6762 domImplReturned "DOMImplementation" |
|
6763 nodeName "String" |
|
6764 nullVersion "String" |
|
6765 | |
|
6766 nullVersion := nil. |
|
6767 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6768 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6769 domImplReturned := domImpl getFeature:'Core' version:nullVersion. |
|
6770 self assert: domImplReturned notNil. |
|
6771 |
|
6772 ! |
|
6773 |
|
6774 test_domimplementationgetfeature05 |
|
6775 " |
|
6776 Invoke getFeature method on this DOMImplementation with the value of the feature parameter |
|
6777 as and version equal to null. This should return a null DOMObject. |
|
6778 |
|
6779 Creator: IBM |
|
6780 Autor Neil Delima |
|
6781 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMImplementation3-getFeature |
|
6782 " |
|
6783 | |
|
6784 doc "Document" |
|
6785 domImpl "DOMImplementation" |
|
6786 domImplReturned "DOMImplementation" |
|
6787 nullVersion "String" |
|
6788 | |
|
6789 nullVersion := nil. |
|
6790 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6791 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6792 domImplReturned := domImpl getFeature:'' version:nullVersion. |
|
6793 self assert: domImplReturned isNil. |
|
6794 |
|
6795 ! |
|
6796 |
|
6797 test_domimplementationgetfeature06 |
|
6798 " |
|
6799 Invoke getFeature method on this DOMImplementation with the value of the feature parameter |
|
6800 as 1-1 (some junk) and version equal to * . This should return a null DOMObject. |
|
6801 |
|
6802 Creator: IBM |
|
6803 Autor Neil Delima |
|
6804 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMImplementation3-getFeature |
|
6805 " |
|
6806 | |
|
6807 doc "Document" |
|
6808 domImpl "DOMImplementation" |
|
6809 domImplReturned "DOMImplementation" |
|
6810 | |
|
6811 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
6812 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
6813 domImplReturned := domImpl getFeature:'1-1' version:'*'. |
|
6814 self assert: domImplReturned isNil. |
|
6815 |
|
6816 ! |
|
6817 |
|
6818 test_domimplementationregistry01 |
|
6819 " |
|
6820 DOMImplementationRegistry.newInstance() (Java) or DOMImplementationRegistry global variable |
|
6821 (ECMAScript) should not be null. |
|
6822 |
|
6823 Creator: Curt Arnold |
|
6824 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6825 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6826 " |
|
6827 | |
|
6828 domImplRegistry "DOMImplementationRegistry" |
|
6829 | |
|
6830 domImplRegistry := DOMImplementationRegistry. |
|
6831 self assert: domImplRegistry notNil. |
|
6832 |
|
6833 ! |
|
6834 |
|
6835 test_domimplementationregistry02 |
|
6836 " |
|
6837 DOMImplementationRegistry.getDOMImplementation( cOrE ) should return a DOMImplementation |
|
6838 where hasFeature( Core , null) returns true. |
|
6839 |
|
6840 Creator: Curt Arnold |
|
6841 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6842 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6843 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
6844 " |
|
6845 | |
|
6846 domImplRegistry "DOMImplementationRegistry" |
|
6847 domImpl "DOMImplementation" |
|
6848 hasFeature "Boolean" |
|
6849 nullVersion "String" |
|
6850 | |
|
6851 nullVersion := nil. |
|
6852 domImplRegistry := DOMImplementationRegistry. |
|
6853 self assert: domImplRegistry notNil. |
|
6854 domImpl := domImplRegistry getDOMImplementation:'cOrE'. |
|
6855 self assert: domImpl notNil. |
|
6856 hasFeature := domImpl hasFeature:'Core' version:nullVersion. |
|
6857 self assert: hasFeature. |
|
6858 |
|
6859 ! |
|
6860 |
|
6861 test_domimplementationregistry03 |
|
6862 " |
|
6863 DOMImplementationRegistry.getDOMImplementation( cOrE 3.0 ) should return a DOMImplementation |
|
6864 where hasFeature( Core , 3.0 ) returns true. |
|
6865 |
|
6866 Creator: Curt Arnold |
|
6867 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6868 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6869 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
6870 " |
|
6871 | |
|
6872 domImplRegistry "DOMImplementationRegistry" |
|
6873 domImpl "DOMImplementation" |
|
6874 hasFeature "Boolean" |
|
6875 | |
|
6876 domImplRegistry := DOMImplementationRegistry. |
|
6877 self assert: domImplRegistry notNil. |
|
6878 domImpl := domImplRegistry getDOMImplementation:'cOrE 3.0'. |
|
6879 self assert: domImpl notNil. |
|
6880 hasFeature := domImpl hasFeature:'Core' version:'3.0'. |
|
6881 self assert: hasFeature. |
|
6882 |
|
6883 ! |
|
6884 |
|
6885 test_domimplementationregistry04 |
|
6886 " |
|
6887 DOMImplementationRegistry.getDOMImplementation( +cOrE ) should return a DOMImplementation |
|
6888 where hasFeature( +Core , null) returns true. |
|
6889 |
|
6890 Creator: Curt Arnold |
|
6891 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6892 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6893 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
6894 " |
|
6895 | |
|
6896 domImplRegistry "DOMImplementationRegistry" |
|
6897 domImpl "DOMImplementation" |
|
6898 hasFeature "Boolean" |
|
6899 nullVersion "String" |
|
6900 | |
|
6901 nullVersion := nil. |
|
6902 domImplRegistry := DOMImplementationRegistry. |
|
6903 self assert: domImplRegistry notNil. |
|
6904 domImpl := domImplRegistry getDOMImplementation:'+cOrE'. |
|
6905 self assert: domImpl notNil. |
|
6906 hasFeature := domImpl hasFeature:'+Core' version:nullVersion. |
|
6907 self assert: hasFeature. |
|
6908 |
|
6909 ! |
|
6910 |
|
6911 test_domimplementationregistry05 |
|
6912 " |
|
6913 DOMImplementationRegistry.getDOMImplementation( +cOrE 3.0 ) should return a DOMImplementation |
|
6914 where hasFeature( +Core , 3.0 ) returns true. |
|
6915 |
|
6916 Creator: Curt Arnold |
|
6917 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6918 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6919 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
6920 " |
|
6921 | |
|
6922 domImplRegistry "DOMImplementationRegistry" |
|
6923 domImpl "DOMImplementation" |
|
6924 hasFeature "Boolean" |
|
6925 | |
|
6926 domImplRegistry := DOMImplementationRegistry. |
|
6927 self assert: domImplRegistry notNil. |
|
6928 domImpl := domImplRegistry getDOMImplementation:'+cOrE 3.0'. |
|
6929 self assert: domImpl notNil. |
|
6930 hasFeature := domImpl hasFeature:'+Core' version:'3.0'. |
|
6931 self assert: hasFeature. |
|
6932 |
|
6933 ! |
|
6934 |
|
6935 test_domimplementationregistry06 |
|
6936 " |
|
6937 If the implementation supports XML , DOMImplementationRegistry.getDOMImplementation( xMl 3.0 cOrE ) should |
|
6938 return a DOMImplementation where hasFeature( XML , 3.0 ), and hasFeature( Core , null) returns true. |
|
6939 |
|
6940 Creator: Curt Arnold |
|
6941 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6942 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6943 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
6944 " |
|
6945 | |
|
6946 domImplRegistry "DOMImplementationRegistry" |
|
6947 domImpl "DOMImplementation" |
|
6948 hasFeature "Boolean" |
|
6949 nullVersion "String" |
|
6950 | |
|
6951 nullVersion := nil. |
|
6952 domImplRegistry := DOMImplementationRegistry. |
|
6953 self assert: domImplRegistry notNil. |
|
6954 domImpl := domImplRegistry getDOMImplementation:'xMl 3.0 cOrE'. |
|
6955 self assert: domImpl notNil. |
|
6956 hasFeature := domImpl hasFeature:'XML' version:'3.0'. |
|
6957 self assert: hasFeature. |
|
6958 hasFeature := domImpl hasFeature:'Core' version:nullVersion. |
|
6959 self assert: hasFeature. |
|
6960 |
|
6961 ! |
|
6962 |
|
6963 test_domimplementationregistry07 |
|
6964 " |
|
6965 DOMImplementationRegistry.getDOMImplementation( http://www.example.com/bogus-feature 99.0 ) should return |
|
6966 null. |
|
6967 |
|
6968 Creator: Curt Arnold |
|
6969 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6970 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6971 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
6972 " |
|
6973 | |
|
6974 domImplRegistry "DOMImplementationRegistry" |
|
6975 domImpl "DOMImplementation" |
|
6976 hasFeature "Boolean" |
|
6977 nullVersion "String" |
|
6978 | |
|
6979 nullVersion := nil. |
|
6980 domImplRegistry := DOMImplementationRegistry. |
|
6981 self assert: domImplRegistry notNil. |
|
6982 domImpl := domImplRegistry getDOMImplementation:'http://www.example.com/bogus-feature 99.0'. |
|
6983 self assert: domImpl isNil. |
|
6984 |
|
6985 ! |
|
6986 |
|
6987 test_domimplementationregistry08 |
|
6988 " |
|
6989 DOMImplementationRegistry.getDOMImplementation( SVG ) should return null or a DOMImplementation |
|
6990 where hasFeature( SVG , null) returns true. |
|
6991 |
|
6992 Creator: Curt Arnold |
|
6993 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
6994 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
6995 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
6996 " |
|
6997 | |
|
6998 domImplRegistry "DOMImplementationRegistry" |
|
6999 domImpl "DOMImplementation" |
|
7000 baseImpl "DOMImplementation" |
|
7001 hasFeature "Boolean" |
|
7002 nullVersion "String" |
|
7003 | |
|
7004 nullVersion := nil. |
|
7005 domImplRegistry := DOMImplementationRegistry. |
|
7006 self assert: domImplRegistry notNil. |
|
7007 domImpl := domImplRegistry getDOMImplementation:'SVG'. |
|
7008 "if" |
|
7009 ( domImpl isNil ) ifTrue: [ |
|
7010 ]. |
|
7011 |
|
7012 ! |
|
7013 |
|
7014 test_domimplementationregistry09 |
|
7015 " |
|
7016 DOMImplementationRegistry.getDOMImplementation( HTML ) should return null or a DOMImplementation |
|
7017 where hasFeature( HTML , null) returns true. |
|
7018 |
|
7019 Creator: Curt Arnold |
|
7020 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7021 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7022 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
7023 " |
|
7024 | |
|
7025 domImplRegistry "DOMImplementationRegistry" |
|
7026 domImpl "DOMImplementation" |
|
7027 hasFeature "Boolean" |
|
7028 baseImpl "DOMImplementation" |
|
7029 nullVersion "String" |
|
7030 | |
|
7031 nullVersion := nil. |
|
7032 domImplRegistry := DOMImplementationRegistry. |
|
7033 self assert: domImplRegistry notNil. |
|
7034 domImpl := domImplRegistry getDOMImplementation:'HTML'. |
|
7035 "if" |
|
7036 ( domImpl isNil ) ifTrue: [ |
|
7037 ]. |
|
7038 |
|
7039 ! |
|
7040 |
|
7041 test_domimplementationregistry10 |
|
7042 " |
|
7043 DOMImplementationRegistry.getDOMImplementation( LS ) should return null or a DOMImplementation |
|
7044 where hasFeature( LS , null) returns true. |
|
7045 |
|
7046 Creator: Curt Arnold |
|
7047 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7048 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7049 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
7050 " |
|
7051 | |
|
7052 domImplRegistry "DOMImplementationRegistry" |
|
7053 domImpl "DOMImplementation" |
|
7054 hasFeature "Boolean" |
|
7055 baseImpl "DOMImplementation" |
|
7056 nullVersion "String" |
|
7057 | |
|
7058 nullVersion := nil. |
|
7059 domImplRegistry := DOMImplementationRegistry. |
|
7060 self assert: domImplRegistry notNil. |
|
7061 domImpl := domImplRegistry getDOMImplementation:'LS'. |
|
7062 "if" |
|
7063 ( domImpl isNil ) ifTrue: [ |
|
7064 ]. |
|
7065 |
|
7066 ! |
|
7067 |
|
7068 test_domimplementationregistry11 |
|
7069 " |
|
7070 DOMImplementationRegistry.getDOMImplementation( XPath ) should return null or a DOMImplementation |
|
7071 where hasFeature( XPath , null) returns true. |
|
7072 |
|
7073 Creator: Curt Arnold |
|
7074 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7075 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7076 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
7077 " |
|
7078 | |
|
7079 domImplRegistry "DOMImplementationRegistry" |
|
7080 domImpl "DOMImplementation" |
|
7081 hasFeature "Boolean" |
|
7082 baseImpl "DOMImplementation" |
|
7083 nullVersion "String" |
|
7084 | |
|
7085 nullVersion := nil. |
|
7086 domImplRegistry := DOMImplementationRegistry. |
|
7087 self assert: domImplRegistry notNil. |
|
7088 domImpl := domImplRegistry getDOMImplementation:'XPath'. |
|
7089 "if" |
|
7090 ( domImpl isNil ) ifTrue: [ |
|
7091 ]. |
|
7092 |
|
7093 ! |
|
7094 |
|
7095 test_domimplementationregistry12 |
|
7096 " |
|
7097 DOMImplementationRegistry.getDOMImplementation( cOrE 3.0 xMl 3.0 eVeNts 2.0 lS ) should return null |
|
7098 or a DOMImplementation that implements the specified features. |
|
7099 |
|
7100 Creator: Curt Arnold |
|
7101 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7102 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7103 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpl |
|
7104 " |
|
7105 | |
|
7106 domImplRegistry "DOMImplementationRegistry" |
|
7107 domImpl "DOMImplementation" |
|
7108 hasCore "Boolean" |
|
7109 hasXML "Boolean" |
|
7110 hasEvents "Boolean" |
|
7111 hasLS "Boolean" |
|
7112 baseImpl "DOMImplementation" |
|
7113 nullVersion "String" |
|
7114 | |
|
7115 nullVersion := nil. |
|
7116 domImplRegistry := DOMImplementationRegistry. |
|
7117 self assert: domImplRegistry notNil. |
|
7118 domImpl := domImplRegistry getDOMImplementation:'cOrE 3.0 xMl 3.0 eVeNts 2.0 lS'. |
|
7119 "if" |
|
7120 ( domImpl isNil ) ifTrue: [ |
|
7121 self assert:false description:'Method "and" is not supported yet'. |
|
7122 ]. |
|
7123 |
|
7124 ! |
|
7125 |
|
7126 test_domimplementationregistry13 |
|
7127 " |
|
7128 DOMImplementationRegistry.getDOMImplementationList( cOrE ) should return a |
|
7129 list of at least one DOMImplementation |
|
7130 where hasFeature( Core , null) returns true. |
|
7131 |
|
7132 Creator: Curt Arnold |
|
7133 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7134 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7135 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7136 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMImplementationList-item |
|
7137 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMImplementationList-length |
|
7138 " |
|
7139 | |
|
7140 domImplRegistry "DOMImplementationRegistry" |
|
7141 hasFeature "Boolean" |
|
7142 domImpl "DOMImplementation" |
|
7143 domImplList "DOMImplementationList" |
|
7144 length "SmallInteger" |
|
7145 nullVersion "String" |
|
7146 | |
|
7147 nullVersion := nil. |
|
7148 domImplRegistry := DOMImplementationRegistry. |
|
7149 self assert: domImplRegistry notNil. |
|
7150 domImplList := domImplRegistry getDOMImplementationList:'cOrE'. |
|
7151 length := domImplList length. |
|
7152 domImpl := domImplList item:length. |
|
7153 self assert: domImpl isNil. |
|
7154 self assert: ( length > 0 ). |
|
7155 domImplList do: [domImpl| |
|
7156 hasFeature := domImpl hasFeature:'Core' version:nullVersion. |
|
7157 self assert: hasFeature. |
|
7158 ]. |
|
7159 |
|
7160 ! |
|
7161 |
|
7162 test_domimplementationregistry14 |
|
7163 " |
|
7164 DOMImplementationRegistry.getDOMImplementationList( cOrE 3.0 ) should return |
|
7165 a list of DOMImplementation |
|
7166 where hasFeature( Core , 3.0 ) returns true. |
|
7167 |
|
7168 Creator: Curt Arnold |
|
7169 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7170 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7171 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7172 " |
|
7173 | |
|
7174 domImplRegistry "DOMImplementationRegistry" |
|
7175 domImpl "DOMImplementation" |
|
7176 hasFeature "Boolean" |
|
7177 domImplList "DOMImplementationList" |
|
7178 length "SmallInteger" |
|
7179 | |
|
7180 domImplRegistry := DOMImplementationRegistry. |
|
7181 self assert: domImplRegistry notNil. |
|
7182 domImplList := domImplRegistry getDOMImplementationList:'cOrE 3.0'. |
|
7183 length := domImplList length. |
|
7184 self assert: ( length > 0 ). |
|
7185 domImplList do: [domImpl| |
|
7186 hasFeature := domImpl hasFeature:'Core' version:'3.0'. |
|
7187 self assert: hasFeature. |
|
7188 ]. |
|
7189 |
|
7190 ! |
|
7191 |
|
7192 test_domimplementationregistry15 |
|
7193 " |
|
7194 DOMImplementationRegistry.getDOMImplementationList( +cOrE ) should return |
|
7195 list of DOMImplementation |
|
7196 where hasFeature( +Core , null) returns true. |
|
7197 |
|
7198 Creator: Curt Arnold |
|
7199 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7200 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7201 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7202 " |
|
7203 | |
|
7204 domImplRegistry "DOMImplementationRegistry" |
|
7205 domImpl "DOMImplementation" |
|
7206 hasFeature "Boolean" |
|
7207 nullVersion "String" |
|
7208 domImplList "DOMImplementationList" |
|
7209 length "SmallInteger" |
|
7210 | |
|
7211 nullVersion := nil. |
|
7212 domImplRegistry := DOMImplementationRegistry. |
|
7213 self assert: domImplRegistry notNil. |
|
7214 domImplList := domImplRegistry getDOMImplementationList:'+cOrE'. |
|
7215 length := domImplList length. |
|
7216 self assert: ( length > 0 ). |
|
7217 domImplList do: [domImpl| |
|
7218 hasFeature := domImpl hasFeature:'+Core' version:nullVersion. |
|
7219 self assert: hasFeature. |
|
7220 ]. |
|
7221 |
|
7222 ! |
|
7223 |
|
7224 test_domimplementationregistry16 |
|
7225 " |
|
7226 DOMImplementationRegistry.getDOMImplementationList( +cOrE 3.0 ) should return |
|
7227 a list of DOMImplementation |
|
7228 where hasFeature( +Core , 3.0 ) returns true. |
|
7229 |
|
7230 Creator: Curt Arnold |
|
7231 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7232 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7233 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7234 " |
|
7235 | |
|
7236 domImplRegistry "DOMImplementationRegistry" |
|
7237 domImpl "DOMImplementation" |
|
7238 hasFeature "Boolean" |
|
7239 domImplList "DOMImplementationList" |
|
7240 length "SmallInteger" |
|
7241 | |
|
7242 domImplRegistry := DOMImplementationRegistry. |
|
7243 self assert: domImplRegistry notNil. |
|
7244 domImplList := domImplRegistry getDOMImplementationList:'+cOrE 3.0'. |
|
7245 length := domImplList length. |
|
7246 self assert: ( length > 0 ). |
|
7247 domImplList do: [domImpl| |
|
7248 hasFeature := domImpl hasFeature:'+Core' version:'3.0'. |
|
7249 self assert: hasFeature. |
|
7250 ]. |
|
7251 |
|
7252 ! |
|
7253 |
|
7254 test_domimplementationregistry17 |
|
7255 " |
|
7256 If the implementation supports XML , DOMImplementationRegistry.getDOMImplementationList( xMl 3.0 cOrE ) should |
|
7257 return a list of DOMImplementation where hasFeature( XML , 3.0 ), and hasFeature( Core , null) returns true. |
|
7258 |
|
7259 Creator: Curt Arnold |
|
7260 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7261 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7262 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7263 " |
|
7264 | |
|
7265 domImplRegistry "DOMImplementationRegistry" |
|
7266 domImpl "DOMImplementation" |
|
7267 hasFeature "Boolean" |
|
7268 nullVersion "String" |
|
7269 domImplList "DOMImplementationList" |
|
7270 length "SmallInteger" |
|
7271 | |
|
7272 nullVersion := nil. |
|
7273 domImplRegistry := DOMImplementationRegistry. |
|
7274 self assert: domImplRegistry notNil. |
|
7275 domImplList := domImplRegistry getDOMImplementationList:'xMl 3.0 cOrE'. |
|
7276 length := domImplList length. |
|
7277 self assert: ( length > 0 ). |
|
7278 domImplList do: [domImpl| |
|
7279 hasFeature := domImpl hasFeature:'XML' version:'3.0'. |
|
7280 self assert: hasFeature. |
|
7281 hasFeature := domImpl hasFeature:'Core' version:nullVersion. |
|
7282 self assert: hasFeature. |
|
7283 ]. |
|
7284 |
|
7285 ! |
|
7286 |
|
7287 test_domimplementationregistry18 |
|
7288 " |
|
7289 DOMImplementationRegistry.getDOMImplementationList( http://www.example.com/bogus-feature 99.0 ) |
|
7290 should return a zero-length list. |
|
7291 |
|
7292 Creator: Curt Arnold |
|
7293 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7294 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7295 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7296 " |
|
7297 | |
|
7298 domImplRegistry "DOMImplementationRegistry" |
|
7299 domImpl "DOMImplementation" |
|
7300 domImplList "DOMImplementationList" |
|
7301 length "SmallInteger" |
|
7302 | |
|
7303 domImplRegistry := DOMImplementationRegistry. |
|
7304 self assert: domImplRegistry notNil. |
|
7305 domImplList := domImplRegistry getDOMImplementationList:'http://www.example.com/bogus-feature 99.0'. |
|
7306 length := domImplList length. |
|
7307 self assert: ( length = 0 ). |
|
7308 |
|
7309 ! |
|
7310 |
|
7311 test_domimplementationregistry19 |
|
7312 " |
|
7313 DOMImplementationRegistry.getDOMImplementationList( SVG ) should return |
|
7314 zero-length list or a list of DOMImplementation |
|
7315 where hasFeature( SVG , null) returns true. |
|
7316 |
|
7317 Creator: Curt Arnold |
|
7318 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7319 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7320 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7321 " |
|
7322 | |
|
7323 domImplRegistry "DOMImplementationRegistry" |
|
7324 domImpl "DOMImplementation" |
|
7325 baseImpl "DOMImplementation" |
|
7326 hasFeature "Boolean" |
|
7327 nullVersion "String" |
|
7328 domImplList "DOMImplementationList" |
|
7329 length "SmallInteger" |
|
7330 | |
|
7331 nullVersion := nil. |
|
7332 domImplRegistry := DOMImplementationRegistry. |
|
7333 self assert: domImplRegistry notNil. |
|
7334 domImplList := domImplRegistry getDOMImplementationList:'SVG'. |
|
7335 length := domImplList length. |
|
7336 "if" |
|
7337 ( length = 0 ) ifTrue: [ |
|
7338 ]. |
|
7339 |
|
7340 ! |
|
7341 |
|
7342 test_domimplementationregistry20 |
|
7343 " |
|
7344 DOMImplementationRegistry.getDOMImplementationList( HTML ) should return |
|
7345 an empty list or a list of DOMImplementation |
|
7346 where hasFeature( HTML , null) returns true. |
|
7347 |
|
7348 Creator: Curt Arnold |
|
7349 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7350 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7351 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7352 " |
|
7353 | |
|
7354 domImplRegistry "DOMImplementationRegistry" |
|
7355 domImpl "DOMImplementation" |
|
7356 hasFeature "Boolean" |
|
7357 baseImpl "DOMImplementation" |
|
7358 nullVersion "String" |
|
7359 domImplList "DOMImplementationList" |
|
7360 length "SmallInteger" |
|
7361 | |
|
7362 nullVersion := nil. |
|
7363 domImplRegistry := DOMImplementationRegistry. |
|
7364 self assert: domImplRegistry notNil. |
|
7365 domImplList := domImplRegistry getDOMImplementationList:'HTML'. |
|
7366 length := domImplList length. |
|
7367 "if" |
|
7368 ( length = 0 ) ifTrue: [ |
|
7369 ]. |
|
7370 |
|
7371 ! |
|
7372 |
|
7373 test_domimplementationregistry21 |
|
7374 " |
|
7375 DOMImplementationRegistry.getDOMImplementationList( LS ) should return |
|
7376 a empty list or a list of DOMImplementation |
|
7377 where hasFeature( LS , null) returns true. |
|
7378 |
|
7379 Creator: Curt Arnold |
|
7380 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7381 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7382 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7383 " |
|
7384 | |
|
7385 domImplRegistry "DOMImplementationRegistry" |
|
7386 domImpl "DOMImplementation" |
|
7387 hasFeature "Boolean" |
|
7388 baseImpl "DOMImplementation" |
|
7389 nullVersion "String" |
|
7390 domImplList "DOMImplementationList" |
|
7391 length "SmallInteger" |
|
7392 | |
|
7393 nullVersion := nil. |
|
7394 domImplRegistry := DOMImplementationRegistry. |
|
7395 self assert: domImplRegistry notNil. |
|
7396 domImplList := domImplRegistry getDOMImplementationList:'LS'. |
|
7397 length := domImplList length. |
|
7398 "if" |
|
7399 ( length = 0 ) ifTrue: [ |
|
7400 ]. |
|
7401 |
|
7402 ! |
|
7403 |
|
7404 test_domimplementationregistry22 |
|
7405 " |
|
7406 DOMImplementationRegistry.getDOMImplementationList( XPath ) should return |
|
7407 an empty list or a list of DOMImplementation |
|
7408 where hasFeature( XPath , null) returns true. |
|
7409 |
|
7410 Creator: Curt Arnold |
|
7411 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7412 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7413 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7414 " |
|
7415 | |
|
7416 domImplRegistry "DOMImplementationRegistry" |
|
7417 domImpl "DOMImplementation" |
|
7418 hasFeature "Boolean" |
|
7419 baseImpl "DOMImplementation" |
|
7420 nullVersion "String" |
|
7421 domImplList "DOMImplementationList" |
|
7422 length "SmallInteger" |
|
7423 | |
|
7424 nullVersion := nil. |
|
7425 domImplRegistry := DOMImplementationRegistry. |
|
7426 self assert: domImplRegistry notNil. |
|
7427 domImplList := domImplRegistry getDOMImplementationList:'XPath'. |
|
7428 length := domImplList length. |
|
7429 "if" |
|
7430 ( length = 0 ) ifTrue: [ |
|
7431 ]. |
|
7432 |
|
7433 ! |
|
7434 |
|
7435 test_domimplementationregistry23 |
|
7436 " |
|
7437 DOMImplementationRegistry.getDOMImplementationList( cOrE 3.0 xMl 3.0 eVeNts 2.0 lS ) |
|
7438 should return an empty list or a list of DOMImplementation that implements the specified features. |
|
7439 |
|
7440 Creator: Curt Arnold |
|
7441 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7442 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7443 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7444 " |
|
7445 | |
|
7446 domImplRegistry "DOMImplementationRegistry" |
|
7447 domImpl "DOMImplementation" |
|
7448 hasCore "Boolean" |
|
7449 hasXML "Boolean" |
|
7450 hasEvents "Boolean" |
|
7451 hasLS "Boolean" |
|
7452 baseImpl "DOMImplementation" |
|
7453 nullVersion "String" |
|
7454 domImplList "DOMImplementationList" |
|
7455 length "SmallInteger" |
|
7456 | |
|
7457 nullVersion := nil. |
|
7458 domImplRegistry := DOMImplementationRegistry. |
|
7459 self assert: domImplRegistry notNil. |
|
7460 domImplList := domImplRegistry getDOMImplementationList:'cOrE 3.0 xMl 3.0 eVeNts 2.0 lS'. |
|
7461 length := domImplList length. |
|
7462 "if" |
|
7463 ( length = 0 ) ifTrue: [ |
|
7464 self assert:false description:'Method "and" is not supported yet'. |
|
7465 ]. |
|
7466 |
|
7467 ! |
|
7468 |
|
7469 test_domimplementationregistry24 |
|
7470 " |
|
7471 DOMImplementationRegistry.getDOMImplementation( ) should return an implementation. |
|
7472 |
|
7473 Creator: Curt Arnold |
|
7474 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7475 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7476 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7477 Subject http://lists.w3.org/Archives/Public/www-dom/2004JanMar/0111.html |
|
7478 " |
|
7479 | |
|
7480 domImplRegistry "DOMImplementationRegistry" |
|
7481 domImpl "DOMImplementation" |
|
7482 | |
|
7483 domImplRegistry := DOMImplementationRegistry. |
|
7484 self assert: domImplRegistry notNil. |
|
7485 domImpl := domImplRegistry getDOMImplementation:''. |
|
7486 self assert: domImpl notNil. |
|
7487 |
|
7488 ! |
|
7489 |
|
7490 test_domimplementationregistry25 |
|
7491 " |
|
7492 DOMImplementationRegistry.getDOMImplementationList( cOrE 3.0 xMl 3.0 eVeNts 2.0 lS ) |
|
7493 should return an empty list or a list of DOMImplementation that implements the specified features. |
|
7494 |
|
7495 Creator: Curt Arnold |
|
7496 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding |
|
7497 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding |
|
7498 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-getDOMImpls |
|
7499 Subject http://lists.w3.org/Archives/Public/www-dom/2004JanMar/0111.html |
|
7500 " |
|
7501 | |
|
7502 domImplRegistry "DOMImplementationRegistry" |
|
7503 domImplList "DOMImplementationList" |
|
7504 length "SmallInteger" |
|
7505 | |
|
7506 domImplRegistry := DOMImplementationRegistry. |
|
7507 self assert: domImplRegistry notNil. |
|
7508 domImplList := domImplRegistry getDOMImplementationList:''. |
|
7509 length := domImplList length. |
|
7510 self assert: ( length > 0 ). |
|
7511 |
|
7512 ! |
|
7513 |
|
7514 test_domstringlistcontains01 |
|
7515 " |
|
7516 Check implementation of DOMStringList.contains by searching DOMConfig parameter |
|
7517 names for comments and . |
|
7518 |
|
7519 Creator: Curt Arnold |
|
7520 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMStringList-contains |
|
7521 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-parameterNames |
|
7522 " |
|
7523 | |
|
7524 doc "Document" |
|
7525 paramList "DOMStringList" |
|
7526 domConfig "DOMConfiguration" |
|
7527 contains "Boolean" |
|
7528 | |
|
7529 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7530 domConfig := doc domConfig. |
|
7531 paramList := domConfig parameterNames. |
|
7532 contains := paramList contains:'comments'. |
|
7533 self assert: contains. |
|
7534 contains := paramList contains:''. |
|
7535 self deny: contains. |
|
7536 |
|
7537 ! |
|
7538 |
|
7539 test_domstringlistcontains02 |
|
7540 " |
|
7541 The contains method of the DOMStringList tests if a string is part of this DOMStringList. |
|
7542 |
|
7543 Invoke the contains method on the list searching for several of the parameters recognized by the |
|
7544 DOMConfiguration object. |
|
7545 Verify that the list contains features that are required and supported by this DOMConfiguration object. |
|
7546 Verify that the contains method returns false for a string that is not contained in this DOMStringList. |
|
7547 |
|
7548 Creator: IBM |
|
7549 Autor Jenny Hsu |
|
7550 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMStringList-contains |
|
7551 " |
|
7552 | |
|
7553 doc "Document" |
|
7554 paramList "DOMStringList" |
|
7555 domConfig "DOMConfiguration" |
|
7556 contain "Boolean" |
|
7557 | |
|
7558 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7559 domConfig := doc domConfig. |
|
7560 paramList := domConfig parameterNames. |
|
7561 contain := paramList contains:'comments'. |
|
7562 self assert: contain. |
|
7563 contain := paramList contains:'cdata-sections'. |
|
7564 self assert: contain. |
|
7565 contain := paramList contains:'entities'. |
|
7566 self assert: contain. |
|
7567 contain := paramList contains:'error-handler'. |
|
7568 self assert: contain. |
|
7569 contain := paramList contains:'infoset'. |
|
7570 self assert: contain. |
|
7571 contain := paramList contains:'namespace-declarations'. |
|
7572 self assert: contain. |
|
7573 contain := paramList contains:'element-content-whitespace'. |
|
7574 self assert: contain. |
|
7575 contain := paramList contains:'test'. |
|
7576 self deny: contain. |
|
7577 |
|
7578 ! |
|
7579 |
|
7580 test_domstringlistgetlength01 |
|
7581 " |
|
7582 The length attribute of the DOMStringList returns the number of DOMStrings in the list. |
|
7583 The range of valid child node indices is 0 to length-1 inclusive. |
|
7584 |
|
7585 Invoke the length on the list of parameters returned by the DOMConfiguration object. |
|
7586 Verify that the list is not null and length is not 0. |
|
7587 |
|
7588 Creator: IBM |
|
7589 Autor Jenny Hsu |
|
7590 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMStringList-length |
|
7591 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-parameterNames |
|
7592 " |
|
7593 | |
|
7594 doc "Document" |
|
7595 paramList "DOMStringList" |
|
7596 domConfig "DOMConfiguration" |
|
7597 listSize "SmallInteger" |
|
7598 | |
|
7599 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7600 domConfig := doc domConfig. |
|
7601 paramList := domConfig parameterNames. |
|
7602 self assert: paramList notNil. |
|
7603 listSize := paramList length. |
|
7604 self assert: listSize = 0. |
|
7605 |
|
7606 ! |
|
7607 |
|
7608 test_domstringlistitem01 |
|
7609 " |
|
7610 Check implementation of DOMStringList.item by accessing items 0 and length-1 and expecting |
|
7611 a string and accessing items out of range and expecting null. |
|
7612 |
|
7613 Creator: Curt Arnold |
|
7614 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMStringList-item |
|
7615 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMConfiguration-parameterNames |
|
7616 " |
|
7617 | |
|
7618 doc "Document" |
|
7619 paramList "DOMStringList" |
|
7620 domConfig "DOMConfiguration" |
|
7621 contains "Boolean" |
|
7622 length "SmallInteger" |
|
7623 index "SmallInteger" |
|
7624 parameter "String" |
|
7625 | |
|
7626 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7627 domConfig := doc domConfig. |
|
7628 paramList := domConfig parameterNames. |
|
7629 length := paramList length. |
|
7630 parameter := paramList item:0. |
|
7631 self assert: parameter notNil. |
|
7632 parameter := paramList item:length. |
|
7633 self assert: parameter isNil. |
|
7634 length := length - 1. |
|
7635 parameter := paramList item:length. |
|
7636 self assert: parameter notNil. |
|
7637 |
|
7638 ! |
|
7639 |
|
7640 test_domstringlistitem02 |
|
7641 " |
|
7642 The item method of the DOMStringList Returns the indexth item in the collection. |
|
7643 If index is greater than or equal to the number of DOMStrings in the list, this returns null. |
|
7644 |
|
7645 Invoke the first item on the list of parameters returned by the DOMConfiguration object and |
|
7646 make sure it is not null. Then invoke the 100th item and verify that null is returned. |
|
7647 |
|
7648 Creator: IBM |
|
7649 Autor Jenny Hsu |
|
7650 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#DOMStringList-item |
|
7651 " |
|
7652 | |
|
7653 doc "Document" |
|
7654 paramList "DOMStringList" |
|
7655 domConfig "DOMConfiguration" |
|
7656 listSize "SmallInteger" |
|
7657 retStr "String" |
|
7658 | |
|
7659 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7660 domConfig := doc domConfig. |
|
7661 paramList := domConfig parameterNames. |
|
7662 retStr := paramList item:0. |
|
7663 self assert: retStr notNil. |
|
7664 retStr := paramList item:100. |
|
7665 self assert: retStr isNil. |
|
7666 |
|
7667 ! |
|
7668 |
|
7669 test_elementcontentwhitespace01 |
|
7670 " |
|
7671 Normalize document with element-content-whitespace set to true, check that |
|
7672 whitespace in element content is preserved. |
|
7673 |
|
7674 Creator: Curt Arnold |
|
7675 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
7676 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-element-content-whitespace |
|
7677 " |
|
7678 | |
|
7679 doc "Document" |
|
7680 domConfig "DOMConfiguration" |
|
7681 canSet "Boolean" |
|
7682 errorMonitor "DOMErrorMonitor" |
|
7683 bodyList "NodeList" |
|
7684 body "Node" |
|
7685 child "Node" |
|
7686 childName "String" |
|
7687 childType "SmallInteger" |
|
7688 text "Text" |
|
7689 | |
|
7690 "implementationAttribute not supported: namespaceAware" |
|
7691 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
7692 domConfig := doc domConfig. |
|
7693 domConfig setParameter: 'element-content-whitespace' value: true. |
|
7694 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
7695 bodyList := doc getElementsByTagName: 'body'. |
|
7696 body := bodyList item:0. |
|
7697 child := body firstChild. |
|
7698 childType := child nodeType. |
|
7699 "if" |
|
7700 ( childType = 1 ) ifTrue: [ |
|
7701 ]. |
|
7702 doc normalizeDocument. |
|
7703 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
7704 bodyList := doc getElementsByTagName: 'body'. |
|
7705 body := bodyList item:0. |
|
7706 child := body firstChild. |
|
7707 self assert: child notNil. |
|
7708 childName := child nodeName. |
|
7709 self assert: ( childName = '#text' ). |
|
7710 child := child nextSibling. |
|
7711 self assert: child notNil. |
|
7712 childName := child nodeName. |
|
7713 self assert: ( childName = 'p' ). |
|
7714 |
|
7715 ! |
|
7716 |
|
7717 test_elementcontentwhitespace02 |
|
7718 " |
|
7719 Normalize document with element-content-whitespace set to false and validation set to true, check that |
|
7720 whitespace in element content is eliminated. |
|
7721 |
|
7722 Creator: Curt Arnold |
|
7723 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
7724 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-element-content-whitespace |
|
7725 " |
|
7726 | |
|
7727 doc "Document" |
|
7728 bodyList "NodeList" |
|
7729 body "Element" |
|
7730 domConfig "DOMConfiguration" |
|
7731 canSet "Boolean" |
|
7732 canSetValidate "Boolean" |
|
7733 errorMonitor "DOMErrorMonitor" |
|
7734 child "Node" |
|
7735 childName "String" |
|
7736 | |
|
7737 "implementationAttribute not supported: namespaceAware" |
|
7738 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
7739 domConfig := doc domConfig. |
|
7740 canSet := domConfig canSetParameter: 'element-content-whitespace' value: false. |
|
7741 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
7742 "if" |
|
7743 (canSetValidate) and: [(canSet)] ifTrue: [ |
|
7744 ]. |
|
7745 |
|
7746 ! |
|
7747 |
|
7748 test_elementcontentwhitespace03 |
|
7749 " |
|
7750 Normalize document using Node.normalize with element-content-whitespace set to false and validation set to true, check that |
|
7751 whitespace in element content is preserved. |
|
7752 |
|
7753 Creator: Curt Arnold |
|
7754 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
7755 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-element-content-whitespace |
|
7756 " |
|
7757 | |
|
7758 doc "Document" |
|
7759 bodyList "NodeList" |
|
7760 body "Element" |
|
7761 domConfig "DOMConfiguration" |
|
7762 canSet "Boolean" |
|
7763 canSetValidate "Boolean" |
|
7764 errorMonitor "DOMErrorMonitor" |
|
7765 child "Node" |
|
7766 childName "String" |
|
7767 text "Text" |
|
7768 | |
|
7769 "implementationAttribute not supported: namespaceAware" |
|
7770 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
7771 domConfig := doc domConfig. |
|
7772 "if" |
|
7773 false "no template for element implementationAttribute" ifTrue: [ |
|
7774 ]. |
|
7775 canSet := domConfig canSetParameter: 'element-content-whitespace' value: false. |
|
7776 "if" |
|
7777 (canSet) ifTrue: [ |
|
7778 ]. |
|
7779 |
|
7780 ! |
|
7781 |
|
7782 test_elementgetschematypeinfo01 |
|
7783 " |
|
7784 Call getSchemaTypeInfo on title attribute for the first em element from DTD validated document. |
|
7785 |
|
7786 Creator: Curt Arnold |
|
7787 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Element-schemaTypeInfo |
|
7788 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
7789 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
7790 " |
|
7791 | |
|
7792 doc "Document" |
|
7793 elemList "NodeList" |
|
7794 elem "Element" |
|
7795 typeInfo "TypeInfo" |
|
7796 typeNS "String" |
|
7797 typeName "String" |
|
7798 | |
|
7799 ^self. "Validation not supported" |
|
7800 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7801 elemList := doc getElementsByTagName: 'em'. |
|
7802 elem := elemList item:0. |
|
7803 typeInfo := elem schemaTypeInfo. |
|
7804 self assert: typeInfo notNil. |
|
7805 typeName := typeInfo typeName. |
|
7806 self assert: typeName isNil. |
|
7807 typeNS := typeInfo typeNamespace. |
|
7808 self assert: typeNS isNil. |
|
7809 |
|
7810 ! |
|
7811 |
|
7812 test_elementgetschematypeinfo02 |
|
7813 " |
|
7814 Call getSchemaTypeInfo on title attribute for the first em element from schema-validated document. |
|
7815 |
|
7816 Creator: Curt Arnold |
|
7817 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Element-schemaTypeInfo |
|
7818 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
7819 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
7820 " |
|
7821 | |
|
7822 doc "Document" |
|
7823 elemList "NodeList" |
|
7824 elem "Element" |
|
7825 typeInfo "TypeInfo" |
|
7826 typeNS "String" |
|
7827 typeName "String" |
|
7828 | |
|
7829 ^self. "Schema validation not supported" |
|
7830 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7831 elemList := doc getElementsByTagName: 'em'. |
|
7832 elem := elemList item:0. |
|
7833 typeInfo := elem schemaTypeInfo. |
|
7834 self assert: typeInfo notNil. |
|
7835 typeName := typeInfo typeName. |
|
7836 self assert: ( typeName = 'emType' ). |
|
7837 typeNS := typeInfo typeNamespace. |
|
7838 self assert: ( typeNS = 'http://www.w3.org/1999/xhtml' ). |
|
7839 |
|
7840 ! |
|
7841 |
|
7842 test_elementgetschematypeinfo03 |
|
7843 " |
|
7844 Element.schemaTypeInfo should return null if not validating or schema validating. |
|
7845 |
|
7846 Creator: Curt Arnold |
|
7847 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Element-schemaTypeInfo |
|
7848 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
7849 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
7850 " |
|
7851 | |
|
7852 doc "Document" |
|
7853 elemList "NodeList" |
|
7854 elem "Element" |
|
7855 typeInfo "TypeInfo" |
|
7856 typeName "String" |
|
7857 typeNS "String" |
|
7858 | |
|
7859 "implementationAttribute not supported: validating" |
|
7860 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_nodtdstaff'). |
|
7861 elemList := doc getElementsByTagName: 'em'. |
|
7862 elem := elemList item:0. |
|
7863 typeInfo := elem schemaTypeInfo. |
|
7864 self assert: typeInfo notNil. |
|
7865 typeName := typeInfo typeName. |
|
7866 self assert: typeName isNil. |
|
7867 typeNS := typeInfo typeNamespace. |
|
7868 self assert: typeNS isNil. |
|
7869 |
|
7870 ! |
|
7871 |
|
7872 test_elementgetschematypeinfo04 |
|
7873 " |
|
7874 The getSchemaTypeInfo method retrieves the type information associated with this element. |
|
7875 |
|
7876 Load a valid document with an XML Schema. |
|
7877 Invoke getSchemaTypeInfo method on an element having [type definition] property. Expose {name} and {target namespace} |
|
7878 properties of the [type definition] property. Verity that the typeName and typeNamespace of the code element's |
|
7879 schemaTypeInfo are correct. |
|
7880 |
|
7881 Creator: IBM |
|
7882 Autor Jenny Hsu |
|
7883 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Element-schemaTypeInfo |
|
7884 " |
|
7885 | |
|
7886 doc "Document" |
|
7887 codeElem "Element" |
|
7888 elemTypeInfo "TypeInfo" |
|
7889 typeName "String" |
|
7890 typeNamespace "String" |
|
7891 elemList "NodeList" |
|
7892 docElemNodeName "String" |
|
7893 | |
|
7894 ^self. "Schema validation not supported" |
|
7895 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7896 elemList := doc getElementsByTagName: 'code'. |
|
7897 codeElem := elemList item:1. |
|
7898 elemTypeInfo := codeElem schemaTypeInfo. |
|
7899 typeName := elemTypeInfo typeName. |
|
7900 typeNamespace := elemTypeInfo typeNamespace. |
|
7901 self assert: ( typeName = 'code' ). |
|
7902 self assert: ( typeNamespace = 'http://www.w3.org/1999/xhtml' ). |
|
7903 |
|
7904 ! |
|
7905 |
|
7906 test_elementgetschematypeinfo05 |
|
7907 " |
|
7908 The getSchemaTypeInfo method retrieves the type information associated with this element. |
|
7909 |
|
7910 Load a valid document with an XML Schema. |
|
7911 Invoke getSchemaTypeInfo method on an element having [type definition] property. Expose {name} and {target namespace} |
|
7912 properties of the [type definition] property. Verity that the typeName and typeNamespace of the acronym element's |
|
7913 schemaTypeInfo are correct. |
|
7914 |
|
7915 Creator: IBM |
|
7916 Autor Jenny Hsu |
|
7917 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Element-schemaTypeInfo |
|
7918 " |
|
7919 | |
|
7920 doc "Document" |
|
7921 acElem "Element" |
|
7922 elemTypeInfo "TypeInfo" |
|
7923 typeName "String" |
|
7924 typeNamespace "String" |
|
7925 elemList "NodeList" |
|
7926 docElemNodeName "String" |
|
7927 | |
|
7928 ^self. "Schema validation not supported" |
|
7929 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7930 elemList := doc getElementsByTagName: 'span'. |
|
7931 acElem := elemList item:0. |
|
7932 elemTypeInfo := acElem schemaTypeInfo. |
|
7933 typeName := elemTypeInfo typeName. |
|
7934 typeNamespace := elemTypeInfo typeNamespace. |
|
7935 self assert: ( typeName = 'string' ). |
|
7936 self assert: ( typeNamespace = 'http://www.w3.org/2001/XMLSchema' ). |
|
7937 |
|
7938 ! |
|
7939 |
|
7940 test_elementgetschematypeinfo06 |
|
7941 " |
|
7942 The getSchemaTypeInfo method retrieves the type information associated with this element. |
|
7943 |
|
7944 Load a valid document with an XML Schema. |
|
7945 Invoke getSchemaTypeInfo method on an element having [type definition] property. Expose {name} and {target namespace} |
|
7946 properties of the [type definition] property. Verity that the typeName and typeNamespace of the strong element's |
|
7947 schemaTypeInfo are correct. |
|
7948 |
|
7949 Creator: IBM |
|
7950 Autor Jenny Hsu |
|
7951 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Element-schemaTypeInfo |
|
7952 " |
|
7953 | |
|
7954 doc "Document" |
|
7955 strongElem "Element" |
|
7956 elemTypeInfo "TypeInfo" |
|
7957 typeName "String" |
|
7958 typeNamespace "String" |
|
7959 elemList "NodeList" |
|
7960 docElemNodeName "String" |
|
7961 | |
|
7962 ^self. "Schema validation not supported" |
|
7963 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7964 elemList := doc getElementsByTagName: 'strong'. |
|
7965 strongElem := elemList item:1. |
|
7966 elemTypeInfo := strongElem schemaTypeInfo. |
|
7967 typeName := elemTypeInfo typeName. |
|
7968 typeNamespace := elemTypeInfo typeNamespace. |
|
7969 self assert: ( typeName = 'strongType' ). |
|
7970 self assert: ( typeNamespace = 'http://www.w3.org/1999/xhtml' ). |
|
7971 |
|
7972 ! |
|
7973 |
|
7974 test_elementgetschematypeinfo07 |
|
7975 " |
|
7976 The getSchemaTypeInfo method retrieves the type information associated with this element. |
|
7977 |
|
7978 Load a valid document with an XML Schema. |
|
7979 Invoke getSchemaTypeInfo method on an element having [type definition] property. Expose {name} and {target namespace} |
|
7980 properties of the [type definition] property. Verity that the typeName and typeNamespace of the name element's |
|
7981 schemaTypeInfo are correct. |
|
7982 |
|
7983 Creator: IBM |
|
7984 Autor Jenny Hsu |
|
7985 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Element-schemaTypeInfo |
|
7986 " |
|
7987 | |
|
7988 doc "Document" |
|
7989 supElem "Element" |
|
7990 elemTypeInfo "TypeInfo" |
|
7991 typeName "String" |
|
7992 typeNamespace "String" |
|
7993 docElemNodeName "String" |
|
7994 elemList "NodeList" |
|
7995 | |
|
7996 ^self. "Schema validation not supported" |
|
7997 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
7998 elemList := doc getElementsByTagName: 'sup'. |
|
7999 supElem := elemList item:0. |
|
8000 elemTypeInfo := supElem schemaTypeInfo. |
|
8001 typeName := elemTypeInfo typeName. |
|
8002 typeNamespace := elemTypeInfo typeNamespace. |
|
8003 self assert: ( typeName = 'sup' ). |
|
8004 self assert: ( typeNamespace = 'http://www.w3.org/1999/xhtml' ). |
|
8005 |
|
8006 ! |
|
8007 |
|
8008 test_elementsetidattribute01 |
|
8009 " |
|
8010 Invoke setIdAttribute on the third acronym element's class attribute. Verify by calling isID |
|
8011 on the class attribute and getElementById on document. Invoke setIdAttribute again to reset. |
|
8012 Calling isID should return false. |
|
8013 |
|
8014 Creator: IBM |
|
8015 Autor Jenny Hsu |
|
8016 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8017 " |
|
8018 | |
|
8019 doc "Document" |
|
8020 elemList "NodeList" |
|
8021 acronymElem "Element" |
|
8022 attributesMap "NamedNodeMap" |
|
8023 attr "Attr" |
|
8024 id "Boolean" |
|
8025 elem "Element" |
|
8026 elemName "String" |
|
8027 | |
|
8028 id := false. |
|
8029 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8030 elemList := doc getElementsByTagName: 'acronym'. |
|
8031 acronymElem := elemList item:2. |
|
8032 acronymElem setIdAttribute: 'class' isId:true. |
|
8033 attributesMap := acronymElem attributes. |
|
8034 attr := attributesMap getNamedItem:'class'. |
|
8035 id := attr isId. |
|
8036 self assert: id. |
|
8037 elem := doc getElementById:'No'. |
|
8038 elemName := elem tagName. |
|
8039 self assert: ( elemName = 'acronym' ). |
|
8040 acronymElem setIdAttribute: 'class' isId:false. |
|
8041 id := attr isId. |
|
8042 self deny: id. |
|
8043 |
|
8044 ! |
|
8045 |
|
8046 test_elementsetidattribute03 |
|
8047 " |
|
8048 First use setAttribute to change the class attribute of the third acronym element. Invoke setIdAttribute |
|
8049 on the newly set attribute. Verify by calling isID on the new attribute and getElementById on document. |
|
8050 Invoke setIdAttribute again to reset. Calling isID should return false. |
|
8051 |
|
8052 Creator: IBM |
|
8053 Autor Jenny Hsu |
|
8054 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8055 " |
|
8056 | |
|
8057 doc "Document" |
|
8058 elemList "NodeList" |
|
8059 acronymElem "Element" |
|
8060 attributesMap "NamedNodeMap" |
|
8061 attr "Attr" |
|
8062 id "Boolean" |
|
8063 elem "Element" |
|
8064 elemName "String" |
|
8065 | |
|
8066 id := false. |
|
8067 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8068 elemList := doc getElementsByTagName: 'acronym'. |
|
8069 acronymElem := elemList item:2. |
|
8070 acronymElem setAttribute:'class' value:'Maybe'. |
|
8071 acronymElem setIdAttribute: 'class' isId:true. |
|
8072 attributesMap := acronymElem attributes. |
|
8073 attr := attributesMap getNamedItem:'class'. |
|
8074 id := attr isId. |
|
8075 self assert: id. |
|
8076 elem := doc getElementById:'Maybe'. |
|
8077 elemName := elem tagName. |
|
8078 self assert: ( elemName = 'acronym' ). |
|
8079 acronymElem setIdAttribute: 'class' isId:false. |
|
8080 id := attr isId. |
|
8081 self deny: id. |
|
8082 |
|
8083 ! |
|
8084 |
|
8085 test_elementsetidattribute04 |
|
8086 " |
|
8087 First use setAttribute to create a new attribute on the third strong element. Invoke setIdAttribute |
|
8088 on the new attribute. Verify by calling isID on the new attribute and getElementById on document. |
|
8089 Invoke setIdAttribute again to reset. Calling isID should return false. |
|
8090 |
|
8091 Creator: IBM |
|
8092 Autor Jenny Hsu |
|
8093 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8094 " |
|
8095 | |
|
8096 doc "Document" |
|
8097 elemList "NodeList" |
|
8098 nameElem "Element" |
|
8099 attributesMap "NamedNodeMap" |
|
8100 attr "Attr" |
|
8101 id "Boolean" |
|
8102 elem "Element" |
|
8103 elemName "String" |
|
8104 | |
|
8105 id := false. |
|
8106 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8107 elemList := doc getElementsByTagName: 'strong'. |
|
8108 nameElem := elemList item:2. |
|
8109 nameElem setAttribute:'hasMiddleName' value:'Antoine'. |
|
8110 nameElem setIdAttribute: 'hasMiddleName' isId:true. |
|
8111 attributesMap := nameElem attributes. |
|
8112 attr := attributesMap getNamedItem:'hasMiddleName'. |
|
8113 id := attr isId. |
|
8114 self assert: id. |
|
8115 elem := doc getElementById:'Antoine'. |
|
8116 elemName := elem tagName. |
|
8117 self assert: ( elemName = 'strong' ). |
|
8118 nameElem setIdAttribute: 'hasMiddleName' isId:false. |
|
8119 id := attr isId. |
|
8120 self deny: id. |
|
8121 |
|
8122 ! |
|
8123 |
|
8124 test_elementsetidattribute05 |
|
8125 " |
|
8126 Invoke setIdAttribute on the third strong element with a non-existing attribute name. Verify that |
|
8127 NOT_FOUND_ERR is raised. |
|
8128 |
|
8129 Creator: IBM |
|
8130 Autor Jenny Hsu |
|
8131 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8132 " |
|
8133 | |
|
8134 doc "Document" |
|
8135 elemList "NodeList" |
|
8136 nameElem "Element" |
|
8137 | |
|
8138 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8139 elemList := doc getElementsByTagName: 'strong'. |
|
8140 nameElem := elemList item:2. |
|
8141 "assertDOMException..." |
|
8142 self should:[ |
|
8143 nameElem setIdAttribute: 'hasMiddleName' isId:true. |
|
8144 ] raise: DOMException. |
|
8145 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
8146 "end of assertDOMException..." |
|
8147 |
|
8148 ! |
|
8149 |
|
8150 test_elementsetidattribute06 |
|
8151 " |
|
8152 Invoke setIdAttribute on the third strong element with an attribute name of the acronym element. |
|
8153 Verify that NOT_FOUND_ERR is raised. |
|
8154 |
|
8155 Creator: IBM |
|
8156 Autor Jenny Hsu |
|
8157 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8158 " |
|
8159 | |
|
8160 doc "Document" |
|
8161 elemList "NodeList" |
|
8162 nameElem "Element" |
|
8163 | |
|
8164 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8165 elemList := doc getElementsByTagName: 'strong'. |
|
8166 nameElem := elemList item:2. |
|
8167 "assertDOMException..." |
|
8168 self should:[ |
|
8169 nameElem setIdAttribute: 'class' isId:true. |
|
8170 ] raise: DOMException. |
|
8171 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
8172 "end of assertDOMException..." |
|
8173 |
|
8174 ! |
|
8175 |
|
8176 test_elementsetidattribute07 |
|
8177 " |
|
8178 First use setAttribute to create two new attribute of the second and third strong element with different values. |
|
8179 Invoke setIdAttribute on the new attributes. Verify by calling isID on the new attributes and getElementById |
|
8180 with two different values on document. |
|
8181 |
|
8182 Creator: IBM |
|
8183 Autor Jenny Hsu |
|
8184 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8185 " |
|
8186 | |
|
8187 doc "Document" |
|
8188 elemList "NodeList" |
|
8189 nameElem1 "Element" |
|
8190 nameElem2 "Element" |
|
8191 attributesMap "NamedNodeMap" |
|
8192 attr "Attr" |
|
8193 id "Boolean" |
|
8194 elem "Element" |
|
8195 elemName "String" |
|
8196 | |
|
8197 id := false. |
|
8198 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8199 elemList := doc getElementsByTagName: 'strong'. |
|
8200 nameElem1 := elemList item:2. |
|
8201 nameElem2 := elemList item:3. |
|
8202 nameElem1 setAttribute:'hasMiddleName' value:'Antoine'. |
|
8203 nameElem1 setIdAttribute: 'hasMiddleName' isId:true. |
|
8204 nameElem2 setAttribute:'hasMiddleName' value:'Neeya'. |
|
8205 nameElem2 setIdAttribute: 'hasMiddleName' isId:true. |
|
8206 attributesMap := nameElem1 attributes. |
|
8207 attr := attributesMap getNamedItem:'hasMiddleName'. |
|
8208 id := attr isId. |
|
8209 self assert: id. |
|
8210 attributesMap := nameElem2 attributes. |
|
8211 attr := attributesMap getNamedItem:'hasMiddleName'. |
|
8212 id := attr isId. |
|
8213 self assert: id. |
|
8214 elem := doc getElementById:'Antoine'. |
|
8215 elemName := elem tagName. |
|
8216 self assert: ( elemName = 'strong' ). |
|
8217 elem := doc getElementById:'Neeya'. |
|
8218 elemName := elem tagName. |
|
8219 self assert: ( elemName = 'strong' ). |
|
8220 |
|
8221 ! |
|
8222 |
|
8223 test_elementsetidattribute08 |
|
8224 " |
|
8225 Invoke setIdAttribute class attribute on the second, third, and the fifth acronym element. |
|
8226 Verify by calling isID on the attributes and getElementById with the unique value No on document. |
|
8227 |
|
8228 Creator: IBM |
|
8229 Autor Jenny Hsu |
|
8230 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8231 " |
|
8232 | |
|
8233 doc "Document" |
|
8234 elemList "NodeList" |
|
8235 acronymElem1 "Element" |
|
8236 acronymElem2 "Element" |
|
8237 acronymElem3 "Element" |
|
8238 attributesMap "NamedNodeMap" |
|
8239 attr "Attr" |
|
8240 id "Boolean" |
|
8241 elem "Element" |
|
8242 elemName "String" |
|
8243 | |
|
8244 id := false. |
|
8245 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8246 elemList := doc getElementsByTagName: 'acronym'. |
|
8247 acronymElem1 := elemList item:1. |
|
8248 acronymElem2 := elemList item:2. |
|
8249 acronymElem3 := elemList item:4. |
|
8250 acronymElem1 setIdAttribute: 'class' isId:true. |
|
8251 acronymElem2 setIdAttribute: 'class' isId:true. |
|
8252 acronymElem3 setIdAttribute: 'class' isId:true. |
|
8253 attributesMap := acronymElem1 attributes. |
|
8254 attr := attributesMap getNamedItem:'class'. |
|
8255 id := attr isId. |
|
8256 self assert: id. |
|
8257 attributesMap := acronymElem2 attributes. |
|
8258 attr := attributesMap getNamedItem:'class'. |
|
8259 id := attr isId. |
|
8260 self assert: id. |
|
8261 attributesMap := acronymElem3 attributes. |
|
8262 attr := attributesMap getNamedItem:'class'. |
|
8263 id := attr isId. |
|
8264 self assert: id. |
|
8265 elem := doc getElementById:'No'. |
|
8266 elemName := elem tagName. |
|
8267 self assert: ( elemName = 'acronym' ). |
|
8268 |
|
8269 ! |
|
8270 |
|
8271 test_elementsetidattribute09 |
|
8272 " |
|
8273 First use setAttribute to create two new attributes on the second strong element and sup element. |
|
8274 Invoke setIdAttribute on the new attributes. Verify by calling isID on the new attributes and getElementById |
|
8275 with two different values on document. |
|
8276 |
|
8277 Creator: IBM |
|
8278 Autor Jenny Hsu |
|
8279 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8280 " |
|
8281 | |
|
8282 doc "Document" |
|
8283 elemList1 "NodeList" |
|
8284 elemList2 "NodeList" |
|
8285 nameElem "Element" |
|
8286 salaryElem "Element" |
|
8287 attributesMap "NamedNodeMap" |
|
8288 attr "Attr" |
|
8289 id "Boolean" |
|
8290 elem "Element" |
|
8291 elemName "String" |
|
8292 | |
|
8293 id := false. |
|
8294 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8295 elemList1 := doc getElementsByTagName: 'strong'. |
|
8296 elemList2 := doc getElementsByTagName: 'sup'. |
|
8297 nameElem := elemList1 item:2. |
|
8298 salaryElem := elemList2 item:2. |
|
8299 nameElem setAttribute:'hasMiddleName' value:'Antoine'. |
|
8300 salaryElem setAttribute:'annual' value:'2002'. |
|
8301 nameElem setIdAttribute: 'hasMiddleName' isId:true. |
|
8302 salaryElem setIdAttribute: 'annual' isId:true. |
|
8303 attributesMap := nameElem attributes. |
|
8304 attr := attributesMap getNamedItem:'hasMiddleName'. |
|
8305 id := attr isId. |
|
8306 self assert: id. |
|
8307 attributesMap := salaryElem attributes. |
|
8308 attr := attributesMap getNamedItem:'annual'. |
|
8309 id := attr isId. |
|
8310 self assert: id. |
|
8311 elem := doc getElementById:'Antoine'. |
|
8312 elemName := elem tagName. |
|
8313 self assert: ( elemName = 'strong' ). |
|
8314 elem := doc getElementById:'2002'. |
|
8315 elemName := elem tagName. |
|
8316 self assert: ( elemName = 'sup' ). |
|
8317 |
|
8318 ! |
|
8319 |
|
8320 test_elementsetidattribute10 |
|
8321 " |
|
8322 Invoke setIdAttribute on the third acronym element's class attribute consecutively with different |
|
8323 isId values. Verify by calling isId on the attribute. |
|
8324 |
|
8325 Creator: IBM |
|
8326 Autor Jenny Hsu |
|
8327 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8328 " |
|
8329 | |
|
8330 doc "Document" |
|
8331 elemList "NodeList" |
|
8332 acronymElem "Element" |
|
8333 attributesMap "NamedNodeMap" |
|
8334 attr "Attr" |
|
8335 id "Boolean" |
|
8336 elem "Element" |
|
8337 elemName "String" |
|
8338 | |
|
8339 id := false. |
|
8340 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8341 elemList := doc getElementsByTagName: 'acronym'. |
|
8342 acronymElem := elemList item:2. |
|
8343 acronymElem setIdAttribute: 'class' isId:true. |
|
8344 attributesMap := acronymElem attributes. |
|
8345 attr := attributesMap getNamedItem:'class'. |
|
8346 id := attr isId. |
|
8347 self assert: id. |
|
8348 acronymElem setIdAttribute: 'class' isId:true. |
|
8349 id := attr isId. |
|
8350 self assert: id. |
|
8351 acronymElem setIdAttribute: 'class' isId:false. |
|
8352 id := attr isId. |
|
8353 self deny: id. |
|
8354 elem := doc getElementById:'No'. |
|
8355 self assert: elem isNil. |
|
8356 |
|
8357 ! |
|
8358 |
|
8359 test_elementsetidattribute11 |
|
8360 " |
|
8361 Invoke setIdAttribute on the 4th acronym element's class attribute which contains |
|
8362 an entity reference. Verify by calling isID on the class attribute and getElementById |
|
8363 on document. Invoke setIdAttribute again to reset. Calling isID should return false. |
|
8364 |
|
8365 Creator: IBM |
|
8366 Autor Jenny Hsu |
|
8367 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttr |
|
8368 " |
|
8369 | |
|
8370 doc "Document" |
|
8371 elemList "NodeList" |
|
8372 acronymElem "Element" |
|
8373 attributesMap "NamedNodeMap" |
|
8374 attr "Attr" |
|
8375 id "Boolean" |
|
8376 elem "Element" |
|
8377 elemName "String" |
|
8378 | |
|
8379 id := false. |
|
8380 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8381 elemList := doc getElementsByTagName: 'acronym'. |
|
8382 acronymElem := elemList item:3. |
|
8383 acronymElem setIdAttribute: 'class' isId:true. |
|
8384 attributesMap := acronymElem attributes. |
|
8385 attr := attributesMap getNamedItem:'class'. |
|
8386 id := attr isId. |
|
8387 self assert: id. |
|
8388 elem := doc getElementById:'Yα'. |
|
8389 self assert: elem notNil. |
|
8390 elemName := elem tagName. |
|
8391 self assert: ( elemName = 'acronym' ). |
|
8392 acronymElem setIdAttribute: 'class' isId:false. |
|
8393 id := attr isId. |
|
8394 self deny: id. |
|
8395 |
|
8396 ! |
|
8397 |
|
8398 test_elementsetidattributenode01 |
|
8399 " |
|
8400 Invoke setIdAttributeNode on the 3rd p element using the title attribute as a parameter . Verify by calling |
|
8401 isID on the attribute node and getElementById on document node. Call setIdAttributeNode again with isId=false |
|
8402 to reset. Invoke isId on the attribute node should return false. |
|
8403 |
|
8404 Creator: IBM |
|
8405 Autor Jenny Hsu |
|
8406 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8407 " |
|
8408 | |
|
8409 doc "Document" |
|
8410 elemList "NodeList" |
|
8411 employeeElem "Element" |
|
8412 attributesMap "NamedNodeMap" |
|
8413 attr "Attr" |
|
8414 id "Boolean" |
|
8415 elem "Element" |
|
8416 elemName "String" |
|
8417 | |
|
8418 id := false. |
|
8419 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8420 elemList := doc getElementsByTagName: 'p'. |
|
8421 employeeElem := elemList item:2. |
|
8422 attributesMap := employeeElem attributes. |
|
8423 attr := attributesMap getNamedItem:'xmlns:dmstc'. |
|
8424 employeeElem setIdAttributeNode:attr isId:true. |
|
8425 id := attr isId. |
|
8426 self assert: id. |
|
8427 elem := doc getElementById:'http://www.netzero.com'. |
|
8428 elemName := elem tagName. |
|
8429 self assert: ( elemName = 'p' ). |
|
8430 elem setIdAttributeNode:attr isId:false. |
|
8431 id := attr isId. |
|
8432 self deny: id. |
|
8433 |
|
8434 ! |
|
8435 |
|
8436 test_elementsetidattributenode02 |
|
8437 " |
|
8438 Invoke setIdAttributeNode on the 3rd acronym element using the class attribute as a parameter . Verify by calling |
|
8439 isID on the attribute node and getElementById on document node. Call setIdAttributeNode again with isId=false |
|
8440 to reset. Invoke isId on the attribute node should return false. |
|
8441 |
|
8442 Creator: IBM |
|
8443 Autor Jenny Hsu |
|
8444 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8445 " |
|
8446 | |
|
8447 doc "Document" |
|
8448 elemList "NodeList" |
|
8449 acronymElem "Element" |
|
8450 attributesMap "NamedNodeMap" |
|
8451 attr "Attr" |
|
8452 id "Boolean" |
|
8453 elem "Element" |
|
8454 elemName "String" |
|
8455 | |
|
8456 id := false. |
|
8457 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8458 elemList := doc getElementsByTagName: 'acronym'. |
|
8459 acronymElem := elemList item:2. |
|
8460 attributesMap := acronymElem attributes. |
|
8461 attr := attributesMap getNamedItem:'class'. |
|
8462 acronymElem setIdAttributeNode:attr isId:true. |
|
8463 id := attr isId. |
|
8464 self assert: id. |
|
8465 elem := doc getElementById:'No'. |
|
8466 elemName := elem tagName. |
|
8467 self assert: ( elemName = 'acronym' ). |
|
8468 elem setIdAttributeNode:attr isId:false. |
|
8469 id := attr isId. |
|
8470 self deny: id. |
|
8471 |
|
8472 ! |
|
8473 |
|
8474 test_elementsetidattributenode03 |
|
8475 " |
|
8476 Create a new attribute node on the second strong element. Invoke setIdAttributeNode on a newly created |
|
8477 attribute node. Verify by calling isID on the attribute node and getElementById on document node. |
|
8478 Call setIdAttributeNode again with isId=false to reset. Invoke isId on the attribute node should return false. |
|
8479 |
|
8480 Creator: IBM |
|
8481 Autor Jenny Hsu |
|
8482 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8483 " |
|
8484 | |
|
8485 doc "Document" |
|
8486 elemList "NodeList" |
|
8487 nameElem "Element" |
|
8488 attributesMap "NamedNodeMap" |
|
8489 attr "Attr" |
|
8490 newAttr "Attr" |
|
8491 id "Boolean" |
|
8492 elem "Element" |
|
8493 elemName "String" |
|
8494 | |
|
8495 id := false. |
|
8496 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8497 elemList := doc getElementsByTagName: 'strong'. |
|
8498 nameElem := elemList item:1. |
|
8499 nameElem setAttribute:'title' value:'Karen'. |
|
8500 attributesMap := nameElem attributes. |
|
8501 attr := attributesMap getNamedItem:'title'. |
|
8502 nameElem setIdAttributeNode:attr isId:true. |
|
8503 id := attr isId. |
|
8504 self assert: id. |
|
8505 elem := doc getElementById:'Karen'. |
|
8506 elemName := elem tagName. |
|
8507 self assert: ( elemName = 'strong' ). |
|
8508 elem setIdAttributeNode:attr isId:false. |
|
8509 id := attr isId. |
|
8510 self deny: id. |
|
8511 |
|
8512 ! |
|
8513 |
|
8514 test_elementsetidattributenode04 |
|
8515 " |
|
8516 Create a new namespace attribute on the second strong element. Invoke setIdAttributeNode on a newly created |
|
8517 attribute node. Verify by calling isID on the attribute node and getElementById on document node. |
|
8518 Call setIdAttributeNode again with isId=false to reset. Invoke isId on the attribute node should return false. |
|
8519 |
|
8520 Creator: IBM |
|
8521 Autor Jenny Hsu |
|
8522 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8523 " |
|
8524 | |
|
8525 doc "Document" |
|
8526 elemList "NodeList" |
|
8527 nameElem "Element" |
|
8528 attributesMap "NamedNodeMap" |
|
8529 attr "Attr" |
|
8530 newAttr "Attr" |
|
8531 id "Boolean" |
|
8532 elem "Element" |
|
8533 elemName "String" |
|
8534 | |
|
8535 id := false. |
|
8536 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8537 elemList := doc getElementsByTagName: 'strong'. |
|
8538 nameElem := elemList item:1. |
|
8539 nameElem setAttribute: 'xmlns:middle' ns: 'http://www.w3.org/2000/xmlns/' value: 'http://www.example.com/middle'. |
|
8540 attributesMap := nameElem attributes. |
|
8541 attr := attributesMap getNamedItem:'xmlns:middle'. |
|
8542 nameElem setIdAttributeNode:attr isId:true. |
|
8543 id := attr isId. |
|
8544 self assert: id. |
|
8545 elem := doc getElementById:'http://www.example.com/middle'. |
|
8546 elemName := elem tagName. |
|
8547 self assert: ( elemName = 'strong' ). |
|
8548 elem setIdAttributeNode:attr isId:false. |
|
8549 id := attr isId. |
|
8550 self deny: id. |
|
8551 |
|
8552 ! |
|
8553 |
|
8554 test_elementsetidattributenode05 |
|
8555 " |
|
8556 Invoke setIdAttributeNode on the third strong element but with the class attribute of the acronym |
|
8557 element as a parameter. Verify that NOT_FOUND_ERR is raised. |
|
8558 |
|
8559 Creator: IBM |
|
8560 Autor Jenny Hsu |
|
8561 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8562 " |
|
8563 | |
|
8564 doc "Document" |
|
8565 elemList1 "NodeList" |
|
8566 elemList2 "NodeList" |
|
8567 nameElem "Element" |
|
8568 acronymElem "Element" |
|
8569 attributesMap "NamedNodeMap" |
|
8570 attr "Attr" |
|
8571 | |
|
8572 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8573 elemList1 := doc getElementsByTagName: 'strong'. |
|
8574 elemList2 := doc getElementsByTagName: 'acronym'. |
|
8575 nameElem := elemList1 item:1. |
|
8576 acronymElem := elemList2 item:1. |
|
8577 attributesMap := acronymElem attributes. |
|
8578 attr := attributesMap getNamedItem:'class'. |
|
8579 "assertDOMException..." |
|
8580 self should:[ |
|
8581 nameElem setIdAttributeNode:attr isId:true. |
|
8582 ] raise: DOMException. |
|
8583 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
8584 "end of assertDOMException..." |
|
8585 |
|
8586 ! |
|
8587 |
|
8588 test_elementsetidattributenode06 |
|
8589 " |
|
8590 Invoke setIdAttributeNode on the third strong element but with the title attribute of the acronym |
|
8591 element as a parameter. Verify that NOT_FOUND_ERR is raised. |
|
8592 |
|
8593 Creator: IBM |
|
8594 Autor Jenny Hsu |
|
8595 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8596 " |
|
8597 | |
|
8598 doc "Document" |
|
8599 elemList1 "NodeList" |
|
8600 elemList2 "NodeList" |
|
8601 nameElem "Element" |
|
8602 acronymElem "Element" |
|
8603 attributesMap "NamedNodeMap" |
|
8604 attr "Attr" |
|
8605 nameElement "Element" |
|
8606 | |
|
8607 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8608 elemList1 := doc getElementsByTagName: 'strong'. |
|
8609 elemList2 := doc getElementsByTagName: 'acronym'. |
|
8610 nameElem := elemList1 item:1. |
|
8611 acronymElem := elemList2 item:1. |
|
8612 attributesMap := acronymElem attributes. |
|
8613 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
8614 "assertDOMException..." |
|
8615 self should:[ |
|
8616 nameElem setIdAttributeNode:attr isId:true. |
|
8617 ] raise: DOMException. |
|
8618 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
8619 "end of assertDOMException..." |
|
8620 |
|
8621 ! |
|
8622 |
|
8623 test_elementsetidattributenode07 |
|
8624 " |
|
8625 Invoke setIdAttributeNode on the 2nd and 3rd acronym element using the class attribute as a parameter . Verify by calling |
|
8626 isID on the attribute node and getElementById on document node. |
|
8627 |
|
8628 Creator: IBM |
|
8629 Autor Jenny Hsu |
|
8630 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8631 " |
|
8632 | |
|
8633 doc "Document" |
|
8634 elemList1 "NodeList" |
|
8635 elemList2 "NodeList" |
|
8636 acronymElem1 "Element" |
|
8637 acronymElem2 "Element" |
|
8638 attributesMap "NamedNodeMap" |
|
8639 attr "Attr" |
|
8640 id "Boolean" |
|
8641 elem "Element" |
|
8642 elemName "String" |
|
8643 | |
|
8644 id := false. |
|
8645 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8646 elemList1 := doc getElementsByTagName: 'acronym'. |
|
8647 elemList2 := doc getElementsByTagName: 'acronym'. |
|
8648 acronymElem1 := elemList1 item:1. |
|
8649 acronymElem2 := elemList2 item:2. |
|
8650 attributesMap := acronymElem1 attributes. |
|
8651 attr := attributesMap getNamedItem:'class'. |
|
8652 acronymElem1 setIdAttributeNode:attr isId:true. |
|
8653 id := attr isId. |
|
8654 self assert: id. |
|
8655 attributesMap := acronymElem2 attributes. |
|
8656 attr := attributesMap getNamedItem:'class'. |
|
8657 acronymElem2 setIdAttributeNode:attr isId:true. |
|
8658 id := attr isId. |
|
8659 self assert: id. |
|
8660 elem := doc getElementById:'No'. |
|
8661 elemName := elem tagName. |
|
8662 self assert: ( elemName = 'acronym' ). |
|
8663 elem := doc getElementById:'Yes'. |
|
8664 elemName := elem tagName. |
|
8665 self assert: ( elemName = 'acronym' ). |
|
8666 |
|
8667 ! |
|
8668 |
|
8669 test_elementsetidattributenode08 |
|
8670 " |
|
8671 This method declares the attribute specified by node to be of type ID. If the value of the specified attribute |
|
8672 is unique then this element node can later be retrieved using getElementById on Document. Note, however, |
|
8673 that this simply affects this node and does not change any grammar that may be in use. |
|
8674 |
|
8675 Invoke setIdAttributeNode on the 2nd acronym element and 3rd p element using the title and xmlns:dmstc attributes respectively |
|
8676 as parameters . Verify by calling isID on the attribute node and getElementById on document node. |
|
8677 |
|
8678 Creator: IBM |
|
8679 Autor Jenny Hsu |
|
8680 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8681 " |
|
8682 | |
|
8683 doc "Document" |
|
8684 elemList1 "NodeList" |
|
8685 elemList2 "NodeList" |
|
8686 acronymElem "Element" |
|
8687 pElem "Element" |
|
8688 attributesMap "NamedNodeMap" |
|
8689 attr "Attr" |
|
8690 id "Boolean" |
|
8691 elem "Element" |
|
8692 elemName "String" |
|
8693 | |
|
8694 "implementationAttribute not supported: namespaceAware" |
|
8695 id := false. |
|
8696 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8697 elemList1 := doc getElementsByTagName: 'acronym' ns: '*'. |
|
8698 elemList2 := doc getElementsByTagName: 'p' ns: '*'. |
|
8699 acronymElem := elemList1 item:1. |
|
8700 pElem := elemList2 item:2. |
|
8701 attributesMap := acronymElem attributes. |
|
8702 attr := attributesMap getNamedItem:'title'. |
|
8703 acronymElem setIdAttributeNode:attr isId:true. |
|
8704 id := attr isId. |
|
8705 self assert: id. |
|
8706 attributesMap := pElem attributes. |
|
8707 attr := attributesMap getNamedItem:'xmlns:dmstc'. |
|
8708 pElem setIdAttributeNode:attr isId:true. |
|
8709 id := attr isId. |
|
8710 self assert: id. |
|
8711 elem := doc getElementById:'Yes'. |
|
8712 elemName := elem tagName. |
|
8713 self assert: ( elemName = 'acronym' ). |
|
8714 elem := doc getElementById:'http://www.netzero.com'. |
|
8715 elemName := elem tagName. |
|
8716 self assert: ( elemName = 'p' ). |
|
8717 |
|
8718 ! |
|
8719 |
|
8720 test_elementsetidattributenode09 |
|
8721 " |
|
8722 This method declares the attribute specified by node to be of type ID. If the value of the specified attribute |
|
8723 is unique then this element node can later be retrieved using getElementById on Document. Note, however, |
|
8724 that this simply affects this node and does not change any grammar that may be in use. |
|
8725 |
|
8726 Invoke setIdAttributeNode with the xmlns attribute of ent4. Verify that NO_MODIFICATION_ALLOWED_ERR is raised. |
|
8727 |
|
8728 Creator: IBM |
|
8729 Autor Jenny Hsu |
|
8730 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8731 " |
|
8732 | |
|
8733 doc "Document" |
|
8734 elemList "NodeList" |
|
8735 varElem "Element" |
|
8736 entRef "EntityReference" |
|
8737 entElement "Element" |
|
8738 attributesMap "NamedNodeMap" |
|
8739 attr "Attr" |
|
8740 domConfig "DOMConfiguration" |
|
8741 | |
|
8742 "implementationAttribute not supported: namespaceAware" |
|
8743 "implementationAttribute not supported: expandEntityReferences" |
|
8744 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8745 domConfig := doc domConfig. |
|
8746 domConfig setParameter: 'entities' value: true. |
|
8747 doc normalizeDocument. |
|
8748 elemList := doc getElementsByTagName: 'var' ns: '*'. |
|
8749 varElem := elemList item:2. |
|
8750 entRef := varElem firstChild. |
|
8751 entElement := entRef firstChild. |
|
8752 attributesMap := entElement attributes. |
|
8753 attr := attributesMap getNamedItem:'xmlns'. |
|
8754 "assertDOMException..." |
|
8755 self should:[ |
|
8756 entElement setIdAttributeNode:attr isId:true. |
|
8757 ] raise: DOMException. |
|
8758 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
8759 "end of assertDOMException..." |
|
8760 |
|
8761 ! |
|
8762 |
|
8763 test_elementsetidattributenode10 |
|
8764 " |
|
8765 This method declares the attribute specified by node to be of type ID. If the value of the specified attribute |
|
8766 is unique then this element node can later be retrieved using getElementById on Document. Note, however, |
|
8767 that this simply affects this node and does not change any grammar that may be in use. |
|
8768 |
|
8769 Invoke setIdAttributeNode on the 4th acronym element using the class attribute (containing entity reference) |
|
8770 as a parameter . Verify by calling isId on the attribute node and getElementById on document node. |
|
8771 Reset by invoking setIdAttributeNode with isId=false. |
|
8772 |
|
8773 Creator: IBM |
|
8774 Autor Jenny Hsu |
|
8775 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
8776 " |
|
8777 | |
|
8778 doc "Document" |
|
8779 elemList "NodeList" |
|
8780 acronymElem "Element" |
|
8781 attributesMap "NamedNodeMap" |
|
8782 attr "Attr" |
|
8783 id "Boolean" |
|
8784 elem "Element" |
|
8785 elemName "String" |
|
8786 | |
|
8787 "implementationAttribute not supported: namespaceAware" |
|
8788 id := false. |
|
8789 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8790 elemList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
8791 acronymElem := elemList item:3. |
|
8792 attributesMap := acronymElem attributes. |
|
8793 attr := attributesMap getNamedItem:'class'. |
|
8794 acronymElem setIdAttributeNode:attr isId:true. |
|
8795 id := attr isId. |
|
8796 self assert: id. |
|
8797 elem := doc getElementById:'Yα'. |
|
8798 elemName := elem tagName. |
|
8799 self assert: ( elemName = 'acronym' ). |
|
8800 acronymElem setIdAttributeNode:attr isId:false. |
|
8801 id := attr isId. |
|
8802 self deny: id. |
|
8803 |
|
8804 ! |
|
8805 |
|
8806 test_elementsetidattributens01 |
|
8807 " |
|
8808 Invoke setIdAttributeNS on an existing namespace attribute with a namespace URI and a qualified name. Verify by calling |
|
8809 isId on the attribute node and getElementById on document node. Call setIdAttributeNS with isId=false to reset. |
|
8810 isId should now return false. |
|
8811 |
|
8812 Creator: IBM |
|
8813 Autor Jenny Hsu |
|
8814 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
8815 " |
|
8816 | |
|
8817 doc "Document" |
|
8818 elemList "NodeList" |
|
8819 employeeElem "Element" |
|
8820 attributesMap "NamedNodeMap" |
|
8821 attr "Attr" |
|
8822 id "Boolean" |
|
8823 elem "Element" |
|
8824 elemName "String" |
|
8825 | |
|
8826 "implementationAttribute not supported: namespaceAware" |
|
8827 id := false. |
|
8828 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8829 elemList := doc getElementsByTagName: 'p'. |
|
8830 employeeElem := elemList item:2. |
|
8831 employeeElem setIdAttribute: 'dmstc' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
8832 attributesMap := employeeElem attributes. |
|
8833 attr := attributesMap getNamedItem:'xmlns:dmstc'. |
|
8834 id := attr isId. |
|
8835 self assert: id. |
|
8836 elem := doc getElementById:'http://www.netzero.com'. |
|
8837 elemName := elem tagName. |
|
8838 self assert: ( elemName = 'p' ). |
|
8839 employeeElem setIdAttribute: 'dmstc' ns: 'http://www.w3.org/2000/xmlns/' isId:false. |
|
8840 id := attr isId. |
|
8841 self deny: id. |
|
8842 |
|
8843 ! |
|
8844 |
|
8845 test_elementsetidattributens02 |
|
8846 " |
|
8847 Invoke setIdAttributeNS on an existing attribute with a namespace URI and a qualified name. Verify by calling |
|
8848 isID on the attribute node and getElementById on document node. Assume the grammar has not defined any |
|
8849 element of typeID. Call setIdAttributeNS with isId=false to reset. Method isId should now return false. |
|
8850 |
|
8851 Creator: IBM |
|
8852 Autor Jenny Hsu |
|
8853 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
8854 " |
|
8855 | |
|
8856 doc "Document" |
|
8857 elemList "NodeList" |
|
8858 addressElem "Element" |
|
8859 attributesMap "NamedNodeMap" |
|
8860 attr "Attr" |
|
8861 id "Boolean" |
|
8862 elem "Element" |
|
8863 elemName "String" |
|
8864 xsiNS "String" |
|
8865 | |
|
8866 "implementationAttribute not supported: namespaceAware" |
|
8867 id := false. |
|
8868 xsiNS := 'http://www.w3.org/2001/XMLSchema-instance'. |
|
8869 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8870 elemList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
8871 addressElem := elemList item:2. |
|
8872 addressElem setIdAttribute: 'noNamespaceSchemaLocation' ns: xsiNS isId:true. |
|
8873 attributesMap := addressElem attributes. |
|
8874 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
8875 id := attr isId. |
|
8876 self assert: id. |
|
8877 elem := doc getElementById:'Yes'. |
|
8878 self assert: elem notNil. |
|
8879 elemName := elem tagName. |
|
8880 self assert: ( elemName = 'acronym' ). |
|
8881 addressElem setIdAttribute: 'noNamespaceSchemaLocation' ns: xsiNS isId:false. |
|
8882 id := attr isId. |
|
8883 self deny: id. |
|
8884 |
|
8885 ! |
|
8886 |
|
8887 test_elementsetidattributens03 |
|
8888 " |
|
8889 Invoke setIdAttributeNS on a newly added namespace attribute on the first em element. Verify by calling |
|
8890 isID on the attribute node and getElementById on document node. Call setIdAttributeNS with isId=false to reset. |
|
8891 Method isId should now return false. |
|
8892 |
|
8893 Creator: IBM |
|
8894 Autor Jenny Hsu |
|
8895 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
8896 " |
|
8897 | |
|
8898 doc "Document" |
|
8899 elemList "NodeList" |
|
8900 employeeIdElem "Element" |
|
8901 attributesMap "NamedNodeMap" |
|
8902 attr "Attr" |
|
8903 id "Boolean" |
|
8904 elem "Element" |
|
8905 elemName "String" |
|
8906 | |
|
8907 id := false. |
|
8908 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8909 elemList := doc getElementsByTagName: 'em'. |
|
8910 employeeIdElem := elemList item:0. |
|
8911 employeeIdElem setAttribute: 'xmlns:newAttr' ns: 'http://www.w3.org/2000/xmlns/' value: 'newValue'. |
|
8912 employeeIdElem setIdAttribute: 'newAttr' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
8913 attributesMap := employeeIdElem attributes. |
|
8914 attr := attributesMap getNamedItem:'xmlns:newAttr'. |
|
8915 id := attr isId. |
|
8916 self assert: id. |
|
8917 elem := doc getElementById:'newValue'. |
|
8918 elemName := elem tagName. |
|
8919 self assert: ( elemName = 'em' ). |
|
8920 employeeIdElem setIdAttribute: 'newAttr' ns: 'http://www.w3.org/2000/xmlns/' isId:false. |
|
8921 id := attr isId. |
|
8922 self deny: id. |
|
8923 |
|
8924 ! |
|
8925 |
|
8926 test_elementsetidattributens04 |
|
8927 " |
|
8928 The method setIdAttributeNS declares the attribute specified by local name and namespace URI to be of type ID. |
|
8929 If the value of the specified attribute is unique then this element node can later be retrieved using getElementById on Document. |
|
8930 Note, however, that this simply affects this node and does not change any grammar that may be in use. |
|
8931 |
|
8932 Invoke setIdAttributeNS on newly added attribute on the third strong element. Verify by calling |
|
8933 isID on the attribute node and getElementById on document node. |
|
8934 Call setIdAttributeNS with isId=false to reset. Method isId should now return false. |
|
8935 |
|
8936 Creator: IBM |
|
8937 Autor Jenny Hsu |
|
8938 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
8939 " |
|
8940 | |
|
8941 doc "Document" |
|
8942 elemList "NodeList" |
|
8943 strongElem "Element" |
|
8944 attributesMap "NamedNodeMap" |
|
8945 attr "Attr" |
|
8946 id "Boolean" |
|
8947 elem "Element" |
|
8948 elemName "String" |
|
8949 | |
|
8950 "implementationAttribute not supported: namespaceAware" |
|
8951 id := false. |
|
8952 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8953 elemList := doc getElementsByTagName: 'strong' ns: '*'. |
|
8954 strongElem := elemList item:2. |
|
8955 strongElem setAttribute: 'dmstc:newAttr' ns: 'http://www.netzero.com' value: 'newValue'. |
|
8956 strongElem setIdAttribute: 'newAttr' ns: 'http://www.netzero.com' isId:true. |
|
8957 attributesMap := strongElem attributes. |
|
8958 attr := attributesMap getNamedItem:'dmstc:newAttr'. |
|
8959 id := attr isId. |
|
8960 self assert: id. |
|
8961 elem := doc getElementById:'newValue'. |
|
8962 elemName := elem tagName. |
|
8963 self assert: ( elemName = 'strong' ). |
|
8964 strongElem setIdAttribute: 'newAttr' ns: 'http://www.netzero.com' isId:false. |
|
8965 id := attr isId. |
|
8966 self deny: id. |
|
8967 |
|
8968 ! |
|
8969 |
|
8970 test_elementsetidattributens05 |
|
8971 " |
|
8972 The method setIdAttributeNS declares the attribute specified by local name and namespace URI to be of type ID. |
|
8973 If the value of the specified attribute is unique then this element node can later be retrieved using getElementById on Document. |
|
8974 Note, however, that this simply affects this node and does not change any grammar that may be in use. |
|
8975 |
|
8976 Invoke setIdAttributeNS on a changed attribute of the third acronym element. Verify by calling |
|
8977 isID on the attribute node and getElementById on document node. |
|
8978 Call setIdAttributeNS with isId=false to reset. Method isId should now return false. |
|
8979 |
|
8980 Creator: IBM |
|
8981 Autor Jenny Hsu |
|
8982 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
8983 " |
|
8984 | |
|
8985 doc "Document" |
|
8986 elemList "NodeList" |
|
8987 acronymElem "Element" |
|
8988 attributesMap "NamedNodeMap" |
|
8989 attr "Attr" |
|
8990 id "Boolean" |
|
8991 elem "Element" |
|
8992 elemName "String" |
|
8993 | |
|
8994 "implementationAttribute not supported: namespaceAware" |
|
8995 id := false. |
|
8996 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
8997 elemList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
8998 acronymElem := elemList item:2. |
|
8999 acronymElem setAttribute: 'title' ns: '*' value: 'newValue'. |
|
9000 acronymElem setIdAttribute: 'title' ns: '*' isId:true. |
|
9001 attributesMap := acronymElem attributes. |
|
9002 attr := attributesMap getNamedItem:'title'. |
|
9003 id := attr isId. |
|
9004 self assert: id. |
|
9005 elem := doc getElementById:'newValue'. |
|
9006 elemName := elem tagName. |
|
9007 self assert: ( elemName = 'acronym' ). |
|
9008 acronymElem setIdAttribute: 'title' ns: '*' isId:false. |
|
9009 id := attr isId. |
|
9010 self deny: id. |
|
9011 |
|
9012 ! |
|
9013 |
|
9014 test_elementsetidattributens06 |
|
9015 " |
|
9016 Invoke setIdAttributeNS on the third strong element with a non-existing attribute name. Verify that |
|
9017 NOT_FOUND_ERR is raised. |
|
9018 |
|
9019 Creator: IBM |
|
9020 Autor Jenny Hsu |
|
9021 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9022 " |
|
9023 | |
|
9024 doc "Document" |
|
9025 elemList "NodeList" |
|
9026 nameElem "Element" |
|
9027 | |
|
9028 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9029 elemList := doc getElementsByTagName: 'strong'. |
|
9030 nameElem := elemList item:2. |
|
9031 "assertDOMException..." |
|
9032 self should:[ |
|
9033 nameElem setIdAttribute: 'hasMiddleName' ns: 'http://www.netzero.com' isId:true. |
|
9034 ] raise: DOMException. |
|
9035 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
9036 "end of assertDOMException..." |
|
9037 |
|
9038 ! |
|
9039 |
|
9040 test_elementsetidattributens07 |
|
9041 " |
|
9042 Invoke setIdAttributeNS on the second p element with a non-existing attribute. Verify that |
|
9043 NOT_FOUND_ERR is raised. |
|
9044 |
|
9045 Creator: IBM |
|
9046 Autor Jenny Hsu |
|
9047 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9048 " |
|
9049 | |
|
9050 doc "Document" |
|
9051 elemList "NodeList" |
|
9052 employeeElem "Element" |
|
9053 | |
|
9054 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9055 elemList := doc getElementsByTagName: 'p'. |
|
9056 employeeElem := elemList item:1. |
|
9057 "assertDOMException..." |
|
9058 self should:[ |
|
9059 employeeElem setIdAttribute: 'xsi' ns: 'http://www.netzero.com' isId:true. |
|
9060 ] raise: DOMException. |
|
9061 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
9062 "end of assertDOMException..." |
|
9063 |
|
9064 ! |
|
9065 |
|
9066 test_elementsetidattributens08 |
|
9067 " |
|
9068 Invoke setIdAttributeNS on the second p element with a non-existing attribute. Verify that |
|
9069 NOT_FOUND_ERR is raised. |
|
9070 |
|
9071 Creator: IBM |
|
9072 Autor Jenny Hsu |
|
9073 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNode |
|
9074 " |
|
9075 | |
|
9076 doc "Document" |
|
9077 elemList "NodeList" |
|
9078 employeeElem "Element" |
|
9079 | |
|
9080 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9081 elemList := doc getElementsByTagName: 'p'. |
|
9082 employeeElem := elemList item:1. |
|
9083 "assertDOMException..." |
|
9084 self should:[ |
|
9085 employeeElem setIdAttribute: 'usa' ns: 'http://www.usa.com' isId:true. |
|
9086 ] raise: DOMException. |
|
9087 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
9088 "end of assertDOMException..." |
|
9089 |
|
9090 ! |
|
9091 |
|
9092 test_elementsetidattributens09 |
|
9093 " |
|
9094 The method setIdAttributeNS declares the attribute specified by local name and namespace URI to be of type ID. |
|
9095 If the value of the specified attribute is unique then this element node can later be retrieved using getElementById on Document. |
|
9096 Note, however, that this simply affects this node and does not change any grammar that may be in use. |
|
9097 |
|
9098 Invoke setIdAttributeNS on the xmlns attribute of ent4. Verify that NO_MODIFICATION_ALLOWED_ERR is raised. |
|
9099 |
|
9100 Creator: IBM |
|
9101 Autor Jenny Hsu |
|
9102 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9103 " |
|
9104 | |
|
9105 doc "Document" |
|
9106 elemList "NodeList" |
|
9107 varElem "Element" |
|
9108 entRef "EntityReference" |
|
9109 entElement "Element" |
|
9110 | |
|
9111 "implementationAttribute not supported: namespaceAware" |
|
9112 "implementationAttribute not supported: expandEntityReferences" |
|
9113 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9114 elemList := doc getElementsByTagName: 'var' ns: '*'. |
|
9115 varElem := elemList item:2. |
|
9116 entRef := varElem firstChild. |
|
9117 entElement := entRef firstChild. |
|
9118 "assertDOMException..." |
|
9119 self should:[ |
|
9120 entElement setIdAttribute: 'xmlns' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
9121 ] raise: DOMException. |
|
9122 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
9123 "end of assertDOMException..." |
|
9124 |
|
9125 ! |
|
9126 |
|
9127 test_elementsetidattributens10 |
|
9128 " |
|
9129 Declares the attribute specified by local name and namespace URI to be of type ID. If the value of the |
|
9130 specified attribute is unique then this element node can later be retrieved using getElementById on Document. |
|
9131 Note, however, that this simply affects this node and does not change any grammar that may be in use. |
|
9132 |
|
9133 Invoke setIdAttributeNS on two existing namespace attributes with different values. Verify by calling |
|
9134 isId on the attributes and getElementById with different values on document node. |
|
9135 |
|
9136 Creator: IBM |
|
9137 Autor Jenny Hsu |
|
9138 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9139 " |
|
9140 | |
|
9141 doc "Document" |
|
9142 elemList "NodeList" |
|
9143 pElem1 "Element" |
|
9144 pElem2 "Element" |
|
9145 attributesMap "NamedNodeMap" |
|
9146 attr "Attr" |
|
9147 id "Boolean" |
|
9148 elem "Element" |
|
9149 elemName "String" |
|
9150 | |
|
9151 "implementationAttribute not supported: namespaceAware" |
|
9152 id := false. |
|
9153 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9154 elemList := doc getElementsByTagName: 'p' ns: '*'. |
|
9155 pElem1 := elemList item:2. |
|
9156 pElem2 := elemList item:3. |
|
9157 pElem1 setIdAttribute: 'dmstc' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
9158 pElem2 setIdAttribute: 'nm' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
9159 attributesMap := pElem1 attributes. |
|
9160 attr := attributesMap getNamedItem:'xmlns:dmstc'. |
|
9161 id := attr isId. |
|
9162 self assert: id. |
|
9163 attributesMap := pElem2 attributes. |
|
9164 attr := attributesMap getNamedItem:'xmlns:nm'. |
|
9165 id := attr isId. |
|
9166 self assert: id. |
|
9167 elem := doc getElementById:'http://www.netzero.com'. |
|
9168 elemName := elem tagName. |
|
9169 self assert: ( elemName = 'p' ). |
|
9170 elem := doc getElementById:'http://www.altavista.com'. |
|
9171 elemName := elem tagName. |
|
9172 self assert: ( elemName = 'p' ). |
|
9173 |
|
9174 ! |
|
9175 |
|
9176 test_elementsetidattributens11 |
|
9177 " |
|
9178 Declares the attribute specified by local name and namespace URI to be of type ID. If the value of the |
|
9179 specified attribute is unique then this element node can later be retrieved using getElementById on Document. |
|
9180 Note, however, that this simply affects this node and does not change any grammar that may be in use. |
|
9181 |
|
9182 Invoke setIdAttributeNS on two existing namespace attributes with same local name but different values. Verify by calling |
|
9183 isId on the attributes node and getElementById with different values on document node. |
|
9184 |
|
9185 Creator: IBM |
|
9186 Autor Jenny Hsu |
|
9187 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9188 " |
|
9189 | |
|
9190 doc "Document" |
|
9191 elemList "NodeList" |
|
9192 pElem1 "Element" |
|
9193 pElem2 "Element" |
|
9194 attributesMap "NamedNodeMap" |
|
9195 attr "Attr" |
|
9196 id "Boolean" |
|
9197 elem "Element" |
|
9198 elemName "String" |
|
9199 | |
|
9200 "implementationAttribute not supported: namespaceAware" |
|
9201 id := false. |
|
9202 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9203 elemList := doc getElementsByTagName: 'p' ns: '*'. |
|
9204 pElem1 := elemList item:1. |
|
9205 pElem2 := elemList item:2. |
|
9206 pElem1 setIdAttribute: 'dmstc' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
9207 pElem2 setIdAttribute: 'dmstc' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
9208 attributesMap := pElem1 attributes. |
|
9209 attr := attributesMap getNamedItem:'xmlns:dmstc'. |
|
9210 id := attr isId. |
|
9211 self assert: id. |
|
9212 attributesMap := pElem2 attributes. |
|
9213 attr := attributesMap getNamedItem:'xmlns:dmstc'. |
|
9214 id := attr isId. |
|
9215 self assert: id. |
|
9216 elem := doc getElementById:'http://www.netzero.com'. |
|
9217 elemName := elem tagName. |
|
9218 self assert: ( elemName = 'p' ). |
|
9219 elem := doc getElementById:'http://www.usa.com'. |
|
9220 elemName := elem tagName. |
|
9221 self assert: ( elemName = 'p' ). |
|
9222 |
|
9223 ! |
|
9224 |
|
9225 test_elementsetidattributens12 |
|
9226 " |
|
9227 Declares the attribute specified by local name and namespace URI to be of type ID. If the value of the |
|
9228 specified attribute is unique then this element node can later be retrieved using getElementById on Document. |
|
9229 Note, however, that this simply affects this node and does not change any grammar that may be in use. |
|
9230 |
|
9231 Set the noNamespaceSchemaLocation attribute on the first acronym element to No . Invoke setIdAttributeNS on the |
|
9232 noNamespaceSchemaLocation attribute of the first, second and third acronym element. Verify by calling isId on |
|
9233 the attributes. Calling getElementById with No as a value should return the acronym element. |
|
9234 |
|
9235 Creator: IBM |
|
9236 Autor Jenny Hsu |
|
9237 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9238 " |
|
9239 | |
|
9240 doc "Document" |
|
9241 elemList "NodeList" |
|
9242 acronymElem1 "Element" |
|
9243 acronymElem2 "Element" |
|
9244 acronymElem3 "Element" |
|
9245 attributesMap "NamedNodeMap" |
|
9246 attr "Attr" |
|
9247 id "Boolean" |
|
9248 elem "Element" |
|
9249 elemName "String" |
|
9250 | |
|
9251 "implementationAttribute not supported: namespaceAware" |
|
9252 id := false. |
|
9253 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9254 elemList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
9255 acronymElem1 := elemList item:0. |
|
9256 acronymElem2 := elemList item:1. |
|
9257 acronymElem3 := elemList item:2. |
|
9258 acronymElem1 setAttribute: 'xsi:noNamespaceSchemaLocation' ns: 'http://www.w3.org/2001/XMLSchema-instance' value: 'No'. |
|
9259 acronymElem1 setIdAttribute: 'noNamespaceSchemaLocation' ns: 'http://www.w3.org/2001/XMLSchema-instance' isId:true. |
|
9260 acronymElem2 setIdAttribute: 'noNamespaceSchemaLocation' ns: 'http://www.w3.org/2001/XMLSchema-instance' isId:true. |
|
9261 acronymElem3 setIdAttribute: 'noNamespaceSchemaLocation' ns: 'http://www.w3.org/2001/XMLSchema-instance' isId:true. |
|
9262 attributesMap := acronymElem1 attributes. |
|
9263 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
9264 id := attr isId. |
|
9265 self assert: id. |
|
9266 attributesMap := acronymElem2 attributes. |
|
9267 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
9268 id := attr isId. |
|
9269 self assert: id. |
|
9270 attributesMap := acronymElem3 attributes. |
|
9271 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
9272 id := attr isId. |
|
9273 self assert: id. |
|
9274 elem := doc getElementById:'No'. |
|
9275 elemName := elem tagName. |
|
9276 self assert: ( elemName = 'acronym' ). |
|
9277 |
|
9278 ! |
|
9279 |
|
9280 test_elementsetidattributens13 |
|
9281 " |
|
9282 Invoke setIdAttributeNS on newly added attribute on the third strong element. Verify by calling |
|
9283 isID on the attribute node and getElementById on document node. |
|
9284 Call setIdAttributeNS on the same element to reset ID but with a non-existing attribute should generate |
|
9285 NOT_FOUND_ERR |
|
9286 |
|
9287 Creator: IBM |
|
9288 Autor Jenny Hsu |
|
9289 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9290 " |
|
9291 | |
|
9292 doc "Document" |
|
9293 elemList "NodeList" |
|
9294 nameElem "Element" |
|
9295 attributesMap "NamedNodeMap" |
|
9296 attr "Attr" |
|
9297 id "Boolean" |
|
9298 elem "Element" |
|
9299 elemName "String" |
|
9300 | |
|
9301 id := false. |
|
9302 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9303 elemList := doc getElementsByTagName: 'strong'. |
|
9304 nameElem := elemList item:2. |
|
9305 nameElem setAttribute: 'xmlns:newAttr' ns: 'http://www.w3.org/2000/xmlns/' value: 'newValue'. |
|
9306 nameElem setIdAttribute: 'newAttr' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
9307 attributesMap := nameElem attributes. |
|
9308 attr := attributesMap getNamedItem:'xmlns:newAttr'. |
|
9309 id := attr isId. |
|
9310 self assert: id. |
|
9311 elem := doc getElementById:'newValue'. |
|
9312 elemName := elem tagName. |
|
9313 self assert: ( elemName = 'strong' ). |
|
9314 "assertDOMException..." |
|
9315 self should:[ |
|
9316 nameElem setIdAttribute: 'lang' ns: 'http://www.w3.org/XML/1998/namespace' isId:false. |
|
9317 ] raise: DOMException. |
|
9318 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
9319 "end of assertDOMException..." |
|
9320 |
|
9321 ! |
|
9322 |
|
9323 test_elementsetidattributens14 |
|
9324 " |
|
9325 Declares the attribute specified by local name and namespace URI to be of type ID. If the value of the |
|
9326 specified attribute is unique then this element node can later be retrieved using getElementById on Document. |
|
9327 Note, however, that this simply affects this node and does not change any grammar that may be in use. |
|
9328 |
|
9329 Invoke setIdAttributeNS on two existing attributes of the second p element and the third |
|
9330 acronym element. Verify by calling isId on the attributes and getElementById with different values on document node. |
|
9331 |
|
9332 Creator: IBM |
|
9333 Autor Jenny Hsu |
|
9334 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ElSetIdAttrNS |
|
9335 " |
|
9336 | |
|
9337 doc "Document" |
|
9338 elemList "NodeList" |
|
9339 pElem "Element" |
|
9340 acronymElem "Element" |
|
9341 attributesMap "NamedNodeMap" |
|
9342 attr "Attr" |
|
9343 id "Boolean" |
|
9344 elem "Element" |
|
9345 elemName "String" |
|
9346 | |
|
9347 "implementationAttribute not supported: namespaceAware" |
|
9348 id := false. |
|
9349 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9350 elemList := doc getElementsByTagName: 'p' ns: '*'. |
|
9351 pElem := elemList item:1. |
|
9352 elemList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
9353 acronymElem := elemList item:2. |
|
9354 pElem setIdAttribute: 'dmstc' ns: 'http://www.w3.org/2000/xmlns/' isId:true. |
|
9355 acronymElem setIdAttribute: 'noNamespaceSchemaLocation' ns: 'http://www.w3.org/2001/XMLSchema-instance' isId:true. |
|
9356 attributesMap := pElem attributes. |
|
9357 attr := attributesMap getNamedItem:'xmlns:dmstc'. |
|
9358 id := attr isId. |
|
9359 self assert: id. |
|
9360 attributesMap := acronymElem attributes. |
|
9361 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
9362 id := attr isId. |
|
9363 self assert: id. |
|
9364 elem := doc getElementById:'Yes'. |
|
9365 elemName := elem tagName. |
|
9366 self assert: ( elemName = 'acronym' ). |
|
9367 elem := doc getElementById:'http://www.usa.com'. |
|
9368 elemName := elem tagName. |
|
9369 self assert: ( elemName = 'p' ). |
|
9370 |
|
9371 ! |
|
9372 |
|
9373 test_entities01 |
|
9374 " |
|
9375 Normalize document with entities set to true, check that |
|
9376 entity references and unused entity declaration are maintained. |
|
9377 |
|
9378 Creator: Curt Arnold |
|
9379 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
9380 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-entities |
|
9381 " |
|
9382 | |
|
9383 doc "Document" |
|
9384 pList "NodeList" |
|
9385 pElem "Element" |
|
9386 domConfig "DOMConfiguration" |
|
9387 canSet "Boolean" |
|
9388 canSetValidate "Boolean" |
|
9389 errorMonitor "DOMErrorMonitor" |
|
9390 child "Node" |
|
9391 childName "String" |
|
9392 entRef "EntityReference" |
|
9393 entities "NamedNodeMap" |
|
9394 ent2 "Entity" |
|
9395 doctype "DocumentType" |
|
9396 | |
|
9397 "implementationAttribute not supported: namespaceAware" |
|
9398 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
9399 domConfig := doc domConfig. |
|
9400 domConfig setParameter: 'entities' value: true. |
|
9401 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
9402 pList := doc getElementsByTagName: 'p'. |
|
9403 pElem := pList item:0. |
|
9404 entRef := doc createEntityReference:'ent1'. |
|
9405 child := pElem appendChild:entRef. |
|
9406 doc normalizeDocument. |
|
9407 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
9408 pList := doc getElementsByTagName: 'p'. |
|
9409 pElem := pList item:0. |
|
9410 child := pElem lastChild. |
|
9411 self assert: child notNil. |
|
9412 childName := child nodeName. |
|
9413 self assert: ( childName = 'ent1' ). |
|
9414 doctype := doc doctype. |
|
9415 entities := doctype entities. |
|
9416 ent2 := entities getNamedItem:'ent2'. |
|
9417 self assert: ent2 notNil. |
|
9418 |
|
9419 ! |
|
9420 |
|
9421 test_entities02 |
|
9422 " |
|
9423 Normalize document with entities set to false, check that |
|
9424 entity references are expanded and unused entity declaration are maintained. |
|
9425 |
|
9426 Creator: Curt Arnold |
|
9427 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
9428 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-entities |
|
9429 " |
|
9430 | |
|
9431 doc "Document" |
|
9432 pList "NodeList" |
|
9433 pElem "Element" |
|
9434 domConfig "DOMConfiguration" |
|
9435 canSet "Boolean" |
|
9436 canSetValidate "Boolean" |
|
9437 errorMonitor "DOMErrorMonitor" |
|
9438 child "Node" |
|
9439 childName "String" |
|
9440 entRef "EntityReference" |
|
9441 childValue "String" |
|
9442 entities "NamedNodeMap" |
|
9443 ent2 "Entity" |
|
9444 doctype "DocumentType" |
|
9445 | |
|
9446 "implementationAttribute not supported: namespaceAware" |
|
9447 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
9448 domConfig := doc domConfig. |
|
9449 domConfig setParameter: 'entities' value: false. |
|
9450 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
9451 pList := doc getElementsByTagName: 'p'. |
|
9452 pElem := pList item:0. |
|
9453 entRef := doc createEntityReference:'ent1'. |
|
9454 child := pElem appendChild:entRef. |
|
9455 doc normalizeDocument. |
|
9456 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
9457 pList := doc getElementsByTagName: 'p'. |
|
9458 pElem := pList item:0. |
|
9459 child := pElem lastChild. |
|
9460 self assert: child notNil. |
|
9461 childName := child nodeName. |
|
9462 self assert: ( childName = '#text' ). |
|
9463 childValue := child nodeValue. |
|
9464 self assert: ( childValue = 'barfoo' ). |
|
9465 doctype := doc doctype. |
|
9466 entities := doctype entities. |
|
9467 ent2 := entities getNamedItem:'ent2'. |
|
9468 self assert: ent2 notNil. |
|
9469 |
|
9470 ! |
|
9471 |
|
9472 test_entities03 |
|
9473 " |
|
9474 Normalize document with entities set to false, check that |
|
9475 unbound entity references are preserved. |
|
9476 |
|
9477 Creator: Curt Arnold |
|
9478 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
9479 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-entities |
|
9480 " |
|
9481 | |
|
9482 doc "Document" |
|
9483 pList "NodeList" |
|
9484 pElem "Element" |
|
9485 domConfig "DOMConfiguration" |
|
9486 canSet "Boolean" |
|
9487 canSetValidate "Boolean" |
|
9488 errorMonitor "DOMErrorMonitor" |
|
9489 child "Node" |
|
9490 childName "String" |
|
9491 entRef "EntityReference" |
|
9492 childType "SmallInteger" |
|
9493 | |
|
9494 "implementationAttribute not supported: namespaceAware" |
|
9495 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
9496 domConfig := doc domConfig. |
|
9497 domConfig setParameter: 'entities' value: false. |
|
9498 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
9499 pList := doc getElementsByTagName: 'p'. |
|
9500 pElem := pList item:0. |
|
9501 entRef := doc createEntityReference:'ent3'. |
|
9502 child := pElem appendChild:entRef. |
|
9503 doc normalizeDocument. |
|
9504 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
9505 pList := doc getElementsByTagName: 'p'. |
|
9506 pElem := pList item:0. |
|
9507 child := pElem lastChild. |
|
9508 self assert: child notNil. |
|
9509 childType := child nodeType. |
|
9510 self assert: ( childType = 5 ). |
|
9511 childName := child nodeName. |
|
9512 self assert: ( childName = 'ent3' ). |
|
9513 |
|
9514 ! |
|
9515 |
|
9516 test_entities04 |
|
9517 " |
|
9518 Normalize document using Node.normalize checking that entities parameter is ignored. |
|
9519 |
|
9520 Creator: Curt Arnold |
|
9521 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
9522 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-entities |
|
9523 " |
|
9524 | |
|
9525 doc "Document" |
|
9526 pList "NodeList" |
|
9527 pElem "Element" |
|
9528 domConfig "DOMConfiguration" |
|
9529 canSet "Boolean" |
|
9530 canSetValidate "Boolean" |
|
9531 errorMonitor "DOMErrorMonitor" |
|
9532 child "Node" |
|
9533 childName "String" |
|
9534 entRef "EntityReference" |
|
9535 entities "NamedNodeMap" |
|
9536 ent2 "Entity" |
|
9537 doctype "DocumentType" |
|
9538 | |
|
9539 "implementationAttribute not supported: namespaceAware" |
|
9540 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
9541 domConfig := doc domConfig. |
|
9542 domConfig setParameter: 'entities' value: false. |
|
9543 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
9544 pList := doc getElementsByTagName: 'p'. |
|
9545 pElem := pList item:0. |
|
9546 entRef := doc createEntityReference:'ent1'. |
|
9547 child := pElem appendChild:entRef. |
|
9548 doc normalize. |
|
9549 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
9550 pList := doc getElementsByTagName: 'p'. |
|
9551 pElem := pList item:0. |
|
9552 child := pElem lastChild. |
|
9553 self assert: child notNil. |
|
9554 childName := child nodeName. |
|
9555 self assert: ( childName = 'ent1' ). |
|
9556 doctype := doc doctype. |
|
9557 entities := doctype entities. |
|
9558 ent2 := entities getNamedItem:'ent2'. |
|
9559 self assert: ent2 notNil. |
|
9560 |
|
9561 ! |
|
9562 |
|
9563 test_entitygetinputencoding01 |
|
9564 " |
|
9565 Call the getInputEncoding method on a UTF-8 encoded document and check if the |
|
9566 value returned is null for a internal general entity. |
|
9567 |
|
9568 Creator: IBM |
|
9569 Autor Neil Delima |
|
9570 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-inputEncoding |
|
9571 " |
|
9572 | |
|
9573 doc "Document" |
|
9574 docType "DocumentType" |
|
9575 entitiesMap "NamedNodeMap" |
|
9576 entity "Entity" |
|
9577 encodingName "String" |
|
9578 | |
|
9579 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9580 docType := doc doctype. |
|
9581 entitiesMap := docType entities. |
|
9582 entity := entitiesMap getNamedItem:'alpha'. |
|
9583 encodingName := entity inputEncoding. |
|
9584 self assert: encodingName isNil. |
|
9585 |
|
9586 ! |
|
9587 |
|
9588 test_entitygetinputencoding02 |
|
9589 " |
|
9590 Call the getInputEncoding method on a UTF-16 encoded document that contains an external |
|
9591 unparsed entity and check if the value returned is null. |
|
9592 |
|
9593 Creator: IBM |
|
9594 Autor Neil Delima |
|
9595 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-inputEncoding |
|
9596 " |
|
9597 | |
|
9598 doc "Document" |
|
9599 docType "DocumentType" |
|
9600 entitiesMap "NamedNodeMap" |
|
9601 entity "Entity" |
|
9602 encodingName "String" |
|
9603 | |
|
9604 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf16'). |
|
9605 docType := doc doctype. |
|
9606 entitiesMap := docType entities. |
|
9607 entity := entitiesMap getNamedItem:'ent5'. |
|
9608 encodingName := entity inputEncoding. |
|
9609 self assert: encodingName isNil. |
|
9610 |
|
9611 ! |
|
9612 |
|
9613 test_entitygetinputencoding03 |
|
9614 " |
|
9615 Check the value of Entity.inputEncoding on an UTF-16 external entity |
|
9616 is either UTF-16 or UTF-16LE |
|
9617 |
|
9618 Creator: IBM |
|
9619 Autor Neil Delima |
|
9620 Autor Curt Arnold |
|
9621 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-inputEncoding |
|
9622 Subject http://lists.w3.org/Archives/Public/www-dom-ts/2003Dec/0045.html |
|
9623 " |
|
9624 | |
|
9625 doc "Document" |
|
9626 docType "DocumentType" |
|
9627 entitiesMap "NamedNodeMap" |
|
9628 entity "Entity" |
|
9629 encodingName "String" |
|
9630 | |
|
9631 ^self. "Validation not supported" |
|
9632 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
9633 docType := doc doctype. |
|
9634 entitiesMap := docType entities. |
|
9635 entity := entitiesMap getNamedItem:'ent1'. |
|
9636 encodingName := entity inputEncoding. |
|
9637 "if" |
|
9638 ( encodingName asLowercase = 'UTF-16LE' asLowercase ) not ifTrue: [ |
|
9639 ]. |
|
9640 encodingName := doc inputEncoding. |
|
9641 self assert: ( encodingName asLowercase = 'UTF-8' asLowercase ). |
|
9642 |
|
9643 ! |
|
9644 |
|
9645 test_entitygetinputencoding04 |
|
9646 " |
|
9647 Check the value of Entity.inputEncoding on an UTF-8 external entity |
|
9648 is UTF-8. |
|
9649 |
|
9650 Creator: IBM |
|
9651 Autor Neil Delima |
|
9652 Autor Curt Arnold |
|
9653 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-inputEncoding |
|
9654 Subject http://lists.w3.org/Archives/Public/www-dom-ts/2003Dec/0045.html |
|
9655 " |
|
9656 | |
|
9657 doc "Document" |
|
9658 docType "DocumentType" |
|
9659 entitiesMap "NamedNodeMap" |
|
9660 entity "Entity" |
|
9661 encodingName "String" |
|
9662 | |
|
9663 ^self. "Validation not supported" |
|
9664 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
9665 docType := doc doctype. |
|
9666 entitiesMap := docType entities. |
|
9667 entity := entitiesMap getNamedItem:'ent2'. |
|
9668 encodingName := entity inputEncoding. |
|
9669 self assert: ( encodingName asLowercase = 'UTF-8' asLowercase ). |
|
9670 encodingName := doc inputEncoding. |
|
9671 self assert: ( encodingName asLowercase = 'UTF-8' asLowercase ). |
|
9672 |
|
9673 ! |
|
9674 |
|
9675 test_entitygetxmlencoding01 |
|
9676 " |
|
9677 Call the getXmlEncoding method on a UTF-8 encoded entity of a document that is not an |
|
9678 external parsed entity and check if the value returned is null. |
|
9679 |
|
9680 Creator: IBM |
|
9681 Autor Neil Delima |
|
9682 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-encoding |
|
9683 " |
|
9684 | |
|
9685 doc "Document" |
|
9686 docType "DocumentType" |
|
9687 entitiesMap "NamedNodeMap" |
|
9688 entity "Entity" |
|
9689 encodingName "String" |
|
9690 | |
|
9691 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9692 docType := doc doctype. |
|
9693 entitiesMap := docType entities. |
|
9694 entity := entitiesMap getNamedItem:'alpha'. |
|
9695 encodingName := entity xmlEncoding. |
|
9696 self assert: encodingName isNil. |
|
9697 |
|
9698 ! |
|
9699 |
|
9700 test_entitygetxmlencoding02 |
|
9701 " |
|
9702 Call the getencoding method on a document that contains an external |
|
9703 unparsed entity and check if the value returned is null. |
|
9704 |
|
9705 Creator: IBM |
|
9706 Autor Neil Delima |
|
9707 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-encoding |
|
9708 " |
|
9709 | |
|
9710 doc "Document" |
|
9711 docType "DocumentType" |
|
9712 entitiesMap "NamedNodeMap" |
|
9713 entity "Entity" |
|
9714 encodingName "String" |
|
9715 | |
|
9716 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
9717 docType := doc doctype. |
|
9718 entitiesMap := docType entities. |
|
9719 entity := entitiesMap getNamedItem:'ent5'. |
|
9720 encodingName := entity xmlEncoding. |
|
9721 self assert: encodingName isNil. |
|
9722 |
|
9723 ! |
|
9724 |
|
9725 test_entitygetxmlencoding03 |
|
9726 " |
|
9727 Check the value of Entity.xmlEncoding on an external entity with an encoding |
|
9728 declaration precisely matches the specified value. |
|
9729 |
|
9730 Creator: IBM |
|
9731 Autor Neil Delima |
|
9732 Autor Curt Arnold |
|
9733 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-encoding |
|
9734 Subject http://lists.w3.org/Archives/Public/www-dom-ts/2003Dec/0045.html |
|
9735 " |
|
9736 | |
|
9737 doc "Document" |
|
9738 docType "DocumentType" |
|
9739 entitiesMap "NamedNodeMap" |
|
9740 entity "Entity" |
|
9741 encodingName "String" |
|
9742 | |
|
9743 ^self. "Validation not supported" |
|
9744 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
9745 docType := doc doctype. |
|
9746 entitiesMap := docType entities. |
|
9747 entity := entitiesMap getNamedItem:'ent1'. |
|
9748 encodingName := entity xmlEncoding. |
|
9749 self assert: ( encodingName = 'uTf-16' ). |
|
9750 |
|
9751 ! |
|
9752 |
|
9753 test_entitygetxmlencoding04 |
|
9754 " |
|
9755 Check the value of Entity.xmlEncoding on an external entity without an encoding |
|
9756 declaration is null. |
|
9757 |
|
9758 Creator: IBM |
|
9759 Autor Neil Delima |
|
9760 Autor Curt Arnold |
|
9761 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-encoding |
|
9762 Subject http://lists.w3.org/Archives/Public/www-dom-ts/2003Dec/0045.html |
|
9763 " |
|
9764 | |
|
9765 doc "Document" |
|
9766 docType "DocumentType" |
|
9767 entitiesMap "NamedNodeMap" |
|
9768 entity "Entity" |
|
9769 encodingName "String" |
|
9770 | |
|
9771 ^self. "Validation not supported" |
|
9772 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
9773 docType := doc doctype. |
|
9774 entitiesMap := docType entities. |
|
9775 entity := entitiesMap getNamedItem:'ent2'. |
|
9776 encodingName := entity xmlEncoding. |
|
9777 self assert: encodingName isNil. |
|
9778 |
|
9779 ! |
|
9780 |
|
9781 test_entitygetxmlversion01 |
|
9782 " |
|
9783 Call the getXmlVersion method on entity that is not an external entity and check if |
|
9784 the value returned is null. |
|
9785 |
|
9786 Creator: IBM |
|
9787 Autor Neil Delima |
|
9788 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-version |
|
9789 " |
|
9790 | |
|
9791 doc "Document" |
|
9792 docType "DocumentType" |
|
9793 entitiesMap "NamedNodeMap" |
|
9794 entity "Entity" |
|
9795 entityVersion "String" |
|
9796 | |
|
9797 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
9798 docType := doc doctype. |
|
9799 entitiesMap := docType entities. |
|
9800 entity := entitiesMap getNamedItem:'epsilon'. |
|
9801 self assert: entityVersion isNil. |
|
9802 |
|
9803 ! |
|
9804 |
|
9805 test_entitygetxmlversion02 |
|
9806 " |
|
9807 Call the getXmlVersion method on a UTF-16 encoded document that contains an external |
|
9808 unparsed entity declaration and check if the value returned is null. |
|
9809 |
|
9810 Creator: IBM |
|
9811 Autor Neil Delima |
|
9812 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-version |
|
9813 " |
|
9814 | |
|
9815 doc "Document" |
|
9816 docType "DocumentType" |
|
9817 entitiesMap "NamedNodeMap" |
|
9818 entity "Entity" |
|
9819 entityVersion "String" |
|
9820 | |
|
9821 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf16'). |
|
9822 docType := doc doctype. |
|
9823 entitiesMap := docType entities. |
|
9824 entity := entitiesMap getNamedItem:'ent5'. |
|
9825 self assert: entityVersion isNil. |
|
9826 |
|
9827 ! |
|
9828 |
|
9829 test_entitygetxmlversion03 |
|
9830 " |
|
9831 Check that the value of Entity.xmlVersion on an external entity without |
|
9832 a version declaration is null. |
|
9833 |
|
9834 Creator: IBM |
|
9835 Autor Neil Delima |
|
9836 Autor Curt Arnold |
|
9837 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-version |
|
9838 Subject http://lists.w3.org/Archives/Public/www-dom-ts/2003Dec/0045.html |
|
9839 " |
|
9840 | |
|
9841 doc "Document" |
|
9842 docType "DocumentType" |
|
9843 entitiesMap "NamedNodeMap" |
|
9844 entity "Entity" |
|
9845 entityVersion "String" |
|
9846 | |
|
9847 ^self. "Validation not supported" |
|
9848 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
9849 docType := doc doctype. |
|
9850 entitiesMap := docType entities. |
|
9851 entity := entitiesMap getNamedItem:'ent2'. |
|
9852 self assert: entityVersion isNil. |
|
9853 |
|
9854 ! |
|
9855 |
|
9856 test_entitygetxmlversion04 |
|
9857 " |
|
9858 Check that the value of Entity.xmlVersion on an external entity with |
|
9859 a version declaration is 1.0 . |
|
9860 |
|
9861 Creator: IBM |
|
9862 Autor Neil Delima |
|
9863 Autor Curt Arnold |
|
9864 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Entity3-version |
|
9865 Subject http://lists.w3.org/Archives/Public/www-dom-ts/2003Dec/0045.html |
|
9866 " |
|
9867 | |
|
9868 doc "Document" |
|
9869 docType "DocumentType" |
|
9870 entitiesMap "NamedNodeMap" |
|
9871 entity "Entity" |
|
9872 entityVersion "String" |
|
9873 | |
|
9874 ^self. "Validation not supported" |
|
9875 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
9876 docType := doc doctype. |
|
9877 entitiesMap := docType entities. |
|
9878 entity := entitiesMap getNamedItem:'ent1'. |
|
9879 self assert: ( entityVersion = '1.0' ). |
|
9880 |
|
9881 ! |
|
9882 |
|
9883 test_handleerror01 |
|
9884 " |
|
9885 Add two CDATASection containing ]]> and call Node.normalize |
|
9886 with an error handler that stops processing. Only one of the |
|
9887 CDATASections should be split. |
|
9888 |
|
9889 Creator: Curt Arnold |
|
9890 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
9891 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections |
|
9892 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ERRORS-DOMErrorHandler-handleError |
|
9893 " |
|
9894 | |
|
9895 doc "Document" |
|
9896 elem "Element" |
|
9897 domConfig "DOMConfiguration" |
|
9898 elemList "NodeList" |
|
9899 newChild "CDATASection" |
|
9900 oldChild "Node" |
|
9901 child "Node" |
|
9902 childValue "String" |
|
9903 childType "SmallInteger" |
|
9904 retval "Node" |
|
9905 errors "List" |
|
9906 errorHandler "DOMErrorHandler" |
|
9907 | |
|
9908 "implementationAttribute not supported: namespaceAware" |
|
9909 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
9910 elemList := doc getElementsByTagName: 'p'. |
|
9911 elem := elemList item:0. |
|
9912 oldChild := elem firstChild. |
|
9913 newChild := doc createCDATASection:'this is not ]]> good'. |
|
9914 elem replaceChild:oldChild with: newChild. |
|
9915 newChild := doc createCDATASection:'this is not ]]> bad'. |
|
9916 retval := elem appendChild:newChild. |
|
9917 domConfig := doc domConfig. |
|
9918 domConfig setParameter: 'split-cdata-sections' value: true. |
|
9919 domConfig setParameter: 'error-handler' value: errorHandler. |
|
9920 doc normalizeDocument. |
|
9921 elemList := doc getElementsByTagName: 'p'. |
|
9922 elem := elemList item:0. |
|
9923 child := elem lastChild. |
|
9924 childValue := child nodeValue. |
|
9925 "if" |
|
9926 ( childValue = 'this is not ]]> bad' ) ifTrue: [ |
|
9927 ]. |
|
9928 |
|
9929 ! |
|
9930 |
|
9931 test_handleerror02 |
|
9932 " |
|
9933 Normalize document with two DOM L1 nodes. |
|
9934 Use an error handler to continue from errors and check that more than one |
|
9935 error was reported. |
|
9936 |
|
9937 Creator: Curt Arnold |
|
9938 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
9939 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespaces |
|
9940 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
9941 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-ERRORS-DOMErrorHandler-handleError |
|
9942 " |
|
9943 | |
|
9944 doc "Document" |
|
9945 docElem "Element" |
|
9946 domConfig "DOMConfiguration" |
|
9947 pList "NodeList" |
|
9948 pElem "Element" |
|
9949 text "Text" |
|
9950 textValue "String" |
|
9951 retval "Node" |
|
9952 brElem "Element" |
|
9953 errors "List" |
|
9954 errorHandler "DOMErrorHandler" |
|
9955 | |
|
9956 "implementationAttribute not supported: namespaceAware" |
|
9957 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
9958 domConfig := doc domConfig. |
|
9959 domConfig setParameter: 'error-handler' value: errorHandler. |
|
9960 pList := doc getElementsByTagName: 'p'. |
|
9961 pElem := pList item:0. |
|
9962 brElem := doc createElement:'br'. |
|
9963 retval := pElem appendChild:brElem. |
|
9964 brElem := doc createElement:'br'. |
|
9965 retval := pElem appendChild:brElem. |
|
9966 doc normalizeDocument. |
|
9967 self assert: errors size = 2. |
|
9968 |
|
9969 ! |
|
9970 |
|
9971 test_hasFeature01 |
|
9972 " |
|
9973 DOMImplementation.hasFeature( XML , 3.0 ) should return true. |
|
9974 |
|
9975 Creator: Curt Arnold |
|
9976 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-5CED94D7 |
|
9977 " |
|
9978 | |
|
9979 impl "DOMImplementation" |
|
9980 state "Boolean" |
|
9981 | |
|
9982 impl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
9983 state := impl hasFeature:'xMl' version:'3.0'. |
|
9984 self assert: state. |
|
9985 |
|
9986 ! |
|
9987 |
|
9988 test_hasFeature02 |
|
9989 " |
|
9990 DOMImplementation.hasFeature( XML , 3.0 ) should return true. |
|
9991 |
|
9992 Creator: Curt Arnold |
|
9993 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-5CED94D7 |
|
9994 " |
|
9995 | |
|
9996 impl "DOMImplementation" |
|
9997 state "Boolean" |
|
9998 | |
|
9999 impl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10000 state := impl hasFeature:'cOrE' version:'3.0'. |
|
10001 self assert: state. |
|
10002 |
|
10003 ! |
|
10004 |
|
10005 test_hasFeature03 |
|
10006 " |
|
10007 DOMImplementation.hasFeature( XML , 3.0 ) should return true. |
|
10008 |
|
10009 Creator: Curt Arnold |
|
10010 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-5CED94D7 |
|
10011 " |
|
10012 | |
|
10013 impl "DOMImplementation" |
|
10014 state "Boolean" |
|
10015 | |
|
10016 impl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10017 state := impl hasFeature:'+cOrE' version:'3.0'. |
|
10018 self assert: state. |
|
10019 |
|
10020 ! |
|
10021 |
|
10022 test_hasFeature04 |
|
10023 " |
|
10024 DOMImplementation.hasFeature( XML , 3.0 ) should return true. |
|
10025 |
|
10026 Creator: Curt Arnold |
|
10027 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-5CED94D7 |
|
10028 " |
|
10029 | |
|
10030 impl "DOMImplementation" |
|
10031 state "Boolean" |
|
10032 | |
|
10033 impl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10034 state := impl hasFeature:'+xMl' version:'3.0'. |
|
10035 self assert: state. |
|
10036 |
|
10037 ! |
|
10038 |
|
10039 test_infoset01 |
|
10040 " |
|
10041 Normalize document with infoset set to true, check that |
|
10042 entity references are expanded and unused entity declaration are maintained. |
|
10043 |
|
10044 Creator: Curt Arnold |
|
10045 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10046 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10047 " |
|
10048 | |
|
10049 doc "Document" |
|
10050 pList "NodeList" |
|
10051 pElem "Element" |
|
10052 domConfig "DOMConfiguration" |
|
10053 canSet "Boolean" |
|
10054 canSetValidate "Boolean" |
|
10055 errorMonitor "DOMErrorMonitor" |
|
10056 child "Node" |
|
10057 childName "String" |
|
10058 entRef "EntityReference" |
|
10059 childValue "String" |
|
10060 entities "NamedNodeMap" |
|
10061 ent2 "Entity" |
|
10062 doctype "DocumentType" |
|
10063 | |
|
10064 "implementationAttribute not supported: namespaceAware" |
|
10065 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10066 domConfig := doc domConfig. |
|
10067 domConfig setParameter: 'infoset' value: true. |
|
10068 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10069 pList := doc getElementsByTagName: 'p'. |
|
10070 pElem := pList item:0. |
|
10071 entRef := doc createEntityReference:'ent1'. |
|
10072 child := pElem appendChild:entRef. |
|
10073 doc normalizeDocument. |
|
10074 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10075 pList := doc getElementsByTagName: 'p'. |
|
10076 pElem := pList item:0. |
|
10077 child := pElem lastChild. |
|
10078 self assert: child notNil. |
|
10079 childName := child nodeName. |
|
10080 self assert: ( childName = '#text' ). |
|
10081 childValue := child nodeValue. |
|
10082 self assert: ( childValue = 'barfoo' ). |
|
10083 doctype := doc doctype. |
|
10084 entities := doctype entities. |
|
10085 ent2 := entities getNamedItem:'ent2'. |
|
10086 self assert: ent2 notNil. |
|
10087 |
|
10088 ! |
|
10089 |
|
10090 test_infoset02 |
|
10091 " |
|
10092 Normalize document with infoset set to true, check that |
|
10093 unbound entity references are preserved. |
|
10094 |
|
10095 Creator: Curt Arnold |
|
10096 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10097 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10098 " |
|
10099 | |
|
10100 doc "Document" |
|
10101 pList "NodeList" |
|
10102 pElem "Element" |
|
10103 domConfig "DOMConfiguration" |
|
10104 canSet "Boolean" |
|
10105 canSetValidate "Boolean" |
|
10106 errorMonitor "DOMErrorMonitor" |
|
10107 child "Node" |
|
10108 childName "String" |
|
10109 entRef "EntityReference" |
|
10110 childType "SmallInteger" |
|
10111 | |
|
10112 "implementationAttribute not supported: namespaceAware" |
|
10113 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10114 domConfig := doc domConfig. |
|
10115 domConfig setParameter: 'infoset' value: true. |
|
10116 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10117 pList := doc getElementsByTagName: 'p'. |
|
10118 pElem := pList item:0. |
|
10119 entRef := doc createEntityReference:'ent3'. |
|
10120 child := pElem appendChild:entRef. |
|
10121 doc normalizeDocument. |
|
10122 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10123 pList := doc getElementsByTagName: 'p'. |
|
10124 pElem := pList item:0. |
|
10125 child := pElem lastChild. |
|
10126 self assert: child notNil. |
|
10127 childType := child nodeType. |
|
10128 self assert: ( childType = 5 ). |
|
10129 childName := child nodeName. |
|
10130 self assert: ( childName = 'ent3' ). |
|
10131 |
|
10132 ! |
|
10133 |
|
10134 test_infoset03 |
|
10135 " |
|
10136 Normalize document with infoset set to true, |
|
10137 check if string values were not normalized. |
|
10138 |
|
10139 Creator: Curt Arnold |
|
10140 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10141 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10142 " |
|
10143 | |
|
10144 doc "Document" |
|
10145 elemList "NodeList" |
|
10146 element "Element" |
|
10147 domConfig "DOMConfiguration" |
|
10148 str "String" |
|
10149 canSetValidate "Boolean" |
|
10150 canSetXMLSchema "Boolean" |
|
10151 xsdNS "String" |
|
10152 errorMonitor "DOMErrorMonitor" |
|
10153 childNode "Node" |
|
10154 childValue "String" |
|
10155 childLength "SmallInteger" |
|
10156 | |
|
10157 "implementationAttribute not supported: namespaceAware" |
|
10158 xsdNS := 'http://www.w3.org/2001/XMLSchema'. |
|
10159 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'datatype_normalization2'). |
|
10160 domConfig := doc domConfig. |
|
10161 canSetValidate := domConfig canSetParameter: 'validate' value: true. |
|
10162 canSetXMLSchema := domConfig canSetParameter: 'schema-type' value: xsdNS. |
|
10163 "if" |
|
10164 (canSetValidate) and: [(canSetXMLSchema)] ifTrue: [ |
|
10165 ]. |
|
10166 |
|
10167 ! |
|
10168 |
|
10169 test_infoset04 |
|
10170 " |
|
10171 Normalize a document with a created CDATA section with the |
|
10172 'infoset' to true and check if |
|
10173 the CDATASection has been coalesced. |
|
10174 |
|
10175 Creator: Curt Arnold |
|
10176 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10177 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=416 |
|
10178 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10179 " |
|
10180 | |
|
10181 doc "Document" |
|
10182 elem "Element" |
|
10183 newCdata "CDATASection" |
|
10184 cdata "CDATASection" |
|
10185 text "Node" |
|
10186 nodeName "String" |
|
10187 nodeValue "String" |
|
10188 appendedChild "Node" |
|
10189 domConfig "DOMConfiguration" |
|
10190 pList "NodeList" |
|
10191 errorMonitor "DOMErrorMonitor" |
|
10192 | |
|
10193 "implementationAttribute not supported: namespaceAware" |
|
10194 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10195 pList := doc getElementsByTagName: 'p'. |
|
10196 elem := pList item:0. |
|
10197 newCdata := doc createCDATASection:'CDATA'. |
|
10198 appendedChild := elem appendChild:newCdata. |
|
10199 domConfig := doc domConfig. |
|
10200 domConfig setParameter: 'infoset' value: true. |
|
10201 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10202 doc normalizeDocument. |
|
10203 errorMonitor assertLowerSeverityFor: self message:'normalization2Error' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10204 pList := doc getElementsByTagName: 'p'. |
|
10205 elem := pList item:0. |
|
10206 text := elem lastChild. |
|
10207 nodeName := text nodeName. |
|
10208 self assert: ( nodeName = '#text' ). |
|
10209 nodeValue := text nodeValue. |
|
10210 self assert: ( nodeValue = 'barCDATA' ). |
|
10211 |
|
10212 ! |
|
10213 |
|
10214 test_infoset05 |
|
10215 " |
|
10216 Normalize document with infoset set to true, check that |
|
10217 namespace declaration attributes are maintained. |
|
10218 |
|
10219 Creator: Curt Arnold |
|
10220 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10221 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10222 " |
|
10223 | |
|
10224 doc "Document" |
|
10225 docElem "Element" |
|
10226 domConfig "DOMConfiguration" |
|
10227 errorMonitor "DOMErrorMonitor" |
|
10228 xmlnsAttr "Attr" |
|
10229 | |
|
10230 "implementationAttribute not supported: namespaceAware" |
|
10231 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10232 domConfig := doc domConfig. |
|
10233 domConfig setParameter: 'infoset' value: true. |
|
10234 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10235 doc normalizeDocument. |
|
10236 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10237 docElem := doc documentElement. |
|
10238 xmlnsAttr := docElem getAttributeNode:'xmlns'. |
|
10239 self assert: xmlnsAttr notNil. |
|
10240 |
|
10241 ! |
|
10242 |
|
10243 test_infoset06 |
|
10244 " |
|
10245 Create a document with an XML 1.1 valid but XML 1.0 invalid element and |
|
10246 normalize document with infoset set to true. |
|
10247 |
|
10248 Creator: Curt Arnold |
|
10249 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10250 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10251 " |
|
10252 | |
|
10253 domImpl "DOMImplementation" |
|
10254 nullString "String" |
|
10255 nullDoctype "DocumentType" |
|
10256 doc "Document" |
|
10257 elem "Element" |
|
10258 retval "Node" |
|
10259 domConfig "DOMConfiguration" |
|
10260 errorMonitor "DOMErrorMonitor" |
|
10261 errors "List" |
|
10262 error "DOMError" |
|
10263 severity "SmallInteger" |
|
10264 type "String" |
|
10265 locator "DOMLocator" |
|
10266 relatedNode "Node" |
|
10267 | |
|
10268 nullString := nil. |
|
10269 nullDoctype := nil. |
|
10270 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10271 doc := domImpl createDocumentNS: nullString qualifiedName: nullString doctype: nullDoctype. |
|
10272 "assertDOMException..." |
|
10273 self should:[ |
|
10274 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed01'. |
|
10275 ] raise: DOMException. |
|
10276 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
10277 "end of assertDOMException..." |
|
10278 "try" |
|
10279 [ |
|
10280 ] on: DOMException do: [:ex| ]. |
|
10281 "end of try" |
|
10282 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed01'. |
|
10283 retval := doc appendChild:elem. |
|
10284 domConfig := doc domConfig. |
|
10285 domConfig setParameter: 'infoset' value: true. |
|
10286 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10287 doc normalizeDocument. |
|
10288 errors := errorMonitor errors. |
|
10289 errors do: [error| |
|
10290 severity := error severity. |
|
10291 self assert: ( severity = 2 ). |
|
10292 type := error type. |
|
10293 self assert: ( type = 'wf-invalid-character-in-node-name' ). |
|
10294 locator := error location. |
|
10295 relatedNode := locator relatedNode. |
|
10296 self assert: relatedNode == elem. |
|
10297 ]. |
|
10298 self assert: errors size = 1. |
|
10299 |
|
10300 ! |
|
10301 |
|
10302 test_infoset07 |
|
10303 " |
|
10304 Create a document with an XML 1.1 valid but XML 1.0 invalid attribute and |
|
10305 normalize document with infoset set to true. |
|
10306 |
|
10307 Creator: Curt Arnold |
|
10308 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10309 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10310 " |
|
10311 | |
|
10312 domImpl "DOMImplementation" |
|
10313 nullDoctype "DocumentType" |
|
10314 doc "Document" |
|
10315 docElem "Element" |
|
10316 attr "Attr" |
|
10317 retval "Node" |
|
10318 domConfig "DOMConfiguration" |
|
10319 errorMonitor "DOMErrorMonitor" |
|
10320 errors "List" |
|
10321 error "DOMError" |
|
10322 severity "SmallInteger" |
|
10323 type "String" |
|
10324 locator "DOMLocator" |
|
10325 relatedNode "Node" |
|
10326 | |
|
10327 nullDoctype := nil. |
|
10328 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10329 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDoctype. |
|
10330 docElem := doc documentElement. |
|
10331 "assertDOMException..." |
|
10332 self should:[ |
|
10333 attr := doc createAttribute:'LegalNameࢎ'. |
|
10334 ] raise: DOMException. |
|
10335 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
10336 "end of assertDOMException..." |
|
10337 "try" |
|
10338 [ |
|
10339 ] on: DOMException do: [:ex| ]. |
|
10340 "end of try" |
|
10341 docElem setAttribute:'LegalNameࢎ' value:'foo'. |
|
10342 attr := docElem getAttributeNode:'LegalNameࢎ'. |
|
10343 domConfig := doc domConfig. |
|
10344 domConfig setParameter: 'infoset' value: true. |
|
10345 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10346 doc normalizeDocument. |
|
10347 errors := errorMonitor errors. |
|
10348 errors do: [error| |
|
10349 severity := error severity. |
|
10350 self assert: ( severity = 2 ). |
|
10351 type := error type. |
|
10352 self assert: ( type = 'wf-invalid-character-in-node-name' ). |
|
10353 locator := error location. |
|
10354 relatedNode := locator relatedNode. |
|
10355 self assert: relatedNode == attr. |
|
10356 ]. |
|
10357 self assert: errors size = 1. |
|
10358 |
|
10359 ! |
|
10360 |
|
10361 test_infoset08 |
|
10362 " |
|
10363 Normalize document with infoset and validation set to true, check that |
|
10364 whitespace in element content is preserved. |
|
10365 |
|
10366 Creator: Curt Arnold |
|
10367 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10368 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10369 " |
|
10370 | |
|
10371 doc "Document" |
|
10372 bodyList "NodeList" |
|
10373 body "Element" |
|
10374 domConfig "DOMConfiguration" |
|
10375 canSet "Boolean" |
|
10376 canSetValidate "Boolean" |
|
10377 errorMonitor "DOMErrorMonitor" |
|
10378 child "Node" |
|
10379 childName "String" |
|
10380 text "Text" |
|
10381 | |
|
10382 "implementationAttribute not supported: namespaceAware" |
|
10383 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10384 domConfig := doc domConfig. |
|
10385 domConfig setParameter: 'infoset' value: true. |
|
10386 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10387 "if" |
|
10388 false "no template for element implementationAttribute" ifTrue: [ |
|
10389 ]. |
|
10390 doc normalizeDocument. |
|
10391 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10392 bodyList := doc getElementsByTagName: 'body'. |
|
10393 body := bodyList item:0. |
|
10394 child := body firstChild. |
|
10395 self assert: child notNil. |
|
10396 childName := child nodeName. |
|
10397 self assert: ( childName = '#text' ). |
|
10398 child := child nextSibling. |
|
10399 self assert: child notNil. |
|
10400 childName := child nodeName. |
|
10401 self assert: ( childName = 'p' ). |
|
10402 |
|
10403 ! |
|
10404 |
|
10405 test_infoset09 |
|
10406 " |
|
10407 Append a Comment node and normalize with infoset set to true. |
|
10408 |
|
10409 Creator: Curt Arnold |
|
10410 Autor Neil Delima |
|
10411 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10412 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-infoset |
|
10413 " |
|
10414 | |
|
10415 doc "Document" |
|
10416 elem "Element" |
|
10417 newComment "Comment" |
|
10418 lastChild "Node" |
|
10419 text "Text" |
|
10420 nodeName "String" |
|
10421 appendedChild "Node" |
|
10422 domConfig "DOMConfiguration" |
|
10423 errorMonitor "DOMErrorMonitor" |
|
10424 pList "NodeList" |
|
10425 | |
|
10426 "implementationAttribute not supported: namespaceAware" |
|
10427 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10428 pList := doc getElementsByTagName: 'p'. |
|
10429 elem := pList item:0. |
|
10430 newComment := doc createComment:'COMMENT_NODE'. |
|
10431 appendedChild := elem appendChild:newComment. |
|
10432 domConfig := doc domConfig. |
|
10433 domConfig setParameter: 'comments' value: false. |
|
10434 domConfig setParameter: 'infoset' value: true. |
|
10435 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10436 doc normalizeDocument. |
|
10437 errorMonitor assertLowerSeverityFor: self message:'normalizationError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10438 pList := doc getElementsByTagName: 'p'. |
|
10439 elem := pList item:0. |
|
10440 lastChild := elem lastChild. |
|
10441 nodeName := lastChild nodeName. |
|
10442 self assert: ( nodeName = '#comment' ). |
|
10443 |
|
10444 ! |
|
10445 |
|
10446 test_namespacedeclarations01 |
|
10447 " |
|
10448 Normalize document with namespace-declarations set to true, check that |
|
10449 namespace declaration attributes are maintained. |
|
10450 |
|
10451 Creator: Curt Arnold |
|
10452 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10453 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespace-declarations |
|
10454 " |
|
10455 | |
|
10456 doc "Document" |
|
10457 docElem "Element" |
|
10458 domConfig "DOMConfiguration" |
|
10459 errorMonitor "DOMErrorMonitor" |
|
10460 xmlnsAttr "Attr" |
|
10461 | |
|
10462 "implementationAttribute not supported: namespaceAware" |
|
10463 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10464 domConfig := doc domConfig. |
|
10465 domConfig setParameter: 'namespace-declarations' value: true. |
|
10466 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10467 doc normalizeDocument. |
|
10468 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10469 docElem := doc documentElement. |
|
10470 xmlnsAttr := docElem getAttributeNode:'xmlns'. |
|
10471 self assert: xmlnsAttr notNil. |
|
10472 |
|
10473 ! |
|
10474 |
|
10475 test_namespacedeclarations02 |
|
10476 " |
|
10477 Normalize document with namespace-declarations set to true, check that |
|
10478 namespace declaration attributes are maintained. |
|
10479 |
|
10480 Creator: Curt Arnold |
|
10481 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
10482 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-namespace-declarations |
|
10483 " |
|
10484 | |
|
10485 doc "Document" |
|
10486 docElem "Element" |
|
10487 domConfig "DOMConfiguration" |
|
10488 errorMonitor "DOMErrorMonitor" |
|
10489 xmlnsAttr "Attr" |
|
10490 | |
|
10491 "implementationAttribute not supported: namespaceAware" |
|
10492 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10493 domConfig := doc domConfig. |
|
10494 domConfig setParameter: 'namespace-declarations' value: false. |
|
10495 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
10496 doc normalizeDocument. |
|
10497 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
10498 docElem := doc documentElement. |
|
10499 xmlnsAttr := docElem getAttributeNode:'xmlns'. |
|
10500 self assert: xmlnsAttr isNil. |
|
10501 |
|
10502 ! |
|
10503 |
|
10504 test_nodeappendchild01 |
|
10505 " |
|
10506 An attempt to add a second doctype node should result in a HIERARCHY_REQUEST_ERR |
|
10507 or a NOT_SUPPORTED_ERR. |
|
10508 |
|
10509 Creator: Curt Arnold |
|
10510 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-184E7107 |
|
10511 " |
|
10512 | |
|
10513 doc "Document" |
|
10514 domImpl "DOMImplementation" |
|
10515 docType "DocumentType" |
|
10516 nullPubId "String" |
|
10517 nullSysId "String" |
|
10518 appendedChild "Node" |
|
10519 tagName "String" |
|
10520 docElem "Element" |
|
10521 | |
|
10522 nullPubId := nil. |
|
10523 nullSysId := nil. |
|
10524 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10525 docElem := doc documentElement. |
|
10526 tagName := docElem tagName. |
|
10527 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10528 docType := domImpl createDocumentType:tagName publicId:nullPubId systemId:nullSysId. |
|
10529 "try" |
|
10530 [ |
|
10531 appendedChild := doc appendChild:docType. |
|
10532 self assert:false. ] on: DOMException do: [:ex| ]. |
|
10533 "end of try" |
|
10534 |
|
10535 ! |
|
10536 |
|
10537 test_nodeappendchild02 |
|
10538 " |
|
10539 An attempt to add a second document element should result in a HIERARCHY_REQUEST_ERR |
|
10540 or a NOT_SUPPORTED_ERR. |
|
10541 |
|
10542 Creator: Curt Arnold |
|
10543 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-184E7107 |
|
10544 " |
|
10545 | |
|
10546 doc "Document" |
|
10547 newElem "Element" |
|
10548 appendedChild "Node" |
|
10549 tagName "String" |
|
10550 rootNS "String" |
|
10551 docElem "Element" |
|
10552 | |
|
10553 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10554 docElem := doc documentElement. |
|
10555 tagName := docElem tagName. |
|
10556 rootNS := docElem namespaceURI. |
|
10557 newElem := doc createElement:tagName ns:rootNS. |
|
10558 "try" |
|
10559 [ |
|
10560 appendedChild := doc appendChild:newElem. |
|
10561 self assert:false. ] on: DOMException do: [:ex| ]. |
|
10562 "end of try" |
|
10563 |
|
10564 ! |
|
10565 |
|
10566 test_nodecomparedocumentposition01 |
|
10567 " |
|
10568 |
|
10569 |
|
10570 |
|
10571 Using compareDocumentPosition to check if a Document node contains and precedes its documentType and |
|
10572 node and if the DocumentTypeNode is contained and follows its Document node. |
|
10573 |
|
10574 Creator: IBM |
|
10575 Autor Jenny Hsu |
|
10576 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10577 " |
|
10578 | |
|
10579 doc "Document" |
|
10580 docType "DocumentType" |
|
10581 documentPositionDoc "SmallInteger" |
|
10582 documentPositionDocType "SmallInteger" |
|
10583 | |
|
10584 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10585 docType := doc doctype. |
|
10586 documentPositionDoc := doc compareDocumentPosition:docType. |
|
10587 self assert: ( documentPositionDoc = 20 ). |
|
10588 documentPositionDocType := docType compareDocumentPosition:doc. |
|
10589 self assert: ( documentPositionDocType = 10 ). |
|
10590 |
|
10591 ! |
|
10592 |
|
10593 test_nodecomparedocumentposition02 |
|
10594 " |
|
10595 Using compareDocumentPosition to check if a Document node contains and precedes its new DocumentType and |
|
10596 node and if the new DocumentType Node is contained and follows its Document node. |
|
10597 |
|
10598 Creator: IBM |
|
10599 Autor Jenny Hsu |
|
10600 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10601 " |
|
10602 | |
|
10603 doc "Document" |
|
10604 domImpl "DOMImplementation" |
|
10605 newDocType "DocumentType" |
|
10606 docType "DocumentType" |
|
10607 documentPositionDoc "SmallInteger" |
|
10608 documentPositionDocType "SmallInteger" |
|
10609 nullPubId "String" |
|
10610 nullSysId "String" |
|
10611 replaced "Node" |
|
10612 rootName "String" |
|
10613 | |
|
10614 nullPubId := nil. |
|
10615 nullSysId := nil. |
|
10616 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10617 docType := doc doctype. |
|
10618 rootName := docType name. |
|
10619 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10620 newDocType := domImpl createDocumentType:rootName publicId:nullPubId systemId:nullSysId. |
|
10621 doc replaceChild:docType with: newDocType. |
|
10622 documentPositionDoc := doc compareDocumentPosition:newDocType. |
|
10623 self assert: ( documentPositionDoc = 20 ). |
|
10624 documentPositionDocType := newDocType compareDocumentPosition:doc. |
|
10625 self assert: ( documentPositionDocType = 10 ). |
|
10626 |
|
10627 ! |
|
10628 |
|
10629 test_nodecomparedocumentposition03 |
|
10630 " |
|
10631 Using compareDocumentPosition check if the document position of two Document nodes obtained from the |
|
10632 same xml document is disconnected, implementation specific, and that the order of these two documents |
|
10633 is reserved. |
|
10634 |
|
10635 Creator: IBM |
|
10636 Autor Jenny Hsu |
|
10637 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10638 " |
|
10639 | |
|
10640 doc "Document" |
|
10641 docComp "Document" |
|
10642 documentPosition1 "SmallInteger" |
|
10643 documentPosition2 "SmallInteger" |
|
10644 documentPosition3 "SmallInteger" |
|
10645 | |
|
10646 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10647 docComp := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10648 documentPosition1 := doc compareDocumentPosition:docComp. |
|
10649 self assert: ( documentPosition1 = 33 ). |
|
10650 documentPosition2 := docComp compareDocumentPosition:doc. |
|
10651 self assert: (documentPosition2 bitAnd: 2) == (documentPosition1 bitAnd: 2). |
|
10652 self assert: (documentPosition2 bitAnd: 4) == (documentPosition1 bitAnd: 4). |
|
10653 self assert: ( documentPosition2 = 33 ). |
|
10654 documentPosition3 := doc compareDocumentPosition:docComp. |
|
10655 self assert: ( documentPosition3 = documentPosition1 ). |
|
10656 |
|
10657 ! |
|
10658 |
|
10659 test_nodecomparedocumentposition04 |
|
10660 " |
|
10661 Using compareDocumentPosition to check that no flags are set in return when the document position of a |
|
10662 Document node is compared with itself |
|
10663 |
|
10664 Creator: IBM |
|
10665 Autor Jenny Hsu |
|
10666 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10667 " |
|
10668 | |
|
10669 doc "Document" |
|
10670 documentPosition "SmallInteger" |
|
10671 | |
|
10672 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10673 documentPosition := doc compareDocumentPosition:doc. |
|
10674 self assert: ( documentPosition = 0 ). |
|
10675 |
|
10676 ! |
|
10677 |
|
10678 test_nodecomparedocumentposition05 |
|
10679 " |
|
10680 Using compareDocumentPosition check if the document position of a Document and a new Document node |
|
10681 are disconnected, implementation-specific and preceding/following. |
|
10682 |
|
10683 Creator: IBM |
|
10684 Autor Jenny Hsu |
|
10685 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10686 " |
|
10687 | |
|
10688 doc "Document" |
|
10689 newDoc "Document" |
|
10690 domImpl "DOMImplementation" |
|
10691 documentPosition1 "SmallInteger" |
|
10692 documentPosition2 "SmallInteger" |
|
10693 documentPosition3 "SmallInteger" |
|
10694 nullDocType "DocumentType" |
|
10695 rootName "String" |
|
10696 rootNS "String" |
|
10697 docElem "Element" |
|
10698 | |
|
10699 nullDocType := nil. |
|
10700 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
10701 docElem := doc documentElement. |
|
10702 rootName := docElem tagName. |
|
10703 rootNS := docElem namespaceURI. |
|
10704 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
10705 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
10706 documentPosition1 := doc compareDocumentPosition:newDoc. |
|
10707 self assert: ( documentPosition1 = 33 ). |
|
10708 documentPosition2 := newDoc compareDocumentPosition:doc. |
|
10709 self assert: ( documentPosition2 = 33 ). |
|
10710 self assert: (documentPosition2 bitAnd: 2) == (documentPosition1 bitAnd: 2). |
|
10711 self assert: (documentPosition2 bitAnd: 4) == (documentPosition1 bitAnd: 4). |
|
10712 documentPosition3 := doc compareDocumentPosition:newDoc. |
|
10713 self assert: ( documentPosition3 = documentPosition1 ). |
|
10714 |
|
10715 ! |
|
10716 |
|
10717 test_nodecomparedocumentposition06 |
|
10718 " |
|
10719 |
|
10720 |
|
10721 |
|
10722 Using compareDocumentPosition check if the document position of a Document node contains and precedes |
|
10723 its DocumentElement, and the DocumentElement is contained and follows the Document node. |
|
10724 |
|
10725 Creator: IBM |
|
10726 Autor Jenny Hsu |
|
10727 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10728 " |
|
10729 | |
|
10730 doc "Document" |
|
10731 docElem "Element" |
|
10732 documentPositionDoc "SmallInteger" |
|
10733 documentPositionDocElem "SmallInteger" |
|
10734 | |
|
10735 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10736 docElem := doc documentElement. |
|
10737 documentPositionDoc := doc compareDocumentPosition:docElem. |
|
10738 self assert: ( documentPositionDoc = 20 ). |
|
10739 documentPositionDocElem := docElem compareDocumentPosition:doc. |
|
10740 self assert: ( documentPositionDocElem = 10 ). |
|
10741 |
|
10742 ! |
|
10743 |
|
10744 test_nodecomparedocumentposition07 |
|
10745 " |
|
10746 Using compareDocumentPosition check if the document compared contains and precedes the new |
|
10747 newElement, and the newElement is contained and follows the document. |
|
10748 |
|
10749 Creator: IBM |
|
10750 Autor Jenny Hsu |
|
10751 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10752 " |
|
10753 | |
|
10754 doc "Document" |
|
10755 docElem "Element" |
|
10756 newElem "Element" |
|
10757 documentPosition "SmallInteger" |
|
10758 documentElementPosition "SmallInteger" |
|
10759 appendedChild "Node" |
|
10760 | |
|
10761 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10762 docElem := doc documentElement. |
|
10763 newElem := doc createElement:'br' ns:'http://www.w3.org/1999/xhtml'. |
|
10764 appendedChild := docElem appendChild:newElem. |
|
10765 documentPosition := doc compareDocumentPosition:newElem. |
|
10766 self assert: ( documentPosition = 20 ). |
|
10767 documentElementPosition := newElem compareDocumentPosition:doc. |
|
10768 self assert: ( documentElementPosition = 10 ). |
|
10769 |
|
10770 ! |
|
10771 |
|
10772 test_nodecomparedocumentposition08 |
|
10773 " |
|
10774 Using compareDocumentPosition check if the Document node contains and precedes an Element, |
|
10775 and the Element is contained and follows the Document node. |
|
10776 |
|
10777 Creator: IBM |
|
10778 Autor Jenny Hsu |
|
10779 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10780 " |
|
10781 | |
|
10782 doc "Document" |
|
10783 elem "Element" |
|
10784 elemList "NodeList" |
|
10785 documentPosition "SmallInteger" |
|
10786 elementPosition "SmallInteger" |
|
10787 | |
|
10788 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10789 elemList := doc getElementsByTagName: 'p'. |
|
10790 elem := elemList item:3. |
|
10791 documentPosition := doc compareDocumentPosition:elem. |
|
10792 self assert: ( documentPosition = 20 ). |
|
10793 elementPosition := elem compareDocumentPosition:doc. |
|
10794 self assert: ( elementPosition = 10 ). |
|
10795 |
|
10796 ! |
|
10797 |
|
10798 test_nodecomparedocumentposition09 |
|
10799 " |
|
10800 Using compareDocumentPosition check if the Element node is contained and follows the appended Document node, and |
|
10801 if the Document node contains and precedes the Element node. |
|
10802 |
|
10803 Creator: IBM |
|
10804 Autor Jenny Hsu |
|
10805 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10806 " |
|
10807 | |
|
10808 doc "Document" |
|
10809 elem "Element" |
|
10810 newElem "Element" |
|
10811 elemList "NodeList" |
|
10812 documentPosition "SmallInteger" |
|
10813 documentElementPosition "SmallInteger" |
|
10814 appendedChild "Node" |
|
10815 | |
|
10816 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10817 elemList := doc getElementsByTagName: 'p'. |
|
10818 elem := elemList item:3. |
|
10819 newElem := doc createElement:'br' ns:'http://www.w3.org/1999/xhtml'. |
|
10820 appendedChild := elem appendChild:newElem. |
|
10821 documentPosition := doc compareDocumentPosition:newElem. |
|
10822 self assert: ( documentPosition = 20 ). |
|
10823 documentElementPosition := newElem compareDocumentPosition:doc. |
|
10824 self assert: ( documentElementPosition = 10 ). |
|
10825 |
|
10826 ! |
|
10827 |
|
10828 test_nodecomparedocumentposition10 |
|
10829 " |
|
10830 Using compareDocumentPosition check if the document node precedes and contains its default Attr node. |
|
10831 |
|
10832 Creator: IBM |
|
10833 Autor Jenny Hsu |
|
10834 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10835 " |
|
10836 | |
|
10837 doc "Document" |
|
10838 elem "Element" |
|
10839 dir "Attr" |
|
10840 elemList "NodeList" |
|
10841 attrPosition "SmallInteger" |
|
10842 | |
|
10843 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10844 elemList := doc getElementsByTagName: 'p'. |
|
10845 elem := elemList item:3. |
|
10846 dir := elem getAttributeNode:'dir'. |
|
10847 attrPosition := dir compareDocumentPosition:doc. |
|
10848 self assert: ( attrPosition = 10 ). |
|
10849 |
|
10850 ! |
|
10851 |
|
10852 test_nodecomparedocumentposition11 |
|
10853 " |
|
10854 Using compareDocumentPosition check if the Document node precedes and contains the Attr node. |
|
10855 |
|
10856 Creator: IBM |
|
10857 Autor Jenny Hsu |
|
10858 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10859 " |
|
10860 | |
|
10861 doc "Document" |
|
10862 elem "Element" |
|
10863 newAttr "Attr" |
|
10864 elemList "NodeList" |
|
10865 documentPosition "SmallInteger" |
|
10866 attrPosition "SmallInteger" |
|
10867 replacedAttr "Attr" |
|
10868 | |
|
10869 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10870 elemList := doc getElementsByTagName: 'p'. |
|
10871 elem := elemList item:3. |
|
10872 newAttr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
10873 replacedAttr := elem setAttributeNodeNS: newAttr. |
|
10874 attrPosition := newAttr compareDocumentPosition:doc. |
|
10875 self assert: ( attrPosition = 10 ). |
|
10876 |
|
10877 ! |
|
10878 |
|
10879 test_nodecomparedocumentposition12 |
|
10880 " |
|
10881 Using compareDocumentPosition to check if a new ProcessingInstruction node is contained and follows the |
|
10882 Document node, and that the Document node contains and precedes the ProcessingInstruction node. |
|
10883 |
|
10884 Creator: IBM |
|
10885 Autor Jenny Hsu |
|
10886 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10887 " |
|
10888 | |
|
10889 doc "Document" |
|
10890 pi "ProcessingInstruction" |
|
10891 documentPosition "SmallInteger" |
|
10892 piPosition "SmallInteger" |
|
10893 appendedChild "Node" |
|
10894 | |
|
10895 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10896 pi := doc createProcessingInstruction:'PITarget' data:'PIDATA'. |
|
10897 appendedChild := doc appendChild:pi. |
|
10898 documentPosition := doc compareDocumentPosition:pi. |
|
10899 self assert: ( documentPosition = 20 ). |
|
10900 piPosition := pi compareDocumentPosition:doc. |
|
10901 self assert: ( piPosition = 10 ). |
|
10902 |
|
10903 ! |
|
10904 |
|
10905 test_nodecomparedocumentposition13 |
|
10906 " |
|
10907 Using compareDocumentPosition check if the Document node contains and precedes the new Comment node, |
|
10908 and if the Comment node is contained and follows the Document node. |
|
10909 |
|
10910 Creator: IBM |
|
10911 Autor Jenny Hsu |
|
10912 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10913 " |
|
10914 | |
|
10915 doc "Document" |
|
10916 comment "Comment" |
|
10917 elem "Element" |
|
10918 elemList "NodeList" |
|
10919 documentPosition "SmallInteger" |
|
10920 commentPosition "SmallInteger" |
|
10921 appendedChild "Node" |
|
10922 | |
|
10923 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10924 comment := doc createComment:'Another Comment'. |
|
10925 elemList := doc getElementsByTagName: 'p'. |
|
10926 elem := elemList item:3. |
|
10927 appendedChild := elem appendChild:comment. |
|
10928 documentPosition := doc compareDocumentPosition:comment. |
|
10929 self assert: ( documentPosition = 20 ). |
|
10930 commentPosition := comment compareDocumentPosition:doc. |
|
10931 self assert: ( commentPosition = 10 ). |
|
10932 |
|
10933 ! |
|
10934 |
|
10935 test_nodecomparedocumentposition14 |
|
10936 " |
|
10937 Using compareDocumentPosition check if the DocumentFragment node contains and precedes an Element |
|
10938 node appended to it, and that the Element node is contained and follows the DocumentFragment node. |
|
10939 |
|
10940 Creator: IBM |
|
10941 Autor Jenny Hsu |
|
10942 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10943 " |
|
10944 | |
|
10945 doc "Document" |
|
10946 docFrag "DocumentFragment" |
|
10947 docElem "Element" |
|
10948 docFragChild "Node" |
|
10949 docFragPosition "SmallInteger" |
|
10950 docFragChildPosition "SmallInteger" |
|
10951 appendedChild "Node" |
|
10952 | |
|
10953 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10954 docElem := doc documentElement. |
|
10955 docFrag := doc createDocumentFragment. |
|
10956 appendedChild := docFrag appendChild:docElem. |
|
10957 docFragChild := docFrag firstChild. |
|
10958 docFragPosition := docFrag compareDocumentPosition:docFragChild. |
|
10959 self assert: ( docFragPosition = 20 ). |
|
10960 docFragChildPosition := docFragChild compareDocumentPosition:docFrag. |
|
10961 self assert: ( docFragChildPosition = 10 ). |
|
10962 |
|
10963 ! |
|
10964 |
|
10965 test_nodecomparedocumentposition15 |
|
10966 " |
|
10967 Using compareDocumentPosition check if the Element node precedes and contains its Attr child, and that the Attr child |
|
10968 is contained and follows the Element node. |
|
10969 |
|
10970 Creator: IBM |
|
10971 Autor Neil Delima |
|
10972 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
10973 " |
|
10974 | |
|
10975 doc "Document" |
|
10976 docFrag "DocumentFragment" |
|
10977 docElem "Element" |
|
10978 attr "Attr" |
|
10979 docFragChild "Node" |
|
10980 attrPosition "SmallInteger" |
|
10981 docFragChildPosition "SmallInteger" |
|
10982 appendedChild "Node" |
|
10983 attrNode "Node" |
|
10984 | |
|
10985 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
10986 docElem := doc documentElement. |
|
10987 docFrag := doc createDocumentFragment. |
|
10988 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
10989 attrNode := docElem setAttributeNodeNS: attr. |
|
10990 appendedChild := docFrag appendChild:docElem. |
|
10991 docFragChild := docFrag firstChild. |
|
10992 docFragChildPosition := docFragChild compareDocumentPosition:attr. |
|
10993 self assert: ( docFragChildPosition = 20 ). |
|
10994 attrPosition := attr compareDocumentPosition:docFragChild. |
|
10995 self assert: ( attrPosition = 10 ). |
|
10996 |
|
10997 ! |
|
10998 |
|
10999 test_nodecomparedocumentposition16 |
|
11000 " |
|
11001 Using compareDocumentPosition check if the document position of a DocumentFragment node compared with |
|
11002 a cloned Attr node is disconnected and implementation specific, and that the order between these two |
|
11003 nodes is preserved. |
|
11004 |
|
11005 Creator: IBM |
|
11006 Autor Jenny Hsu |
|
11007 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11008 " |
|
11009 | |
|
11010 doc "Document" |
|
11011 docFrag "DocumentFragment" |
|
11012 attr "Attr" |
|
11013 attrCloned "Attr" |
|
11014 docFragPosition "SmallInteger" |
|
11015 position1 "SmallInteger" |
|
11016 position2 "SmallInteger" |
|
11017 position3 "SmallInteger" |
|
11018 | |
|
11019 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11020 docFrag := doc createDocumentFragment. |
|
11021 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
11022 attrCloned := attr cloneNode:true. |
|
11023 position1 := docFrag compareDocumentPosition:attrCloned. |
|
11024 self assert: ( position1 = 33 ). |
|
11025 position2 := attrCloned compareDocumentPosition:docFrag. |
|
11026 self assert: (position2 bitAnd: 2) == (position1 bitAnd: 2). |
|
11027 self assert: (position2 bitAnd: 4) == (position1 bitAnd: 4). |
|
11028 self assert: ( position2 = 33 ). |
|
11029 position3 := docFrag compareDocumentPosition:attrCloned. |
|
11030 self assert: ( position3 = position1 ). |
|
11031 |
|
11032 ! |
|
11033 |
|
11034 test_nodecomparedocumentposition17 |
|
11035 " |
|
11036 Using compareDocumentPosition check if the document position of the first ProcessingInstruction node compared to |
|
11037 this second newly apended ProcessingInstruction node is PRECEDING, and FOLLOWING vice versa. |
|
11038 |
|
11039 Creator: IBM |
|
11040 Autor Jenny Hsu |
|
11041 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11042 " |
|
11043 | |
|
11044 doc "Document" |
|
11045 pi1 "ProcessingInstruction" |
|
11046 pi2 "ProcessingInstruction" |
|
11047 pi1Position "SmallInteger" |
|
11048 pi2Position "SmallInteger" |
|
11049 appendedChild "Node" |
|
11050 | |
|
11051 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11052 pi1 := doc createProcessingInstruction:'PI1' data:''. |
|
11053 pi2 := doc createProcessingInstruction:'PI2' data:''. |
|
11054 appendedChild := doc appendChild:pi1. |
|
11055 appendedChild := doc appendChild:pi2. |
|
11056 pi1Position := pi1 compareDocumentPosition:pi2. |
|
11057 self assert: ( pi1Position = 4 ). |
|
11058 pi2Position := pi2 compareDocumentPosition:pi1. |
|
11059 self assert: ( pi2Position = 2 ). |
|
11060 |
|
11061 ! |
|
11062 |
|
11063 test_nodecomparedocumentposition18 |
|
11064 " |
|
11065 Using compareDocumentPosition check if the document position of the first new Text node compared to the |
|
11066 second text node is PRECEDING and is FOLLOWING vice versa. |
|
11067 |
|
11068 Creator: IBM |
|
11069 Autor Jenny Hsu |
|
11070 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11071 " |
|
11072 | |
|
11073 doc "Document" |
|
11074 docElem "Element" |
|
11075 txt1 "Text" |
|
11076 txt2 "Text" |
|
11077 txt1Position "SmallInteger" |
|
11078 txt2Position "SmallInteger" |
|
11079 appendedChild "Node" |
|
11080 | |
|
11081 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11082 docElem := doc documentElement. |
|
11083 txt1 := doc createTextNode:'T1'. |
|
11084 txt2 := doc createTextNode:'T2'. |
|
11085 appendedChild := docElem appendChild:txt1. |
|
11086 appendedChild := docElem appendChild:txt2. |
|
11087 txt1Position := txt1 compareDocumentPosition:txt2. |
|
11088 self assert: ( txt1Position = 4 ). |
|
11089 txt2Position := txt2 compareDocumentPosition:txt1. |
|
11090 self assert: ( txt2Position = 2 ). |
|
11091 |
|
11092 ! |
|
11093 |
|
11094 test_nodecomparedocumentposition19 |
|
11095 " |
|
11096 The method compareDocumentPosition compares a node with this node with regard to their position in the |
|
11097 document and according to the document order. |
|
11098 |
|
11099 Using compareDocumentPosition check if the document position of the first CDATASection node |
|
11100 of the second element whose localName is name compared with the second CDATASection node |
|
11101 is PRECEDING and is FOLLOWING vice versa. |
|
11102 |
|
11103 Creator: IBM |
|
11104 Autor Jenny Hsu |
|
11105 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11106 " |
|
11107 | |
|
11108 doc "Document" |
|
11109 elemList "NodeList" |
|
11110 elemStrong "Element" |
|
11111 cdata1 "CDATASection" |
|
11112 cdata2 "CDATASection" |
|
11113 aNode "Node" |
|
11114 cdata1Position "SmallInteger" |
|
11115 cdata2Position "SmallInteger" |
|
11116 | |
|
11117 "implementationAttribute not supported: coalescing" |
|
11118 "implementationAttribute not supported: namespaceAware" |
|
11119 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11120 elemList := doc getElementsByTagName: 'strong' ns: '*'. |
|
11121 elemStrong := elemList item:1. |
|
11122 cdata2 := elemStrong lastChild. |
|
11123 aNode := cdata2 previousSibling. |
|
11124 cdata1 := aNode previousSibling. |
|
11125 cdata1Position := cdata1 compareDocumentPosition:cdata2. |
|
11126 self assert: ( cdata1Position = 4 ). |
|
11127 cdata2Position := cdata2 compareDocumentPosition:cdata1. |
|
11128 self assert: ( cdata2Position = 2 ). |
|
11129 |
|
11130 ! |
|
11131 |
|
11132 test_nodecomparedocumentposition20 |
|
11133 " |
|
11134 Using compareDocumentPosition check if the document position of the first Text node |
|
11135 of the second element whose localName is name compared with the next CDATASection node |
|
11136 is PRECEDING and FOLLOWING vice versa. |
|
11137 |
|
11138 Creator: IBM |
|
11139 Autor Jenny Hsu |
|
11140 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11141 " |
|
11142 | |
|
11143 doc "Document" |
|
11144 elemList "NodeList" |
|
11145 elemName "Element" |
|
11146 cdata "CDATASection" |
|
11147 txt "Text" |
|
11148 txtPosition "SmallInteger" |
|
11149 cdataPosition "SmallInteger" |
|
11150 | |
|
11151 "implementationAttribute not supported: coalescing" |
|
11152 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11153 elemList := doc getElementsByTagName: 'strong'. |
|
11154 elemName := elemList item:1. |
|
11155 txt := elemName firstChild. |
|
11156 cdata := elemName lastChild. |
|
11157 txtPosition := txt compareDocumentPosition:cdata. |
|
11158 self assert: ( txtPosition = 4 ). |
|
11159 cdataPosition := cdata compareDocumentPosition:txt. |
|
11160 self assert: ( cdataPosition = 2 ). |
|
11161 |
|
11162 ! |
|
11163 |
|
11164 test_nodecomparedocumentposition21 |
|
11165 " |
|
11166 Using compareDocumentPosition check the document position of the text node of the fist and second elements |
|
11167 whose localName is name. The first text node should return FOLLOWING and the second text node should |
|
11168 return PRECEDING when compareDocumentPosition is invoked with the other node as a parameter. |
|
11169 |
|
11170 |
|
11171 Creator: IBM |
|
11172 Autor Jenny Hsu |
|
11173 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11174 " |
|
11175 | |
|
11176 doc "Document" |
|
11177 elemList "NodeList" |
|
11178 elemName1 "Element" |
|
11179 elemName2 "Element" |
|
11180 txt1 "Text" |
|
11181 txt2 "Text" |
|
11182 txt1Position "SmallInteger" |
|
11183 txt2Position "SmallInteger" |
|
11184 | |
|
11185 "implementationAttribute not supported: coalescing" |
|
11186 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11187 elemList := doc getElementsByTagName: 'strong'. |
|
11188 elemName1 := elemList item:0. |
|
11189 elemName2 := elemList item:1. |
|
11190 txt1 := elemName1 firstChild. |
|
11191 txt2 := elemName2 firstChild. |
|
11192 txt1Position := txt1 compareDocumentPosition:txt2. |
|
11193 self assert: ( txt1Position = 4 ). |
|
11194 txt2Position := txt2 compareDocumentPosition:txt1. |
|
11195 self assert: ( txt2Position = 2 ). |
|
11196 |
|
11197 ! |
|
11198 |
|
11199 test_nodecomparedocumentposition22 |
|
11200 " |
|
11201 Using compareDocumentPosition check if the Entity node precedes the Notation node and the Notation |
|
11202 node follows the Entity node. |
|
11203 |
|
11204 Creator: IBM |
|
11205 Autor Jenny Hsu |
|
11206 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11207 " |
|
11208 | |
|
11209 doc "Document" |
|
11210 docType "DocumentType" |
|
11211 entitiesMap "NamedNodeMap" |
|
11212 notationsMap "NamedNodeMap" |
|
11213 entity "Entity" |
|
11214 notation "Notation" |
|
11215 entityPosition "SmallInteger" |
|
11216 notationPosition "SmallInteger" |
|
11217 | |
|
11218 "implementationAttribute not supported: coalescing" |
|
11219 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11220 docType := doc doctype. |
|
11221 entitiesMap := docType entities. |
|
11222 notationsMap := docType notations. |
|
11223 entity := entitiesMap getNamedItem:'alpha'. |
|
11224 notation := notationsMap getNamedItem:'notation1'. |
|
11225 entityPosition := entity compareDocumentPosition:notation. |
|
11226 self assert: ( entityPosition = 4 ). |
|
11227 notationPosition := notation compareDocumentPosition:entity. |
|
11228 self assert: ( notationPosition = 2 ). |
|
11229 |
|
11230 ! |
|
11231 |
|
11232 test_nodecomparedocumentposition23 |
|
11233 " |
|
11234 Using compareDocumentPosition check if the document position of an Entity node compared to another |
|
11235 Entity node following it in DocumentType is implementation specific. |
|
11236 |
|
11237 Creator: IBM |
|
11238 Autor Jenny Hsu |
|
11239 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11240 " |
|
11241 | |
|
11242 doc "Document" |
|
11243 docType "DocumentType" |
|
11244 entitiesMap "NamedNodeMap" |
|
11245 entity "Entity" |
|
11246 entity2 "Entity" |
|
11247 position1 "SmallInteger" |
|
11248 position2 "SmallInteger" |
|
11249 position3 "SmallInteger" |
|
11250 | |
|
11251 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11252 docType := doc doctype. |
|
11253 entitiesMap := docType entities. |
|
11254 entity := entitiesMap getNamedItem:'alpha'. |
|
11255 entity2 := entitiesMap getNamedItem:'delta'. |
|
11256 position1 := entity compareDocumentPosition:entity2. |
|
11257 self assert: ( position1 = 32 ). |
|
11258 position2 := entity2 compareDocumentPosition:entity. |
|
11259 self assert: (position2 bitAnd: 2) == (position1 bitAnd: 2). |
|
11260 self assert: (position2 bitAnd: 4) == (position1 bitAnd: 4). |
|
11261 self assert: ( position2 = 32 ). |
|
11262 position3 := entity compareDocumentPosition:entity2. |
|
11263 self assert: ( position3 = position1 ). |
|
11264 |
|
11265 ! |
|
11266 |
|
11267 test_nodecomparedocumentposition24 |
|
11268 " |
|
11269 Using compareDocumentPosition check if the return value of document position of a Notation node compared to another |
|
11270 that is the same is not flagged. |
|
11271 |
|
11272 Creator: IBM |
|
11273 Autor Jenny Hsu |
|
11274 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11275 " |
|
11276 | |
|
11277 doc "Document" |
|
11278 docType "DocumentType" |
|
11279 notaionsMap "NamedNodeMap" |
|
11280 notation "Notation" |
|
11281 notation2 "Notation" |
|
11282 notationPosition "SmallInteger" |
|
11283 | |
|
11284 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11285 docType := doc doctype. |
|
11286 notaionsMap := docType notations. |
|
11287 notation := notaionsMap getNamedItem:'notation1'. |
|
11288 notation2 := notaionsMap getNamedItem:'notation1'. |
|
11289 notationPosition := notation compareDocumentPosition:notation2. |
|
11290 self assert: ( notationPosition = 0 ). |
|
11291 |
|
11292 ! |
|
11293 |
|
11294 test_nodecomparedocumentposition25 |
|
11295 " |
|
11296 Using compareDocumentPosition check if the EntityReference or Text node is contained and follows its |
|
11297 parent Element node, and that the Element node contains and precedes the |
|
11298 EntityReference or Text node. |
|
11299 |
|
11300 Creator: IBM |
|
11301 Autor Jenny Hsu |
|
11302 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11303 " |
|
11304 | |
|
11305 doc "Document" |
|
11306 elemList "NodeList" |
|
11307 elemName "Element" |
|
11308 entRef "Node" |
|
11309 elementPosition "SmallInteger" |
|
11310 entRefPosition "SmallInteger" |
|
11311 | |
|
11312 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11313 elemList := doc getElementsByTagName: 'var'. |
|
11314 elemName := elemList item:2. |
|
11315 entRef := elemName firstChild. |
|
11316 elementPosition := elemName compareDocumentPosition:entRef. |
|
11317 self assert: ( elementPosition = 20 ). |
|
11318 entRefPosition := entRef compareDocumentPosition:elemName. |
|
11319 self assert: ( entRefPosition = 10 ). |
|
11320 |
|
11321 ! |
|
11322 |
|
11323 test_nodecomparedocumentposition26 |
|
11324 " |
|
11325 Using compareDocumentPosition check if the EntityReference node contains and precedes it's first |
|
11326 childElement, and that the childElement is contained and follows the EntityReference node. |
|
11327 |
|
11328 Creator: IBM |
|
11329 Autor Jenny Hsu |
|
11330 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11331 " |
|
11332 | |
|
11333 doc "Document" |
|
11334 varList "NodeList" |
|
11335 varElem "Element" |
|
11336 entRef "EntityReference" |
|
11337 entRefChild1 "Element" |
|
11338 entRefPosition "SmallInteger" |
|
11339 entRefChild1Position "SmallInteger" |
|
11340 | |
|
11341 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11342 "if" |
|
11343 false "no template for element implementationAttribute" ifTrue: [ |
|
11344 ]. |
|
11345 entRefChild1 := entRef firstChild. |
|
11346 self assert: entRefChild1 notNil. |
|
11347 entRefPosition := entRef compareDocumentPosition:entRefChild1. |
|
11348 self assert: ( entRefPosition = 20 ). |
|
11349 entRefChild1Position := entRefChild1 compareDocumentPosition:entRef. |
|
11350 self assert: ( entRefChild1Position = 10 ). |
|
11351 |
|
11352 ! |
|
11353 |
|
11354 test_nodecomparedocumentposition27 |
|
11355 " |
|
11356 Using compareDocumentPosition to check if the EntityReference node contains and precedes it's last |
|
11357 childElement, and that this childElement is contained and follows the EntityReference node. |
|
11358 |
|
11359 Creator: IBM |
|
11360 Autor Jenny Hsu |
|
11361 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11362 " |
|
11363 | |
|
11364 doc "Document" |
|
11365 varList "NodeList" |
|
11366 varElem "Element" |
|
11367 entRef "EntityReference" |
|
11368 entRefChild1 "ProcessingInstruction" |
|
11369 entRefPosition "SmallInteger" |
|
11370 entRefChild1Position "SmallInteger" |
|
11371 | |
|
11372 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11373 "if" |
|
11374 false "no template for element implementationAttribute" ifTrue: [ |
|
11375 ]. |
|
11376 entRefChild1 := entRef lastChild. |
|
11377 self assert: entRefChild1 notNil. |
|
11378 entRefPosition := entRef compareDocumentPosition:entRefChild1. |
|
11379 self assert: ( entRefPosition = 20 ). |
|
11380 entRefChild1Position := entRefChild1 compareDocumentPosition:entRef. |
|
11381 self assert: ( entRefChild1Position = 10 ). |
|
11382 |
|
11383 ! |
|
11384 |
|
11385 test_nodecomparedocumentposition28 |
|
11386 " |
|
11387 Using compareDocumentPosition check the document position of the EntityReference node ent4's |
|
11388 first child and last child. Invoke compareDocumentPositon on first child with last child as a parameter |
|
11389 should return FOLLOWING, and should return PRECEDING vice versa. |
|
11390 |
|
11391 Creator: IBM |
|
11392 Autor Jenny Hsu |
|
11393 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11394 " |
|
11395 | |
|
11396 doc "Document" |
|
11397 varList "NodeList" |
|
11398 varElem "Element" |
|
11399 entRef "EntityReference" |
|
11400 entRefChild1 "Element" |
|
11401 entRefChild2 "ProcessingInstruction" |
|
11402 entRefChild1Position "SmallInteger" |
|
11403 entRefChild2Position "SmallInteger" |
|
11404 | |
|
11405 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11406 "if" |
|
11407 false "no template for element implementationAttribute" ifTrue: [ |
|
11408 ]. |
|
11409 entRefChild1 := entRef firstChild. |
|
11410 self assert: entRefChild1 notNil. |
|
11411 entRefChild2 := entRef lastChild. |
|
11412 self assert: entRefChild2 notNil. |
|
11413 entRefChild1Position := entRefChild1 compareDocumentPosition:entRefChild2. |
|
11414 self assert: ( entRefChild1Position = 4 ). |
|
11415 entRefChild2Position := entRefChild2 compareDocumentPosition:entRefChild1. |
|
11416 self assert: ( entRefChild2Position = 2 ). |
|
11417 |
|
11418 ! |
|
11419 |
|
11420 test_nodecomparedocumentposition29 |
|
11421 " |
|
11422 Create two entity reference nodes. Using compareDocumentPosition to check if the child of the first Entity |
|
11423 Ref node precedes the child of the second Entity Ref node, and that the child of the second Entity Ref node |
|
11424 follows the child of the first Entity Ref node. |
|
11425 |
|
11426 Creator: IBM |
|
11427 Autor Jenny Hsu |
|
11428 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11429 " |
|
11430 | |
|
11431 doc "Document" |
|
11432 docElem "Element" |
|
11433 entRef1 "EntityReference" |
|
11434 entRef2 "EntityReference" |
|
11435 entRefChild1 "Element" |
|
11436 entRefChild2 "ProcessingInstruction" |
|
11437 entRefChild1Position "SmallInteger" |
|
11438 entRefChild2Position "SmallInteger" |
|
11439 appendedChild "Node" |
|
11440 | |
|
11441 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11442 entRef1 := doc createEntityReference:'ent4'. |
|
11443 entRef2 := doc createEntityReference:'ent4'. |
|
11444 docElem := doc documentElement. |
|
11445 appendedChild := docElem appendChild:entRef1. |
|
11446 appendedChild := docElem appendChild:entRef2. |
|
11447 entRefChild1 := entRef1 firstChild. |
|
11448 self assert: entRefChild1 notNil. |
|
11449 entRefChild2 := entRef2 lastChild. |
|
11450 self assert: entRefChild2 notNil. |
|
11451 entRefChild1Position := entRefChild1 compareDocumentPosition:entRefChild2. |
|
11452 self assert: ( entRefChild1Position = 4 ). |
|
11453 entRefChild2Position := entRefChild2 compareDocumentPosition:entRefChild1. |
|
11454 self assert: ( entRefChild2Position = 2 ). |
|
11455 |
|
11456 ! |
|
11457 |
|
11458 test_nodecomparedocumentposition30 |
|
11459 " |
|
11460 Using compareTreePosition check if comparedocumentposition invoked on the first name with |
|
11461 the first position node as a parameter returns FOLLOWING. |
|
11462 |
|
11463 Creator: IBM |
|
11464 Autor Jenny Hsu |
|
11465 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11466 " |
|
11467 | |
|
11468 doc "Document" |
|
11469 nameList "NodeList" |
|
11470 positionList "NodeList" |
|
11471 strong "Element" |
|
11472 code "Element" |
|
11473 namePosition "SmallInteger" |
|
11474 | |
|
11475 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11476 nameList := doc getElementsByTagName: 'strong'. |
|
11477 strong := nameList item:0. |
|
11478 positionList := doc getElementsByTagName: 'code'. |
|
11479 code := positionList item:0. |
|
11480 namePosition := code compareDocumentPosition:strong. |
|
11481 self assert: ( namePosition = 2 ). |
|
11482 |
|
11483 ! |
|
11484 |
|
11485 test_nodecomparedocumentposition31 |
|
11486 " |
|
11487 Using compareDocumentPosition to check if invoking the method on the first name node with |
|
11488 a new node appended to the second position node as a parameter is FOLLOWING, and is PRECEDING vice versa |
|
11489 |
|
11490 Creator: IBM |
|
11491 Autor Jenny Hsu |
|
11492 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11493 " |
|
11494 | |
|
11495 doc "Document" |
|
11496 nameList "NodeList" |
|
11497 positionList "NodeList" |
|
11498 strong "Element" |
|
11499 code "Element" |
|
11500 newElem "Element" |
|
11501 namePosition "SmallInteger" |
|
11502 elemPosition "SmallInteger" |
|
11503 appendedChild "Node" |
|
11504 | |
|
11505 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11506 nameList := doc getElementsByTagName: 'strong'. |
|
11507 strong := nameList item:0. |
|
11508 positionList := doc getElementsByTagName: 'code'. |
|
11509 code := positionList item:1. |
|
11510 newElem := doc createElement:'br' ns:'http://www.w3.org/1999/xhtml'. |
|
11511 appendedChild := code appendChild:newElem. |
|
11512 namePosition := strong compareDocumentPosition:newElem. |
|
11513 self assert: ( namePosition = 4 ). |
|
11514 elemPosition := newElem compareDocumentPosition:strong. |
|
11515 self assert: ( elemPosition = 2 ). |
|
11516 |
|
11517 ! |
|
11518 |
|
11519 test_nodecomparedocumentposition32 |
|
11520 " |
|
11521 Using compareDocumentPosition to check if the document position returned by comparing the first name with |
|
11522 a first position node of another document reference and adopted by the first as a parameter is FOLLOWING. |
|
11523 |
|
11524 Creator: IBM |
|
11525 Autor Jenny Hsu |
|
11526 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11527 " |
|
11528 | |
|
11529 doc "Document" |
|
11530 doc2 "Document" |
|
11531 nameList "NodeList" |
|
11532 positionList "NodeList" |
|
11533 strong "Element" |
|
11534 code "Element" |
|
11535 documentPosition "SmallInteger" |
|
11536 | |
|
11537 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11538 self assert:false description:'Method "assign" is not supported yet'. |
|
11539 nameList := doc getElementsByTagName: 'strong'. |
|
11540 strong := nameList item:0. |
|
11541 positionList := doc2 getElementsByTagName: 'code'. |
|
11542 code := positionList item:0. |
|
11543 documentPosition := strong compareDocumentPosition:code. |
|
11544 self assert: ( documentPosition = 4 ). |
|
11545 |
|
11546 ! |
|
11547 |
|
11548 test_nodecomparedocumentposition33 |
|
11549 " |
|
11550 Create a new Element node, add a new atttribute node to it. Compare the position |
|
11551 of the Element and the Document. This should return disconnected, implementation specific, and that |
|
11552 the order of these two nodes is preserved. |
|
11553 Also compare the position of the Element node with respect to the Attr node and this should |
|
11554 be PRECEDING and contains, and the Attr node follows and is contained by the Element node |
|
11555 |
|
11556 Creator: IBM |
|
11557 Autor Jenny Hsu |
|
11558 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11559 " |
|
11560 | |
|
11561 doc "Document" |
|
11562 elem "Element" |
|
11563 attr "Attr" |
|
11564 position1 "SmallInteger" |
|
11565 position2 "SmallInteger" |
|
11566 position3 "SmallInteger" |
|
11567 position4 "SmallInteger" |
|
11568 position5 "SmallInteger" |
|
11569 replacedAttr "Attr" |
|
11570 | |
|
11571 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11572 elem := doc createElement:'br' ns:'http://www.w3.org/1999/xhtml'. |
|
11573 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
11574 replacedAttr := elem setAttributeNodeNS: attr. |
|
11575 position4 := elem compareDocumentPosition:attr. |
|
11576 self assert: ( position4 = 20 ). |
|
11577 position5 := attr compareDocumentPosition:elem. |
|
11578 self assert: ( position5 = 10 ). |
|
11579 position1 := doc compareDocumentPosition:elem. |
|
11580 self assert: ( position1 = 33 ). |
|
11581 position2 := elem compareDocumentPosition:doc. |
|
11582 self assert: (position2 bitAnd: 2) == (position1 bitAnd: 2). |
|
11583 self assert: (position2 bitAnd: 4) == (position1 bitAnd: 4). |
|
11584 self assert: ( position2 = 33 ). |
|
11585 position3 := doc compareDocumentPosition:elem. |
|
11586 self assert: ( position3 = position1 ). |
|
11587 |
|
11588 ! |
|
11589 |
|
11590 test_nodecomparedocumentposition34 |
|
11591 " |
|
11592 Create a new Element node, add new Text, Element and Processing Instruction nodes to it. |
|
11593 Using compareDocumentPosition, compare the position of the Element with respect to the Text |
|
11594 and the Text with respect to the Processing Instruction. |
|
11595 |
|
11596 Creator: IBM |
|
11597 Autor Jenny Hsu |
|
11598 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11599 " |
|
11600 | |
|
11601 doc "Document" |
|
11602 elemMain "Element" |
|
11603 elem "Element" |
|
11604 txt "Text" |
|
11605 pi "ProcessingInstruction" |
|
11606 elementToTxtPosition "SmallInteger" |
|
11607 txtToPiPosition "SmallInteger" |
|
11608 appendedChild "Node" |
|
11609 | |
|
11610 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11611 elemMain := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
11612 elem := doc createElement:'br' ns:'http://www.w3.org/1999/xhtml'. |
|
11613 txt := doc createTextNode:'TEXT'. |
|
11614 pi := doc createProcessingInstruction:'PIT' data:'PID'. |
|
11615 appendedChild := elemMain appendChild:txt. |
|
11616 appendedChild := elemMain appendChild:elem. |
|
11617 appendedChild := elemMain appendChild:pi. |
|
11618 elementToTxtPosition := txt compareDocumentPosition:elem. |
|
11619 self assert: ( elementToTxtPosition = 4 ). |
|
11620 txtToPiPosition := pi compareDocumentPosition:txt. |
|
11621 self assert: ( txtToPiPosition = 2 ). |
|
11622 |
|
11623 ! |
|
11624 |
|
11625 test_nodecomparedocumentposition35 |
|
11626 " |
|
11627 Using compareDocumentPosition to check if the Element contains and precedes its default attribute |
|
11628 and that the attribute follows and iscontained by the Element |
|
11629 |
|
11630 Creator: IBM |
|
11631 Autor Jenny Hsu |
|
11632 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11633 " |
|
11634 | |
|
11635 doc "Document" |
|
11636 elemList "NodeList" |
|
11637 elem "Element" |
|
11638 attr "Attr" |
|
11639 elementPosition "SmallInteger" |
|
11640 attrPosition "SmallInteger" |
|
11641 | |
|
11642 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11643 elemList := doc getElementsByTagName: 'p'. |
|
11644 elem := elemList item:3. |
|
11645 attr := elem getAttributeNode:'dir'. |
|
11646 elementPosition := elem compareDocumentPosition:attr. |
|
11647 self assert: ( elementPosition = 20 ). |
|
11648 attrPosition := attr compareDocumentPosition:elem. |
|
11649 self assert: ( attrPosition = 10 ). |
|
11650 |
|
11651 ! |
|
11652 |
|
11653 test_nodecomparedocumentposition36 |
|
11654 " |
|
11655 Using compareDocumentPosition to check if the document position of an Attribute compared with |
|
11656 the element that follows its parent as a parameter is FOLLOWING, and is PRECEDING |
|
11657 vice versa. |
|
11658 |
|
11659 Creator: IBM |
|
11660 Autor Jenny Hsu |
|
11661 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11662 " |
|
11663 | |
|
11664 doc "Document" |
|
11665 elemList "NodeList" |
|
11666 elem "Element" |
|
11667 elemListFollows "NodeList" |
|
11668 elemFollows "Element" |
|
11669 attr "Attr" |
|
11670 attrPosition "SmallInteger" |
|
11671 elemFollowsPosition "SmallInteger" |
|
11672 | |
|
11673 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11674 elemList := doc getElementsByTagName: 'p'. |
|
11675 elem := elemList item:3. |
|
11676 attr := elem getAttributeNode:'dir'. |
|
11677 elemListFollows := doc getElementsByTagName: 'strong'. |
|
11678 elemFollows := elemListFollows item:3. |
|
11679 attrPosition := attr compareDocumentPosition:elemFollows. |
|
11680 self assert: ( attrPosition = 4 ). |
|
11681 elemFollowsPosition := elemFollows compareDocumentPosition:attr. |
|
11682 self assert: ( elemFollowsPosition = 2 ). |
|
11683 |
|
11684 ! |
|
11685 |
|
11686 test_nodecomparedocumentposition37 |
|
11687 " |
|
11688 Using compareDocumentPosition to check if the document position of the first class attribute |
|
11689 of the element acronym when compared with the elements text content as a parameter is |
|
11690 is FOLLOWING, and is PRECEDING vice versa. |
|
11691 |
|
11692 Creator: IBM |
|
11693 Autor Neil Delima |
|
11694 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11695 " |
|
11696 | |
|
11697 doc "Document" |
|
11698 elemList "NodeList" |
|
11699 elem "Element" |
|
11700 txt "Text" |
|
11701 attr "Attr" |
|
11702 attrPosition "SmallInteger" |
|
11703 txtPosition "SmallInteger" |
|
11704 | |
|
11705 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11706 elemList := doc getElementsByTagName: 'acronym'. |
|
11707 elem := elemList item:3. |
|
11708 attr := elem getAttributeNode:'class'. |
|
11709 txt := elem firstChild. |
|
11710 attrPosition := attr compareDocumentPosition:txt. |
|
11711 self assert: ( attrPosition = 4 ). |
|
11712 txtPosition := txt compareDocumentPosition:attr. |
|
11713 self assert: ( txtPosition = 2 ). |
|
11714 |
|
11715 ! |
|
11716 |
|
11717 test_nodecomparedocumentposition38 |
|
11718 " |
|
11719 Using compareDocumentPosition to check if the class's attribute contains and precedes it's content, |
|
11720 and the content node is contained and follows the attribute node. |
|
11721 |
|
11722 Creator: IBM |
|
11723 Autor Jenny Hsu |
|
11724 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11725 " |
|
11726 | |
|
11727 doc "Document" |
|
11728 elemList "NodeList" |
|
11729 elem "Element" |
|
11730 txt "Text" |
|
11731 attr "Attr" |
|
11732 attrPosition "SmallInteger" |
|
11733 attrChildPosition "SmallInteger" |
|
11734 | |
|
11735 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11736 elemList := doc getElementsByTagName: 'acronym'. |
|
11737 elem := elemList item:3. |
|
11738 attr := elem getAttributeNode:'class'. |
|
11739 txt := attr firstChild. |
|
11740 attrPosition := attr compareDocumentPosition:txt. |
|
11741 self assert: ( attrPosition = 20 ). |
|
11742 attrChildPosition := txt compareDocumentPosition:attr. |
|
11743 self assert: ( attrChildPosition = 10 ). |
|
11744 |
|
11745 ! |
|
11746 |
|
11747 test_nodecomparedocumentposition39 |
|
11748 " |
|
11749 Using compareDocumentPosition to check if the document position of the class's attribute |
|
11750 when compared with the local1 attribute node is implementation_specific. |
|
11751 |
|
11752 Creator: IBM |
|
11753 Autor Jenny Hsu |
|
11754 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11755 " |
|
11756 | |
|
11757 doc "Document" |
|
11758 elemList "NodeList" |
|
11759 elem "Element" |
|
11760 attr1 "Attr" |
|
11761 attr2 "Attr" |
|
11762 attrPosition "SmallInteger" |
|
11763 swappedPosition "SmallInteger" |
|
11764 | |
|
11765 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11766 elemList := doc getElementsByTagName: 'acronym'. |
|
11767 elem := elemList item:3. |
|
11768 attr1 := elem getAttributeNode:'class'. |
|
11769 attr2 := elem getAttributeNode:'xsi:noNamespaceSchemaLocation'. |
|
11770 attrPosition := attr1 compareDocumentPosition:attr2. |
|
11771 self assert: ( attrPosition = 32 ). |
|
11772 self assert: ( attrPosition = 0 ). |
|
11773 self assert: (attrPosition bitAnd: 6) == (0 bitAnd: 6). |
|
11774 swappedPosition := attr2 compareDocumentPosition:attr1. |
|
11775 self assert: (attrPosition bitAnd: 2) == (swappedPosition bitAnd: 2). |
|
11776 self assert: (attrPosition bitAnd: 4) == (swappedPosition bitAnd: 4). |
|
11777 |
|
11778 ! |
|
11779 |
|
11780 test_nodecomparedocumentposition40 |
|
11781 " |
|
11782 Using compareDocumentPosition to check if the document position of the class's attribute |
|
11783 when compared with a new attribute node is implementation_specific |
|
11784 |
|
11785 Creator: IBM |
|
11786 Autor Jenny Hsu |
|
11787 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition |
|
11788 " |
|
11789 | |
|
11790 doc "Document" |
|
11791 elemList "NodeList" |
|
11792 elem "Element" |
|
11793 attr1 "Attr" |
|
11794 attr2 "Attr" |
|
11795 attrPosition "SmallInteger" |
|
11796 swappedPosition "SmallInteger" |
|
11797 | |
|
11798 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
11799 elemList := doc getElementsByTagName: 'acronym'. |
|
11800 elem := elemList item:3. |
|
11801 attr1 := elem getAttributeNode:'class'. |
|
11802 elem setAttribute: 'xml:lang' ns: 'http://www.w3.org/XML/1998/namespace' value: 'FR-fr'. |
|
11803 attr2 := elem getAttributeNode:'xml:lang'. |
|
11804 attrPosition := attr1 compareDocumentPosition:attr2. |
|
11805 self assert: ( attrPosition = 32 ). |
|
11806 self assert: ( attrPosition = 0 ). |
|
11807 self assert: (attrPosition bitAnd: 6) == (0 bitAnd: 6). |
|
11808 swappedPosition := attr2 compareDocumentPosition:attr1. |
|
11809 self assert: (attrPosition bitAnd: 2) == (swappedPosition bitAnd: 2). |
|
11810 self assert: (attrPosition bitAnd: 4) == (swappedPosition bitAnd: 4). |
|
11811 |
|
11812 ! |
|
11813 |
|
11814 test_nodegetbaseuri01 |
|
11815 " |
|
11816 Call Node.getBaseURI() on a test document. Should be not-null and same as Document.getDocumentURI(). |
|
11817 |
|
11818 Creator: IBM |
|
11819 Autor Neil Delima |
|
11820 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
11821 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
11822 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Document |
|
11823 " |
|
11824 | |
|
11825 doc "Document" |
|
11826 baseURI "String" |
|
11827 documentURI "String" |
|
11828 | |
|
11829 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
11830 baseURI := doc baseURI. |
|
11831 self assert: baseURI = 'barfoo'. |
|
11832 documentURI := doc documentURI. |
|
11833 self assert: ( baseURI = documentURI ). |
|
11834 |
|
11835 ! |
|
11836 |
|
11837 test_nodegetbaseuri02 |
|
11838 " |
|
11839 Using getBaseURI check if the baseURI attribute of a new Document node is null |
|
11840 and if affected by changes in Document.documentURI. |
|
11841 |
|
11842 Creator: IBM |
|
11843 Autor Neil Delima |
|
11844 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
11845 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
11846 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Document |
|
11847 " |
|
11848 | |
|
11849 doc "Document" |
|
11850 newDoc "Document" |
|
11851 domImpl "DOMImplementation" |
|
11852 baseURI "String" |
|
11853 rootNS "String" |
|
11854 rootName "String" |
|
11855 docElem "Element" |
|
11856 nullDocType "DocumentType" |
|
11857 | |
|
11858 nullDocType := nil. |
|
11859 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
11860 docElem := doc documentElement. |
|
11861 rootNS := docElem namespaceURI. |
|
11862 rootName := docElem tagName. |
|
11863 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
11864 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
11865 baseURI := newDoc baseURI. |
|
11866 self assert: baseURI isNil. |
|
11867 newDoc documentURI:'http://www.example.com/sample.xml'. |
|
11868 baseURI := newDoc baseURI. |
|
11869 self assert: ( baseURI asLowercase = 'http://www.example.com/sample.xml' asLowercase ). |
|
11870 |
|
11871 ! |
|
11872 |
|
11873 test_nodegetbaseuri03 |
|
11874 " |
|
11875 Check that Node.baseURI is null for a DocumentType as defined in the Infoset Mapping (Appendix C). |
|
11876 |
|
11877 Creator: IBM |
|
11878 Autor Neil Delima |
|
11879 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
11880 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
11881 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2DocumentType |
|
11882 " |
|
11883 | |
|
11884 doc "Document" |
|
11885 docType "DocumentType" |
|
11886 baseURI "String" |
|
11887 | |
|
11888 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
11889 docType := doc doctype. |
|
11890 baseURI := docType baseURI. |
|
11891 self assert: baseURI isNil. |
|
11892 |
|
11893 ! |
|
11894 |
|
11895 test_nodegetbaseuri04 |
|
11896 " |
|
11897 Node.baseURI for a document element without an xml:base attribute should be same as Document.documentURI. |
|
11898 |
|
11899 Creator: IBM |
|
11900 Autor Neil Delima |
|
11901 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
11902 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
11903 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Document |
|
11904 " |
|
11905 | |
|
11906 doc "Document" |
|
11907 docElem "Element" |
|
11908 baseURI "String" |
|
11909 documentURI "String" |
|
11910 | |
|
11911 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
11912 docElem := doc documentElement. |
|
11913 baseURI := docElem baseURI. |
|
11914 self assert: baseURI = 'barfoo'. |
|
11915 documentURI := doc documentURI. |
|
11916 self assert: ( baseURI = documentURI ). |
|
11917 |
|
11918 ! |
|
11919 |
|
11920 test_nodegetbaseuri05 |
|
11921 " |
|
11922 Using getBaseURI check if the baseURI attribute of this DocumentElement is http://www.w3.org/DOM/L3Test. |
|
11923 |
|
11924 Creator: IBM |
|
11925 Autor Neil Delima |
|
11926 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
11927 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
11928 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Element |
|
11929 " |
|
11930 | |
|
11931 doc "Document" |
|
11932 docElem "Element" |
|
11933 baseURI "String" |
|
11934 | |
|
11935 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
11936 docElem := doc documentElement. |
|
11937 baseURI := docElem baseURI. |
|
11938 self assert: ( baseURI = 'http://www.w3.org/DOM/L3Test' ). |
|
11939 |
|
11940 ! |
|
11941 |
|
11942 test_nodegetbaseuri06 |
|
11943 " |
|
11944 TODO Clarification: Create a new Element in this document. Since its baseURI should be the baseURI of |
|
11945 the Document Entity which I assume is not null, using getBaseURI check if the baseURI |
|
11946 attribute of this Element node is not null.??? |
|
11947 |
|
11948 Creator: IBM |
|
11949 Autor Neil Delima |
|
11950 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
11951 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
11952 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Element |
|
11953 " |
|
11954 | |
|
11955 doc "Document" |
|
11956 newElement "Element" |
|
11957 baseURI "String" |
|
11958 | |
|
11959 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
11960 newElement := doc createElement:'br' ns:'http://www.w3.org/1999/xhtml'. |
|
11961 baseURI := doc baseURI. |
|
11962 self assert: baseURI notNil. |
|
11963 |
|
11964 ! |
|
11965 |
|
11966 test_nodegetbaseuri07 |
|
11967 " |
|
11968 Append a created element to a document and check that its baseURI |
|
11969 is inherited from its parent. |
|
11970 |
|
11971 Creator: IBM |
|
11972 Autor Neil Delima |
|
11973 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
11974 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
11975 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Element |
|
11976 " |
|
11977 | |
|
11978 doc "Document" |
|
11979 newElement "Element" |
|
11980 baseURI "String" |
|
11981 appended "Node" |
|
11982 bodyList "NodeList" |
|
11983 bodyElem "Element" |
|
11984 htmlNS "String" |
|
11985 | |
|
11986 htmlNS := 'http://www.w3.org/1999/xhtml'. |
|
11987 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
11988 bodyList := doc getElementsByTagName: 'body'. |
|
11989 bodyElem := bodyList item:0. |
|
11990 newElement := doc createElement:'meta' ns:htmlNS. |
|
11991 newElement setAttribute:'content' value:'text/xml'. |
|
11992 appended := bodyElem appendChild:newElement. |
|
11993 baseURI := newElement baseURI. |
|
11994 self assert: ( baseURI = 'http://www.w3.org/DOM/EmployeeID' ). |
|
11995 |
|
11996 ! |
|
11997 |
|
11998 test_nodegetbaseuri09 |
|
11999 " |
|
12000 Get the baseURI value on an element with an explicit xml:base attribute. |
|
12001 |
|
12002 Creator: IBM |
|
12003 Autor Neil Delima |
|
12004 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12005 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12006 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Element |
|
12007 " |
|
12008 | |
|
12009 doc "Document" |
|
12010 bodyElem "Element" |
|
12011 bodyList "NodeList" |
|
12012 baseURI "String" |
|
12013 | |
|
12014 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
12015 bodyList := doc getElementsByTagName: 'body'. |
|
12016 bodyElem := bodyList item:0. |
|
12017 baseURI := bodyElem baseURI. |
|
12018 self assert: ( baseURI = 'http://www.w3.org/DOM/EmployeeID' ). |
|
12019 |
|
12020 ! |
|
12021 |
|
12022 test_nodegetbaseuri10 |
|
12023 " |
|
12024 Append as a child of this documentElement a new Processing Instruction. Using getBaseURI |
|
12025 check if the baseURI attribute of the new Processing Instruction node is 'http://www.w3.org/DOM/L3Test . |
|
12026 |
|
12027 Creator: IBM |
|
12028 Autor Neil Delima |
|
12029 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12030 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12031 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2ProcessingInstruction |
|
12032 " |
|
12033 | |
|
12034 doc "Document" |
|
12035 docElem "Element" |
|
12036 newPI "ProcessingInstruction" |
|
12037 baseURI "String" |
|
12038 appendedChild "Node" |
|
12039 | |
|
12040 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
12041 docElem := doc documentElement. |
|
12042 newPI := doc createProcessingInstruction:'TARGET' data:'DATA'. |
|
12043 appendedChild := docElem appendChild:newPI. |
|
12044 baseURI := newPI baseURI. |
|
12045 self assert: ( baseURI = 'http://www.w3.org/DOM/L3Test' ). |
|
12046 |
|
12047 ! |
|
12048 |
|
12049 test_nodegetbaseuri11 |
|
12050 " |
|
12051 Import a new Processing Instruction of a new Document after the document element. Using getBaseURI |
|
12052 check if the baseURI attribute of the new Processing Instruction node is the same as Document.documentURI. |
|
12053 |
|
12054 Creator: IBM |
|
12055 Autor Neil Delima |
|
12056 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12057 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12058 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2ProcessingInstruction |
|
12059 " |
|
12060 | |
|
12061 doc "Document" |
|
12062 newDoc "Document" |
|
12063 domImpl "DOMImplementation" |
|
12064 newPI "ProcessingInstruction" |
|
12065 imported "ProcessingInstruction" |
|
12066 baseURI "String" |
|
12067 docURI "String" |
|
12068 appendedChild "Node" |
|
12069 nullDocType "DocumentType" |
|
12070 | |
|
12071 nullDocType := nil. |
|
12072 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
12073 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12074 newDoc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDocType. |
|
12075 newPI := newDoc createProcessingInstruction:'TARGET' data:'DATA'. |
|
12076 imported := doc importNode:newPI deep:true. |
|
12077 appendedChild := doc appendChild:imported. |
|
12078 baseURI := imported baseURI. |
|
12079 self assert: baseURI = 'barfoo_base'. |
|
12080 docURI := doc documentURI. |
|
12081 self assert: ( baseURI = docURI ). |
|
12082 |
|
12083 ! |
|
12084 |
|
12085 test_nodegetbaseuri12 |
|
12086 " |
|
12087 Using getBaseURI verify if the entity epsilon is absolute |
|
12088 and matches the URL of the document entity. |
|
12089 |
|
12090 Creator: IBM |
|
12091 Autor Neil Delima |
|
12092 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12093 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12094 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Entity |
|
12095 " |
|
12096 | |
|
12097 doc "Document" |
|
12098 docType "DocumentType" |
|
12099 entitiesMap "NamedNodeMap" |
|
12100 entity "Entity" |
|
12101 baseURI "String" |
|
12102 | |
|
12103 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
12104 docType := doc doctype. |
|
12105 entitiesMap := docType entities. |
|
12106 entity := entitiesMap getNamedItem:'epsilon'. |
|
12107 baseURI := entity baseURI. |
|
12108 self assert: baseURI = 'hc_staff'. |
|
12109 |
|
12110 ! |
|
12111 |
|
12112 test_nodegetbaseuri13 |
|
12113 " |
|
12114 Using getBaseURI verify if the notation defined in an internal subset |
|
12115 is the base URI of the document. |
|
12116 |
|
12117 Creator: IBM |
|
12118 Autor Neil Delima |
|
12119 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12120 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12121 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Notation |
|
12122 " |
|
12123 | |
|
12124 doc "Document" |
|
12125 docType "DocumentType" |
|
12126 notationsMap "NamedNodeMap" |
|
12127 notation "Notation" |
|
12128 baseURI "String" |
|
12129 docURI "String" |
|
12130 | |
|
12131 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
12132 docType := doc doctype. |
|
12133 notationsMap := docType notations. |
|
12134 notation := notationsMap getNamedItem:'notation1'. |
|
12135 baseURI := notation baseURI. |
|
12136 docURI := doc documentURI. |
|
12137 self assert: ( baseURI = docURI ). |
|
12138 self assert: baseURI = 'hc_staff'. |
|
12139 |
|
12140 ! |
|
12141 |
|
12142 test_nodegetbaseuri14 |
|
12143 " |
|
12144 Using getBaseURI verify if the imported notation notation2 is null. |
|
12145 |
|
12146 Creator: IBM |
|
12147 Autor Neil Delima |
|
12148 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12149 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12150 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Notation |
|
12151 " |
|
12152 | |
|
12153 doc "Document" |
|
12154 newDoc "Document" |
|
12155 docElem "Element" |
|
12156 docElemNS "String" |
|
12157 docElemName "String" |
|
12158 domImpl "DOMImplementation" |
|
12159 docType "DocumentType" |
|
12160 notationsMap "NamedNodeMap" |
|
12161 notation "Notation" |
|
12162 notationImported "Notation" |
|
12163 baseURI "String" |
|
12164 nullDocType "DocumentType" |
|
12165 | |
|
12166 nullDocType := nil. |
|
12167 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
12168 docElem := doc documentElement. |
|
12169 docElemNS := docElem namespaceURI. |
|
12170 docElemName := docElem localName. |
|
12171 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12172 newDoc := domImpl createDocumentNS: docElemNS qualifiedName: docElemName doctype: nullDocType. |
|
12173 docType := doc doctype. |
|
12174 notationsMap := docType notations. |
|
12175 notation := notationsMap getNamedItem:'notation2'. |
|
12176 notationImported := newDoc importNode:notation deep:true. |
|
12177 baseURI := notationImported baseURI. |
|
12178 self assert: baseURI isNil. |
|
12179 |
|
12180 ! |
|
12181 |
|
12182 test_nodegetbaseuri15 |
|
12183 " |
|
12184 Node.getBaseURI for an Attr is null. |
|
12185 |
|
12186 Creator: Curt Arnold |
|
12187 Autor Curt Arnold |
|
12188 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12189 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12190 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Attr |
|
12191 " |
|
12192 | |
|
12193 doc "Document" |
|
12194 baseURI "String" |
|
12195 attrNode "Attr" |
|
12196 bodyList "NodeList" |
|
12197 bodyElem "Element" |
|
12198 | |
|
12199 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
12200 bodyList := doc getElementsByTagName: 'body'. |
|
12201 bodyElem := bodyList item:0. |
|
12202 attrNode := bodyElem getAttributeNode:'id'. |
|
12203 baseURI := attrNode baseURI. |
|
12204 self assert: baseURI isNil. |
|
12205 |
|
12206 ! |
|
12207 |
|
12208 test_nodegetbaseuri16 |
|
12209 " |
|
12210 Node.getBaseURI for an EntityReference to should be the baseURI where the entity declaration occurs. |
|
12211 |
|
12212 Creator: Curt Arnold |
|
12213 Autor Curt Arnold |
|
12214 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12215 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12216 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2EntityReference |
|
12217 " |
|
12218 | |
|
12219 doc "Document" |
|
12220 baseURI "String" |
|
12221 entRef "EntityReference" |
|
12222 pList "NodeList" |
|
12223 pElem "Element" |
|
12224 | |
|
12225 "implementationAttribute not supported: expandEntityReferences" |
|
12226 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
12227 pList := doc getElementsByTagName: 'p'. |
|
12228 pElem := pList item:0. |
|
12229 entRef := pElem lastChild. |
|
12230 baseURI := entRef baseURI. |
|
12231 self assert: baseURI = 'external_barfoo'. |
|
12232 |
|
12233 ! |
|
12234 |
|
12235 test_nodegetbaseuri17 |
|
12236 " |
|
12237 Node.getBaseURI for an text node is null. |
|
12238 |
|
12239 Creator: Curt Arnold |
|
12240 Autor Curt Arnold |
|
12241 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12242 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12243 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Text |
|
12244 " |
|
12245 | |
|
12246 doc "Document" |
|
12247 baseURI "String" |
|
12248 textNode "Text" |
|
12249 pList "NodeList" |
|
12250 pElem "Element" |
|
12251 | |
|
12252 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
12253 pList := doc getElementsByTagName: 'p'. |
|
12254 pElem := pList item:0. |
|
12255 textNode := pElem firstChild. |
|
12256 baseURI := textNode baseURI. |
|
12257 self assert: baseURI isNil. |
|
12258 |
|
12259 ! |
|
12260 |
|
12261 test_nodegetbaseuri18 |
|
12262 " |
|
12263 Node.getBaseURI for an comment node is null. |
|
12264 |
|
12265 Creator: Curt Arnold |
|
12266 Autor Curt Arnold |
|
12267 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12268 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12269 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2Comment |
|
12270 " |
|
12271 | |
|
12272 doc "Document" |
|
12273 baseURI "String" |
|
12274 comment "Comment" |
|
12275 pList "NodeList" |
|
12276 pElem "Element" |
|
12277 | |
|
12278 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_base'). |
|
12279 pList := doc getElementsByTagName: 'p'. |
|
12280 pElem := pList item:0. |
|
12281 comment := pElem nextSibling. |
|
12282 baseURI := comment baseURI. |
|
12283 self assert: baseURI isNil. |
|
12284 |
|
12285 ! |
|
12286 |
|
12287 test_nodegetbaseuri19 |
|
12288 " |
|
12289 Checks baseURI for a text node is null. |
|
12290 |
|
12291 Creator: Curt Arnold |
|
12292 Autor Curt Arnold |
|
12293 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12294 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12295 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2DocumentType |
|
12296 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2EntityReference |
|
12297 " |
|
12298 | |
|
12299 doc "Document" |
|
12300 baseURI "String" |
|
12301 entBaseURI "String" |
|
12302 entRef "EntityReference" |
|
12303 pList "NodeList" |
|
12304 pElem "Element" |
|
12305 textNode "Text" |
|
12306 | |
|
12307 ^self. "Validation not supported" |
|
12308 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
12309 pList := doc getElementsByTagName: 'p'. |
|
12310 pElem := pList item:0. |
|
12311 self assert: pElem notNil. |
|
12312 "if" |
|
12313 false "no template for element implementationAttribute" ifTrue: [ |
|
12314 ]. |
|
12315 baseURI := textNode baseURI. |
|
12316 self assert: baseURI isNil. |
|
12317 |
|
12318 ! |
|
12319 |
|
12320 test_nodegetbaseuri20 |
|
12321 " |
|
12322 baseURI for an element from an entity reference should be the URI of the |
|
12323 external entity if there is now xml:base attribute. |
|
12324 |
|
12325 Creator: Curt Arnold |
|
12326 Autor Curt Arnold |
|
12327 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-baseURI |
|
12328 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=419 |
|
12329 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/infoset-mapping#Infoset2EntityReference |
|
12330 " |
|
12331 | |
|
12332 doc "Document" |
|
12333 baseURI "String" |
|
12334 pList "NodeList" |
|
12335 pElem "Element" |
|
12336 | |
|
12337 ^self. "Validation not supported" |
|
12338 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'external_barfoo'). |
|
12339 pList := doc getElementsByTagName: 'p'. |
|
12340 pElem := pList item:2. |
|
12341 self assert: pElem notNil. |
|
12342 baseURI := pElem baseURI. |
|
12343 self assert: baseURI = 'external_widget'. |
|
12344 |
|
12345 ! |
|
12346 |
|
12347 test_nodegetfeature01 |
|
12348 " |
|
12349 Check implementation of Node.getFeature on Document. |
|
12350 |
|
12351 Creator: Curt Arnold |
|
12352 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12353 " |
|
12354 | |
|
12355 doc "Document" |
|
12356 node "Node" |
|
12357 nullVersion "String" |
|
12358 featureImpl "Node" |
|
12359 isSupported "Boolean" |
|
12360 domImpl "DOMImplementation" |
|
12361 | |
|
12362 nullVersion := nil. |
|
12363 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12364 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12365 self assert:false description:'Method "assign" is not supported yet'. |
|
12366 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12367 self assert: featureImpl == node. |
|
12368 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12369 self assert: featureImpl == node. |
|
12370 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12371 self assert: featureImpl == node. |
|
12372 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12373 self assert: featureImpl isNil. |
|
12374 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12375 self assert: featureImpl == node. |
|
12376 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12377 self assert: featureImpl == node. |
|
12378 isSupported := node isSupported:'XML' version:nullVersion. |
|
12379 featureImpl := doc getFeature:'XML' version:nullVersion. |
|
12380 "if" |
|
12381 (isSupported) ifTrue: [ |
|
12382 ]. |
|
12383 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12384 featureImpl := doc getFeature:'SVG' version:nullVersion. |
|
12385 "if" |
|
12386 (isSupported) ifTrue: [ |
|
12387 ]. |
|
12388 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12389 featureImpl := doc getFeature:'HTML' version:nullVersion. |
|
12390 "if" |
|
12391 (isSupported) ifTrue: [ |
|
12392 ]. |
|
12393 isSupported := node isSupported:'Events' version:nullVersion. |
|
12394 featureImpl := doc getFeature:'Events' version:nullVersion. |
|
12395 "if" |
|
12396 (isSupported) ifTrue: [ |
|
12397 ]. |
|
12398 isSupported := node isSupported:'LS' version:nullVersion. |
|
12399 featureImpl := doc getFeature:'LS' version:nullVersion. |
|
12400 "if" |
|
12401 (isSupported) ifTrue: [ |
|
12402 ]. |
|
12403 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12404 featureImpl := doc getFeature:'LS-Async' version:nullVersion. |
|
12405 "if" |
|
12406 (isSupported) ifTrue: [ |
|
12407 ]. |
|
12408 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12409 featureImpl := doc getFeature:'XPath' version:nullVersion. |
|
12410 "if" |
|
12411 (isSupported) ifTrue: [ |
|
12412 ]. |
|
12413 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12414 featureImpl := doc getFeature:'HTML' version:nullVersion. |
|
12415 "if" |
|
12416 (isSupported) ifTrue: [ |
|
12417 ]. |
|
12418 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12419 featureImpl := doc getFeature:'SVG' version:nullVersion. |
|
12420 "if" |
|
12421 (isSupported) ifTrue: [ |
|
12422 ]. |
|
12423 |
|
12424 ! |
|
12425 |
|
12426 test_nodegetfeature02 |
|
12427 " |
|
12428 Check implementation of Node.getFeature on DocumentFragment. |
|
12429 |
|
12430 Creator: Curt Arnold |
|
12431 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12432 " |
|
12433 | |
|
12434 doc "Document" |
|
12435 node "Node" |
|
12436 nullVersion "String" |
|
12437 featureImpl "Node" |
|
12438 isSupported "Boolean" |
|
12439 domImpl "DOMImplementation" |
|
12440 | |
|
12441 nullVersion := nil. |
|
12442 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12443 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12444 node := doc createDocumentFragment. |
|
12445 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12446 self assert: featureImpl == node. |
|
12447 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12448 self assert: featureImpl == node. |
|
12449 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12450 self assert: featureImpl == node. |
|
12451 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12452 self assert: featureImpl isNil. |
|
12453 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12454 self assert: featureImpl == node. |
|
12455 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12456 self assert: featureImpl == node. |
|
12457 isSupported := node isSupported:'XML' version:nullVersion. |
|
12458 featureImpl := node getFeature:'XML' version:nullVersion. |
|
12459 "if" |
|
12460 (isSupported) ifTrue: [ |
|
12461 ]. |
|
12462 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12463 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12464 "if" |
|
12465 (isSupported) ifTrue: [ |
|
12466 ]. |
|
12467 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12468 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12469 "if" |
|
12470 (isSupported) ifTrue: [ |
|
12471 ]. |
|
12472 isSupported := node isSupported:'Events' version:nullVersion. |
|
12473 featureImpl := node getFeature:'Events' version:nullVersion. |
|
12474 "if" |
|
12475 (isSupported) ifTrue: [ |
|
12476 ]. |
|
12477 isSupported := node isSupported:'LS' version:nullVersion. |
|
12478 featureImpl := node getFeature:'LS' version:nullVersion. |
|
12479 "if" |
|
12480 (isSupported) ifTrue: [ |
|
12481 ]. |
|
12482 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12483 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
12484 "if" |
|
12485 (isSupported) ifTrue: [ |
|
12486 ]. |
|
12487 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12488 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
12489 "if" |
|
12490 (isSupported) ifTrue: [ |
|
12491 ]. |
|
12492 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12493 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12494 "if" |
|
12495 (isSupported) ifTrue: [ |
|
12496 ]. |
|
12497 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12498 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12499 "if" |
|
12500 (isSupported) ifTrue: [ |
|
12501 ]. |
|
12502 |
|
12503 ! |
|
12504 |
|
12505 test_nodegetfeature03 |
|
12506 " |
|
12507 Check implementation of Node.getFeature on DocumentType. |
|
12508 |
|
12509 Creator: Curt Arnold |
|
12510 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12511 " |
|
12512 | |
|
12513 doc "Document" |
|
12514 node "Node" |
|
12515 nullVersion "String" |
|
12516 featureImpl "Node" |
|
12517 isSupported "Boolean" |
|
12518 domImpl "DOMImplementation" |
|
12519 | |
|
12520 nullVersion := nil. |
|
12521 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12522 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12523 node := doc doctype. |
|
12524 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12525 self assert: featureImpl == node. |
|
12526 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12527 self assert: featureImpl == node. |
|
12528 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12529 self assert: featureImpl == node. |
|
12530 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12531 self assert: featureImpl isNil. |
|
12532 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12533 self assert: featureImpl == node. |
|
12534 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12535 self assert: featureImpl == node. |
|
12536 isSupported := node isSupported:'XML' version:nullVersion. |
|
12537 featureImpl := node getFeature:'XML' version:nullVersion. |
|
12538 "if" |
|
12539 (isSupported) ifTrue: [ |
|
12540 ]. |
|
12541 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12542 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12543 "if" |
|
12544 (isSupported) ifTrue: [ |
|
12545 ]. |
|
12546 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12547 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12548 "if" |
|
12549 (isSupported) ifTrue: [ |
|
12550 ]. |
|
12551 isSupported := node isSupported:'Events' version:nullVersion. |
|
12552 featureImpl := node getFeature:'Events' version:nullVersion. |
|
12553 "if" |
|
12554 (isSupported) ifTrue: [ |
|
12555 ]. |
|
12556 isSupported := node isSupported:'LS' version:nullVersion. |
|
12557 featureImpl := node getFeature:'LS' version:nullVersion. |
|
12558 "if" |
|
12559 (isSupported) ifTrue: [ |
|
12560 ]. |
|
12561 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12562 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
12563 "if" |
|
12564 (isSupported) ifTrue: [ |
|
12565 ]. |
|
12566 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12567 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
12568 "if" |
|
12569 (isSupported) ifTrue: [ |
|
12570 ]. |
|
12571 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12572 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12573 "if" |
|
12574 (isSupported) ifTrue: [ |
|
12575 ]. |
|
12576 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12577 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12578 "if" |
|
12579 (isSupported) ifTrue: [ |
|
12580 ]. |
|
12581 |
|
12582 ! |
|
12583 |
|
12584 test_nodegetfeature04 |
|
12585 " |
|
12586 Check implementation of Node.getFeature on EntityReference. |
|
12587 |
|
12588 Creator: Curt Arnold |
|
12589 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12590 " |
|
12591 | |
|
12592 doc "Document" |
|
12593 node "Node" |
|
12594 nullVersion "String" |
|
12595 featureImpl "Node" |
|
12596 isSupported "Boolean" |
|
12597 domImpl "DOMImplementation" |
|
12598 | |
|
12599 nullVersion := nil. |
|
12600 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12601 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12602 node := doc createEntityReference:'ent1'. |
|
12603 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12604 self assert: featureImpl == node. |
|
12605 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12606 self assert: featureImpl == node. |
|
12607 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12608 self assert: featureImpl == node. |
|
12609 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12610 self assert: featureImpl isNil. |
|
12611 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12612 self assert: featureImpl == node. |
|
12613 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12614 self assert: featureImpl == node. |
|
12615 isSupported := node isSupported:'XML' version:nullVersion. |
|
12616 featureImpl := node getFeature:'XML' version:nullVersion. |
|
12617 "if" |
|
12618 (isSupported) ifTrue: [ |
|
12619 ]. |
|
12620 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12621 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12622 "if" |
|
12623 (isSupported) ifTrue: [ |
|
12624 ]. |
|
12625 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12626 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12627 "if" |
|
12628 (isSupported) ifTrue: [ |
|
12629 ]. |
|
12630 isSupported := node isSupported:'Events' version:nullVersion. |
|
12631 featureImpl := node getFeature:'Events' version:nullVersion. |
|
12632 "if" |
|
12633 (isSupported) ifTrue: [ |
|
12634 ]. |
|
12635 isSupported := node isSupported:'LS' version:nullVersion. |
|
12636 featureImpl := node getFeature:'LS' version:nullVersion. |
|
12637 "if" |
|
12638 (isSupported) ifTrue: [ |
|
12639 ]. |
|
12640 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12641 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
12642 "if" |
|
12643 (isSupported) ifTrue: [ |
|
12644 ]. |
|
12645 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12646 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
12647 "if" |
|
12648 (isSupported) ifTrue: [ |
|
12649 ]. |
|
12650 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12651 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12652 "if" |
|
12653 (isSupported) ifTrue: [ |
|
12654 ]. |
|
12655 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12656 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12657 "if" |
|
12658 (isSupported) ifTrue: [ |
|
12659 ]. |
|
12660 |
|
12661 ! |
|
12662 |
|
12663 test_nodegetfeature05 |
|
12664 " |
|
12665 Check implementation of Node.getFeature on Element. |
|
12666 |
|
12667 Creator: Curt Arnold |
|
12668 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12669 " |
|
12670 | |
|
12671 doc "Document" |
|
12672 node "Node" |
|
12673 nullVersion "String" |
|
12674 featureImpl "Node" |
|
12675 isSupported "Boolean" |
|
12676 domImpl "DOMImplementation" |
|
12677 | |
|
12678 nullVersion := nil. |
|
12679 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12680 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12681 node := doc documentElement. |
|
12682 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12683 self assert: featureImpl == node. |
|
12684 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12685 self assert: featureImpl == node. |
|
12686 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12687 self assert: featureImpl == node. |
|
12688 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12689 self assert: featureImpl isNil. |
|
12690 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12691 self assert: featureImpl == node. |
|
12692 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12693 self assert: featureImpl == node. |
|
12694 isSupported := node isSupported:'XML' version:nullVersion. |
|
12695 featureImpl := node getFeature:'XML' version:nullVersion. |
|
12696 "if" |
|
12697 (isSupported) ifTrue: [ |
|
12698 ]. |
|
12699 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12700 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12701 "if" |
|
12702 (isSupported) ifTrue: [ |
|
12703 ]. |
|
12704 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12705 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12706 "if" |
|
12707 (isSupported) ifTrue: [ |
|
12708 ]. |
|
12709 isSupported := node isSupported:'Events' version:nullVersion. |
|
12710 featureImpl := node getFeature:'Events' version:nullVersion. |
|
12711 "if" |
|
12712 (isSupported) ifTrue: [ |
|
12713 ]. |
|
12714 isSupported := node isSupported:'LS' version:nullVersion. |
|
12715 featureImpl := node getFeature:'LS' version:nullVersion. |
|
12716 "if" |
|
12717 (isSupported) ifTrue: [ |
|
12718 ]. |
|
12719 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12720 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
12721 "if" |
|
12722 (isSupported) ifTrue: [ |
|
12723 ]. |
|
12724 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12725 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
12726 "if" |
|
12727 (isSupported) ifTrue: [ |
|
12728 ]. |
|
12729 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12730 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12731 "if" |
|
12732 (isSupported) ifTrue: [ |
|
12733 ]. |
|
12734 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12735 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12736 "if" |
|
12737 (isSupported) ifTrue: [ |
|
12738 ]. |
|
12739 |
|
12740 ! |
|
12741 |
|
12742 test_nodegetfeature06 |
|
12743 " |
|
12744 Check implementation of Node.getFeature on non-namespace attribute. |
|
12745 |
|
12746 Creator: Curt Arnold |
|
12747 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12748 " |
|
12749 | |
|
12750 doc "Document" |
|
12751 node "Node" |
|
12752 nullVersion "String" |
|
12753 featureImpl "Node" |
|
12754 isSupported "Boolean" |
|
12755 domImpl "DOMImplementation" |
|
12756 | |
|
12757 nullVersion := nil. |
|
12758 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12759 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12760 node := doc createAttribute:'title'. |
|
12761 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12762 self assert: featureImpl == node. |
|
12763 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12764 self assert: featureImpl == node. |
|
12765 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12766 self assert: featureImpl == node. |
|
12767 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12768 self assert: featureImpl isNil. |
|
12769 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12770 self assert: featureImpl == node. |
|
12771 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12772 self assert: featureImpl == node. |
|
12773 isSupported := node isSupported:'XML' version:nullVersion. |
|
12774 featureImpl := node getFeature:'XML' version:nullVersion. |
|
12775 "if" |
|
12776 (isSupported) ifTrue: [ |
|
12777 ]. |
|
12778 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12779 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12780 "if" |
|
12781 (isSupported) ifTrue: [ |
|
12782 ]. |
|
12783 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12784 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12785 "if" |
|
12786 (isSupported) ifTrue: [ |
|
12787 ]. |
|
12788 isSupported := node isSupported:'Events' version:nullVersion. |
|
12789 featureImpl := node getFeature:'Events' version:nullVersion. |
|
12790 "if" |
|
12791 (isSupported) ifTrue: [ |
|
12792 ]. |
|
12793 isSupported := node isSupported:'LS' version:nullVersion. |
|
12794 featureImpl := node getFeature:'LS' version:nullVersion. |
|
12795 "if" |
|
12796 (isSupported) ifTrue: [ |
|
12797 ]. |
|
12798 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12799 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
12800 "if" |
|
12801 (isSupported) ifTrue: [ |
|
12802 ]. |
|
12803 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12804 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
12805 "if" |
|
12806 (isSupported) ifTrue: [ |
|
12807 ]. |
|
12808 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12809 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12810 "if" |
|
12811 (isSupported) ifTrue: [ |
|
12812 ]. |
|
12813 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12814 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12815 "if" |
|
12816 (isSupported) ifTrue: [ |
|
12817 ]. |
|
12818 |
|
12819 ! |
|
12820 |
|
12821 test_nodegetfeature07 |
|
12822 " |
|
12823 Check implementation of Node.getFeature on namespaced attribute. |
|
12824 |
|
12825 Creator: Curt Arnold |
|
12826 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12827 " |
|
12828 | |
|
12829 doc "Document" |
|
12830 node "Node" |
|
12831 nullVersion "String" |
|
12832 featureImpl "Node" |
|
12833 isSupported "Boolean" |
|
12834 domImpl "DOMImplementation" |
|
12835 | |
|
12836 nullVersion := nil. |
|
12837 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12838 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12839 node := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
12840 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12841 self assert: featureImpl == node. |
|
12842 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12843 self assert: featureImpl == node. |
|
12844 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12845 self assert: featureImpl == node. |
|
12846 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12847 self assert: featureImpl isNil. |
|
12848 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12849 self assert: featureImpl == node. |
|
12850 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12851 self assert: featureImpl == node. |
|
12852 isSupported := node isSupported:'XML' version:nullVersion. |
|
12853 featureImpl := node getFeature:'XML' version:nullVersion. |
|
12854 "if" |
|
12855 (isSupported) ifTrue: [ |
|
12856 ]. |
|
12857 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12858 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12859 "if" |
|
12860 (isSupported) ifTrue: [ |
|
12861 ]. |
|
12862 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12863 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12864 "if" |
|
12865 (isSupported) ifTrue: [ |
|
12866 ]. |
|
12867 isSupported := node isSupported:'Events' version:nullVersion. |
|
12868 featureImpl := node getFeature:'Events' version:nullVersion. |
|
12869 "if" |
|
12870 (isSupported) ifTrue: [ |
|
12871 ]. |
|
12872 isSupported := node isSupported:'LS' version:nullVersion. |
|
12873 featureImpl := node getFeature:'LS' version:nullVersion. |
|
12874 "if" |
|
12875 (isSupported) ifTrue: [ |
|
12876 ]. |
|
12877 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12878 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
12879 "if" |
|
12880 (isSupported) ifTrue: [ |
|
12881 ]. |
|
12882 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12883 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
12884 "if" |
|
12885 (isSupported) ifTrue: [ |
|
12886 ]. |
|
12887 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12888 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12889 "if" |
|
12890 (isSupported) ifTrue: [ |
|
12891 ]. |
|
12892 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12893 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12894 "if" |
|
12895 (isSupported) ifTrue: [ |
|
12896 ]. |
|
12897 |
|
12898 ! |
|
12899 |
|
12900 test_nodegetfeature08 |
|
12901 " |
|
12902 Check implementation of Node.getFeature on ProcessingInstruction. |
|
12903 |
|
12904 Creator: Curt Arnold |
|
12905 Autor Neil Delima |
|
12906 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12907 " |
|
12908 | |
|
12909 doc "Document" |
|
12910 node "Node" |
|
12911 nullVersion "String" |
|
12912 featureImpl "Node" |
|
12913 isSupported "Boolean" |
|
12914 domImpl "DOMImplementation" |
|
12915 | |
|
12916 nullVersion := nil. |
|
12917 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12918 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12919 node := doc createProcessingInstruction:'test-pi' data:'foo'. |
|
12920 featureImpl := node getFeature:'Core' version:nullVersion. |
|
12921 self assert: featureImpl == node. |
|
12922 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
12923 self assert: featureImpl == node. |
|
12924 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
12925 self assert: featureImpl == node. |
|
12926 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
12927 self assert: featureImpl isNil. |
|
12928 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
12929 self assert: featureImpl == node. |
|
12930 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
12931 self assert: featureImpl == node. |
|
12932 isSupported := node isSupported:'XML' version:nullVersion. |
|
12933 featureImpl := node getFeature:'XML' version:nullVersion. |
|
12934 "if" |
|
12935 (isSupported) ifTrue: [ |
|
12936 ]. |
|
12937 isSupported := node isSupported:'SVG' version:nullVersion. |
|
12938 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12939 "if" |
|
12940 (isSupported) ifTrue: [ |
|
12941 ]. |
|
12942 isSupported := node isSupported:'HTML' version:nullVersion. |
|
12943 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12944 "if" |
|
12945 (isSupported) ifTrue: [ |
|
12946 ]. |
|
12947 isSupported := node isSupported:'Events' version:nullVersion. |
|
12948 featureImpl := node getFeature:'Events' version:nullVersion. |
|
12949 "if" |
|
12950 (isSupported) ifTrue: [ |
|
12951 ]. |
|
12952 isSupported := node isSupported:'LS' version:nullVersion. |
|
12953 featureImpl := node getFeature:'LS' version:nullVersion. |
|
12954 "if" |
|
12955 (isSupported) ifTrue: [ |
|
12956 ]. |
|
12957 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
12958 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
12959 "if" |
|
12960 (isSupported) ifTrue: [ |
|
12961 ]. |
|
12962 isSupported := node isSupported:'XPath' version:nullVersion. |
|
12963 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
12964 "if" |
|
12965 (isSupported) ifTrue: [ |
|
12966 ]. |
|
12967 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
12968 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
12969 "if" |
|
12970 (isSupported) ifTrue: [ |
|
12971 ]. |
|
12972 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
12973 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
12974 "if" |
|
12975 (isSupported) ifTrue: [ |
|
12976 ]. |
|
12977 |
|
12978 ! |
|
12979 |
|
12980 test_nodegetfeature09 |
|
12981 " |
|
12982 Check implementation of Node.getFeature on Comment. |
|
12983 |
|
12984 Creator: Curt Arnold |
|
12985 Autor Neil Delima |
|
12986 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
12987 " |
|
12988 | |
|
12989 doc "Document" |
|
12990 node "Node" |
|
12991 nullVersion "String" |
|
12992 featureImpl "Node" |
|
12993 isSupported "Boolean" |
|
12994 domImpl "DOMImplementation" |
|
12995 | |
|
12996 nullVersion := nil. |
|
12997 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
12998 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
12999 node := doc createComment:'test comment'. |
|
13000 featureImpl := node getFeature:'Core' version:nullVersion. |
|
13001 self assert: featureImpl == node. |
|
13002 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
13003 self assert: featureImpl == node. |
|
13004 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
13005 self assert: featureImpl == node. |
|
13006 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
13007 self assert: featureImpl isNil. |
|
13008 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
13009 self assert: featureImpl == node. |
|
13010 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
13011 self assert: featureImpl == node. |
|
13012 isSupported := node isSupported:'XML' version:nullVersion. |
|
13013 featureImpl := node getFeature:'XML' version:nullVersion. |
|
13014 "if" |
|
13015 (isSupported) ifTrue: [ |
|
13016 ]. |
|
13017 isSupported := node isSupported:'SVG' version:nullVersion. |
|
13018 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13019 "if" |
|
13020 (isSupported) ifTrue: [ |
|
13021 ]. |
|
13022 isSupported := node isSupported:'HTML' version:nullVersion. |
|
13023 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13024 "if" |
|
13025 (isSupported) ifTrue: [ |
|
13026 ]. |
|
13027 isSupported := node isSupported:'Events' version:nullVersion. |
|
13028 featureImpl := node getFeature:'Events' version:nullVersion. |
|
13029 "if" |
|
13030 (isSupported) ifTrue: [ |
|
13031 ]. |
|
13032 isSupported := node isSupported:'LS' version:nullVersion. |
|
13033 featureImpl := node getFeature:'LS' version:nullVersion. |
|
13034 "if" |
|
13035 (isSupported) ifTrue: [ |
|
13036 ]. |
|
13037 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
13038 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
13039 "if" |
|
13040 (isSupported) ifTrue: [ |
|
13041 ]. |
|
13042 isSupported := node isSupported:'XPath' version:nullVersion. |
|
13043 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
13044 "if" |
|
13045 (isSupported) ifTrue: [ |
|
13046 ]. |
|
13047 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
13048 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13049 "if" |
|
13050 (isSupported) ifTrue: [ |
|
13051 ]. |
|
13052 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
13053 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13054 "if" |
|
13055 (isSupported) ifTrue: [ |
|
13056 ]. |
|
13057 |
|
13058 ! |
|
13059 |
|
13060 test_nodegetfeature10 |
|
13061 " |
|
13062 Check implementation of Node.getFeature on Text. |
|
13063 |
|
13064 Creator: Curt Arnold |
|
13065 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
13066 " |
|
13067 | |
|
13068 doc "Document" |
|
13069 node "Node" |
|
13070 nullVersion "String" |
|
13071 featureImpl "Node" |
|
13072 isSupported "Boolean" |
|
13073 domImpl "DOMImplementation" |
|
13074 nodeList "NodeList" |
|
13075 elem "Element" |
|
13076 | |
|
13077 nullVersion := nil. |
|
13078 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13079 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
13080 nodeList := doc getElementsByTagName: 'p'. |
|
13081 elem := nodeList item:0. |
|
13082 node := elem firstChild. |
|
13083 featureImpl := node getFeature:'Core' version:nullVersion. |
|
13084 self assert: featureImpl == node. |
|
13085 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
13086 self assert: featureImpl == node. |
|
13087 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
13088 self assert: featureImpl == node. |
|
13089 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
13090 self assert: featureImpl isNil. |
|
13091 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
13092 self assert: featureImpl == node. |
|
13093 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
13094 self assert: featureImpl == node. |
|
13095 isSupported := node isSupported:'XML' version:nullVersion. |
|
13096 featureImpl := node getFeature:'XML' version:nullVersion. |
|
13097 "if" |
|
13098 (isSupported) ifTrue: [ |
|
13099 ]. |
|
13100 isSupported := node isSupported:'SVG' version:nullVersion. |
|
13101 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13102 "if" |
|
13103 (isSupported) ifTrue: [ |
|
13104 ]. |
|
13105 isSupported := node isSupported:'HTML' version:nullVersion. |
|
13106 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13107 "if" |
|
13108 (isSupported) ifTrue: [ |
|
13109 ]. |
|
13110 isSupported := node isSupported:'Events' version:nullVersion. |
|
13111 featureImpl := node getFeature:'Events' version:nullVersion. |
|
13112 "if" |
|
13113 (isSupported) ifTrue: [ |
|
13114 ]. |
|
13115 isSupported := node isSupported:'LS' version:nullVersion. |
|
13116 featureImpl := node getFeature:'LS' version:nullVersion. |
|
13117 "if" |
|
13118 (isSupported) ifTrue: [ |
|
13119 ]. |
|
13120 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
13121 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
13122 "if" |
|
13123 (isSupported) ifTrue: [ |
|
13124 ]. |
|
13125 isSupported := node isSupported:'XPath' version:nullVersion. |
|
13126 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
13127 "if" |
|
13128 (isSupported) ifTrue: [ |
|
13129 ]. |
|
13130 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
13131 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13132 "if" |
|
13133 (isSupported) ifTrue: [ |
|
13134 ]. |
|
13135 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
13136 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13137 "if" |
|
13138 (isSupported) ifTrue: [ |
|
13139 ]. |
|
13140 |
|
13141 ! |
|
13142 |
|
13143 test_nodegetfeature11 |
|
13144 " |
|
13145 Check implementation of Node.getFeature on CDATASection. |
|
13146 |
|
13147 Creator: Curt Arnold |
|
13148 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
13149 " |
|
13150 | |
|
13151 doc "Document" |
|
13152 node "Node" |
|
13153 nullVersion "String" |
|
13154 featureImpl "Node" |
|
13155 isSupported "Boolean" |
|
13156 domImpl "DOMImplementation" |
|
13157 | |
|
13158 nullVersion := nil. |
|
13159 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13160 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
13161 node := doc createCDATASection:'some text'. |
|
13162 featureImpl := node getFeature:'Core' version:nullVersion. |
|
13163 self assert: featureImpl == node. |
|
13164 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
13165 self assert: featureImpl == node. |
|
13166 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
13167 self assert: featureImpl == node. |
|
13168 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
13169 self assert: featureImpl isNil. |
|
13170 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
13171 self assert: featureImpl == node. |
|
13172 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
13173 self assert: featureImpl == node. |
|
13174 isSupported := node isSupported:'XML' version:nullVersion. |
|
13175 featureImpl := node getFeature:'XML' version:nullVersion. |
|
13176 "if" |
|
13177 (isSupported) ifTrue: [ |
|
13178 ]. |
|
13179 isSupported := node isSupported:'SVG' version:nullVersion. |
|
13180 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13181 "if" |
|
13182 (isSupported) ifTrue: [ |
|
13183 ]. |
|
13184 isSupported := node isSupported:'HTML' version:nullVersion. |
|
13185 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13186 "if" |
|
13187 (isSupported) ifTrue: [ |
|
13188 ]. |
|
13189 isSupported := node isSupported:'Events' version:nullVersion. |
|
13190 featureImpl := node getFeature:'Events' version:nullVersion. |
|
13191 "if" |
|
13192 (isSupported) ifTrue: [ |
|
13193 ]. |
|
13194 isSupported := node isSupported:'LS' version:nullVersion. |
|
13195 featureImpl := node getFeature:'LS' version:nullVersion. |
|
13196 "if" |
|
13197 (isSupported) ifTrue: [ |
|
13198 ]. |
|
13199 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
13200 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
13201 "if" |
|
13202 (isSupported) ifTrue: [ |
|
13203 ]. |
|
13204 isSupported := node isSupported:'XPath' version:nullVersion. |
|
13205 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
13206 "if" |
|
13207 (isSupported) ifTrue: [ |
|
13208 ]. |
|
13209 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
13210 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13211 "if" |
|
13212 (isSupported) ifTrue: [ |
|
13213 ]. |
|
13214 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
13215 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13216 "if" |
|
13217 (isSupported) ifTrue: [ |
|
13218 ]. |
|
13219 |
|
13220 ! |
|
13221 |
|
13222 test_nodegetfeature12 |
|
13223 " |
|
13224 Check implementation of Node.getFeature on Entity. |
|
13225 |
|
13226 Creator: Curt Arnold |
|
13227 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
13228 " |
|
13229 | |
|
13230 doc "Document" |
|
13231 node "Node" |
|
13232 nullVersion "String" |
|
13233 featureImpl "Node" |
|
13234 isSupported "Boolean" |
|
13235 domImpl "DOMImplementation" |
|
13236 entities "NamedNodeMap" |
|
13237 doctype "DocumentType" |
|
13238 | |
|
13239 nullVersion := nil. |
|
13240 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13241 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
13242 doctype := doc doctype. |
|
13243 entities := doctype entities. |
|
13244 node := entities getNamedItem:'ent1'. |
|
13245 featureImpl := node getFeature:'Core' version:nullVersion. |
|
13246 self assert: featureImpl == node. |
|
13247 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
13248 self assert: featureImpl == node. |
|
13249 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
13250 self assert: featureImpl == node. |
|
13251 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
13252 self assert: featureImpl isNil. |
|
13253 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
13254 self assert: featureImpl == node. |
|
13255 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
13256 self assert: featureImpl == node. |
|
13257 isSupported := node isSupported:'XML' version:nullVersion. |
|
13258 featureImpl := node getFeature:'XML' version:nullVersion. |
|
13259 "if" |
|
13260 (isSupported) ifTrue: [ |
|
13261 ]. |
|
13262 isSupported := node isSupported:'SVG' version:nullVersion. |
|
13263 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13264 "if" |
|
13265 (isSupported) ifTrue: [ |
|
13266 ]. |
|
13267 isSupported := node isSupported:'HTML' version:nullVersion. |
|
13268 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13269 "if" |
|
13270 (isSupported) ifTrue: [ |
|
13271 ]. |
|
13272 isSupported := node isSupported:'Events' version:nullVersion. |
|
13273 featureImpl := node getFeature:'Events' version:nullVersion. |
|
13274 "if" |
|
13275 (isSupported) ifTrue: [ |
|
13276 ]. |
|
13277 isSupported := node isSupported:'LS' version:nullVersion. |
|
13278 featureImpl := node getFeature:'LS' version:nullVersion. |
|
13279 "if" |
|
13280 (isSupported) ifTrue: [ |
|
13281 ]. |
|
13282 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
13283 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
13284 "if" |
|
13285 (isSupported) ifTrue: [ |
|
13286 ]. |
|
13287 isSupported := node isSupported:'XPath' version:nullVersion. |
|
13288 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
13289 "if" |
|
13290 (isSupported) ifTrue: [ |
|
13291 ]. |
|
13292 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
13293 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13294 "if" |
|
13295 (isSupported) ifTrue: [ |
|
13296 ]. |
|
13297 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
13298 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13299 "if" |
|
13300 (isSupported) ifTrue: [ |
|
13301 ]. |
|
13302 |
|
13303 ! |
|
13304 |
|
13305 test_nodegetfeature13 |
|
13306 " |
|
13307 Check implementation of Node.getFeature on Notation. |
|
13308 |
|
13309 Creator: Curt Arnold |
|
13310 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getFeature |
|
13311 " |
|
13312 | |
|
13313 doc "Document" |
|
13314 node "Node" |
|
13315 nullVersion "String" |
|
13316 featureImpl "Node" |
|
13317 isSupported "Boolean" |
|
13318 domImpl "DOMImplementation" |
|
13319 notations "NamedNodeMap" |
|
13320 doctype "DocumentType" |
|
13321 | |
|
13322 nullVersion := nil. |
|
13323 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13324 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
13325 doctype := doc doctype. |
|
13326 notations := doctype notations. |
|
13327 node := notations getNamedItem:'notation1'. |
|
13328 featureImpl := node getFeature:'Core' version:nullVersion. |
|
13329 self assert: featureImpl == node. |
|
13330 featureImpl := node getFeature:'cOrE' version:nullVersion. |
|
13331 self assert: featureImpl == node. |
|
13332 featureImpl := node getFeature:'+cOrE' version:nullVersion. |
|
13333 self assert: featureImpl == node. |
|
13334 featureImpl := node getFeature:'org.w3c.domts.bogus.feature' version:nullVersion. |
|
13335 self assert: featureImpl isNil. |
|
13336 featureImpl := node getFeature:'cOrE' version:'2.0'. |
|
13337 self assert: featureImpl == node. |
|
13338 featureImpl := node getFeature:'cOrE' version:'3.0'. |
|
13339 self assert: featureImpl == node. |
|
13340 isSupported := node isSupported:'XML' version:nullVersion. |
|
13341 featureImpl := node getFeature:'XML' version:nullVersion. |
|
13342 "if" |
|
13343 (isSupported) ifTrue: [ |
|
13344 ]. |
|
13345 isSupported := node isSupported:'SVG' version:nullVersion. |
|
13346 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13347 "if" |
|
13348 (isSupported) ifTrue: [ |
|
13349 ]. |
|
13350 isSupported := node isSupported:'HTML' version:nullVersion. |
|
13351 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13352 "if" |
|
13353 (isSupported) ifTrue: [ |
|
13354 ]. |
|
13355 isSupported := node isSupported:'Events' version:nullVersion. |
|
13356 featureImpl := node getFeature:'Events' version:nullVersion. |
|
13357 "if" |
|
13358 (isSupported) ifTrue: [ |
|
13359 ]. |
|
13360 isSupported := node isSupported:'LS' version:nullVersion. |
|
13361 featureImpl := node getFeature:'LS' version:nullVersion. |
|
13362 "if" |
|
13363 (isSupported) ifTrue: [ |
|
13364 ]. |
|
13365 isSupported := node isSupported:'LS-Async' version:nullVersion. |
|
13366 featureImpl := node getFeature:'LS-Async' version:nullVersion. |
|
13367 "if" |
|
13368 (isSupported) ifTrue: [ |
|
13369 ]. |
|
13370 isSupported := node isSupported:'XPath' version:nullVersion. |
|
13371 featureImpl := node getFeature:'XPath' version:nullVersion. |
|
13372 "if" |
|
13373 (isSupported) ifTrue: [ |
|
13374 ]. |
|
13375 isSupported := node isSupported:'+HTML' version:nullVersion. |
|
13376 featureImpl := node getFeature:'HTML' version:nullVersion. |
|
13377 "if" |
|
13378 (isSupported) ifTrue: [ |
|
13379 ]. |
|
13380 isSupported := node isSupported:'+SVG' version:nullVersion. |
|
13381 featureImpl := node getFeature:'SVG' version:nullVersion. |
|
13382 "if" |
|
13383 (isSupported) ifTrue: [ |
|
13384 ]. |
|
13385 |
|
13386 ! |
|
13387 |
|
13388 test_nodegettextcontent01 |
|
13389 " |
|
13390 |
|
13391 |
|
13392 Using getTextContent on this Document node check if the value returned is Null . |
|
13393 |
|
13394 Creator: IBM |
|
13395 Autor Neil Delima |
|
13396 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13397 " |
|
13398 | |
|
13399 doc "Document" |
|
13400 textContent "String" |
|
13401 | |
|
13402 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13403 textContent := doc textContent. |
|
13404 self assert: textContent isNil. |
|
13405 |
|
13406 ! |
|
13407 |
|
13408 test_nodegettextcontent02 |
|
13409 " |
|
13410 |
|
13411 |
|
13412 Using getTextContent on a new Document node check if the value returned is Null . |
|
13413 |
|
13414 Creator: IBM |
|
13415 Autor Neil Delima |
|
13416 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13417 " |
|
13418 | |
|
13419 doc "Document" |
|
13420 domImpl "DOMImplementation" |
|
13421 newDoc "Document" |
|
13422 textContent "String" |
|
13423 nullDocType "DocumentType" |
|
13424 docElem "Element" |
|
13425 rootName "String" |
|
13426 rootNS "String" |
|
13427 | |
|
13428 nullDocType := nil. |
|
13429 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13430 docElem := doc documentElement. |
|
13431 rootNS := docElem namespaceURI. |
|
13432 rootName := docElem tagName. |
|
13433 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
13434 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
13435 textContent := newDoc textContent. |
|
13436 self assert: textContent isNil. |
|
13437 |
|
13438 ! |
|
13439 |
|
13440 test_nodegettextcontent03 |
|
13441 " |
|
13442 |
|
13443 |
|
13444 Using getTextContent on this DocumentType node check if the value returned is Null . |
|
13445 |
|
13446 Creator: IBM |
|
13447 Autor Neil Delima |
|
13448 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13449 " |
|
13450 | |
|
13451 doc "Document" |
|
13452 docType "DocumentType" |
|
13453 newDoc "Document" |
|
13454 textContent "String" |
|
13455 | |
|
13456 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13457 docType := doc doctype. |
|
13458 textContent := docType textContent. |
|
13459 self assert: textContent isNil. |
|
13460 |
|
13461 ! |
|
13462 |
|
13463 test_nodegettextcontent04 |
|
13464 " |
|
13465 |
|
13466 |
|
13467 Using getTextContent on a new DocumentType node check if the value returned is Null. |
|
13468 |
|
13469 Creator: IBM |
|
13470 Autor Neil Delima |
|
13471 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13472 " |
|
13473 | |
|
13474 doc "Document" |
|
13475 domImpl "DOMImplementation" |
|
13476 docType "DocumentType" |
|
13477 textContent "String" |
|
13478 nullPubId "String" |
|
13479 nullSysId "String" |
|
13480 oldDocType "DocumentType" |
|
13481 rootName "String" |
|
13482 | |
|
13483 nullPubId := nil. |
|
13484 nullSysId := nil. |
|
13485 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13486 oldDocType := doc doctype. |
|
13487 rootName := oldDocType name. |
|
13488 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
13489 docType := domImpl createDocumentType:rootName publicId:nullPubId systemId:nullSysId. |
|
13490 textContent := docType textContent. |
|
13491 self assert: textContent isNil. |
|
13492 |
|
13493 ! |
|
13494 |
|
13495 test_nodegettextcontent05 |
|
13496 " |
|
13497 |
|
13498 |
|
13499 Using getTextContent on this DocumentType node check if the value returned is Null . |
|
13500 |
|
13501 Creator: IBM |
|
13502 Autor Neil Delima |
|
13503 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13504 " |
|
13505 | |
|
13506 doc "Document" |
|
13507 docType "DocumentType" |
|
13508 notationsMap "NamedNodeMap" |
|
13509 notation1 "Notation" |
|
13510 textContent "String" |
|
13511 | |
|
13512 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13513 docType := doc doctype. |
|
13514 notationsMap := docType notations. |
|
13515 notation1 := notationsMap getNamedItem:'notation1'. |
|
13516 textContent := docType textContent. |
|
13517 self assert: textContent isNil. |
|
13518 |
|
13519 ! |
|
13520 |
|
13521 test_nodegettextcontent06 |
|
13522 " |
|
13523 |
|
13524 |
|
13525 Invoke the method getTextContent on a default Attr node and check if the value returned |
|
13526 is the attributes Value. |
|
13527 |
|
13528 Creator: IBM |
|
13529 Autor Neil Delima |
|
13530 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13531 " |
|
13532 | |
|
13533 doc "Document" |
|
13534 elemList "NodeList" |
|
13535 elem "Element" |
|
13536 attr "Attr" |
|
13537 textContent "String" |
|
13538 | |
|
13539 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13540 elemList := doc getElementsByTagName: 'p'. |
|
13541 elem := elemList item:3. |
|
13542 attr := elem getAttributeNode:'dir'. |
|
13543 textContent := attr textContent. |
|
13544 self assert: ( textContent = 'rtl' ). |
|
13545 |
|
13546 ! |
|
13547 |
|
13548 test_nodegettextcontent07 |
|
13549 " |
|
13550 Invoke the method getTextContent on a new Attr node and check if the value returned |
|
13551 is the attributes Value. |
|
13552 |
|
13553 Creator: IBM |
|
13554 Autor Neil Delima |
|
13555 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13556 " |
|
13557 | |
|
13558 doc "Document" |
|
13559 elemList "NodeList" |
|
13560 elem "Element" |
|
13561 attr "Attr" |
|
13562 textContent "String" |
|
13563 | |
|
13564 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13565 elemList := doc getElementsByTagName: 'p'. |
|
13566 elem := elemList item:3. |
|
13567 elem setAttribute: 'xml:lang' ns: 'http://www.w3.org/XML/1998/namespace' value: 'en-US'. |
|
13568 attr := elem getAttributeNode: 'lang' ns: 'http://www.w3.org/XML/1998/namespace'. |
|
13569 textContent := attr textContent. |
|
13570 self assert: ( textContent = 'en-US' ). |
|
13571 |
|
13572 ! |
|
13573 |
|
13574 test_nodegettextcontent08 |
|
13575 " |
|
13576 Invoke the method getTextContent on a new Attr node and check if the value returned |
|
13577 is the attributes Value. |
|
13578 |
|
13579 Creator: IBM |
|
13580 Autor Neil Delima |
|
13581 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13582 " |
|
13583 | |
|
13584 doc "Document" |
|
13585 elemList "NodeList" |
|
13586 elem "Element" |
|
13587 att "Attr" |
|
13588 attr "Attr" |
|
13589 replacedAttr "Attr" |
|
13590 textContent "String" |
|
13591 | |
|
13592 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13593 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
13594 att := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
13595 replacedAttr := elem setAttributeNodeNS: att. |
|
13596 attr := elem getAttributeNode: 'lang' ns: 'http://www.w3.org/XML/1998/namespace'. |
|
13597 textContent := attr textContent. |
|
13598 self assert: ( textContent = '' ). |
|
13599 |
|
13600 ! |
|
13601 |
|
13602 test_nodegettextcontent09 |
|
13603 " |
|
13604 Invoke the method getTextContent on a new Text node and check if the value returned |
|
13605 is the text content. |
|
13606 |
|
13607 Creator: IBM |
|
13608 Autor Neil Delima |
|
13609 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13610 " |
|
13611 | |
|
13612 doc "Document" |
|
13613 elemList "NodeList" |
|
13614 elem "Element" |
|
13615 txt "Text" |
|
13616 textContent "String" |
|
13617 appendedChild "Node" |
|
13618 | |
|
13619 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13620 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
13621 txt := doc createTextNode:'Replacement Text'. |
|
13622 appendedChild := elem appendChild:txt. |
|
13623 textContent := txt textContent. |
|
13624 self assert: ( textContent = 'Replacement Text' ). |
|
13625 |
|
13626 ! |
|
13627 |
|
13628 test_nodegettextcontent10 |
|
13629 " |
|
13630 |
|
13631 |
|
13632 Invoke the method getTextContent on an existing Text node and check if the value returned |
|
13633 is the elements Text content. |
|
13634 |
|
13635 Creator: IBM |
|
13636 Autor Neil Delima |
|
13637 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13638 " |
|
13639 | |
|
13640 doc "Document" |
|
13641 elemList "NodeList" |
|
13642 elem "Element" |
|
13643 txt "Text" |
|
13644 textContent "String" |
|
13645 | |
|
13646 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13647 elemList := doc getElementsByTagName: 'em'. |
|
13648 elem := elemList item:0. |
|
13649 txt := elem firstChild. |
|
13650 textContent := txt textContent. |
|
13651 self assert: ( textContent = 'EMP0001' ). |
|
13652 |
|
13653 ! |
|
13654 |
|
13655 test_nodegettextcontent11 |
|
13656 " |
|
13657 |
|
13658 |
|
13659 Invoke the method getTextContent on an existing CDATASection node and check if the value returned |
|
13660 is the CDATASections content. |
|
13661 |
|
13662 Creator: IBM |
|
13663 Autor Neil Delima |
|
13664 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13665 " |
|
13666 | |
|
13667 doc "Document" |
|
13668 elemList "NodeList" |
|
13669 elem "Element" |
|
13670 cdata "CDATASection" |
|
13671 textContent "String" |
|
13672 | |
|
13673 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13674 elemList := doc getElementsByTagName: 'strong'. |
|
13675 elem := elemList item:1. |
|
13676 cdata := elem lastChild. |
|
13677 textContent := cdata textContent. |
|
13678 self assert: ( textContent = 'This is an adjacent CDATASection with a reference to a tab &tab;' ). |
|
13679 |
|
13680 ! |
|
13681 |
|
13682 test_nodegettextcontent12 |
|
13683 " |
|
13684 Invoke the method getTextContent on a new Comment node and check if the value returned |
|
13685 is the Comments data. |
|
13686 |
|
13687 Creator: IBM |
|
13688 Autor Neil Delima |
|
13689 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13690 " |
|
13691 | |
|
13692 doc "Document" |
|
13693 elemList "NodeList" |
|
13694 elem "Element" |
|
13695 comment "Comment" |
|
13696 textContent "String" |
|
13697 appendedChild "Node" |
|
13698 | |
|
13699 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13700 elem := doc createElement:'body' ns:'http://www.w3.org/1999/xhtml'. |
|
13701 comment := doc createComment:'Comment'. |
|
13702 appendedChild := elem appendChild:comment. |
|
13703 textContent := comment textContent. |
|
13704 self assert: ( textContent = 'Comment' ). |
|
13705 |
|
13706 ! |
|
13707 |
|
13708 test_nodegettextcontent13 |
|
13709 " |
|
13710 |
|
13711 |
|
13712 Invoke the method getTextContent on an existing Element node with Text and CDATA |
|
13713 content and check if the value returned is a single concatenated String with its content. |
|
13714 |
|
13715 Creator: IBM |
|
13716 Autor Neil Delima |
|
13717 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13718 " |
|
13719 | |
|
13720 doc "Document" |
|
13721 elemList "NodeList" |
|
13722 elem "Element" |
|
13723 textContent "String" |
|
13724 | |
|
13725 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13726 elemList := doc getElementsByTagName: 'strong'. |
|
13727 elem := elemList item:1. |
|
13728 textContent := elem textContent. |
|
13729 self assert: ( textContent = 'Martha Raynolds\nThis is a CDATASection with EntityReference number 2 &ent2;\nThis is an adjacent CDATASection with a reference to a tab &tab;' ). |
|
13730 |
|
13731 ! |
|
13732 |
|
13733 test_nodegettextcontent14 |
|
13734 " |
|
13735 Invoke the method getTextContent on an existing Element node with Child Element, Text |
|
13736 EntityReferences and Attributes and check if the value returned is a single |
|
13737 concatenated String with its content. |
|
13738 |
|
13739 Creator: IBM |
|
13740 Autor Neil Delima |
|
13741 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13742 " |
|
13743 | |
|
13744 doc "Document" |
|
13745 elemList "NodeList" |
|
13746 elem "Element" |
|
13747 textContent "String" |
|
13748 | |
|
13749 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13750 elemList := doc getElementsByTagName: 'p'. |
|
13751 elem := elemList item:2. |
|
13752 textContent := elem textContent. |
|
13753 self assert: ( textContent = '\n EMP0003\n Roger\n Jones\n Department Manager\n 100,000\n Element data\n PO Box 27 Irving, texas 98553\n ' ). |
|
13754 |
|
13755 ! |
|
13756 |
|
13757 test_nodegettextcontent15 |
|
13758 " |
|
13759 The method getTextContent returns the text content of this node and its descendants. |
|
13760 |
|
13761 Invoke the method getTextContent on a new Element node with new Text, EntityReferences |
|
13762 CDATASection, PI and Comment nodes and check if the value returned is a single |
|
13763 concatenated String with its content. |
|
13764 |
|
13765 Creator: IBM |
|
13766 Autor Neil Delima |
|
13767 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13768 " |
|
13769 | |
|
13770 doc "Document" |
|
13771 elem "Element" |
|
13772 txt "Text" |
|
13773 comment "Comment" |
|
13774 entRef "EntityReference" |
|
13775 cdata "CDATASection" |
|
13776 pi "ProcessingInstruction" |
|
13777 textContent "String" |
|
13778 appendedChild "Node" |
|
13779 | |
|
13780 "implementationAttribute not supported: namespaceAware" |
|
13781 ^self. "Validation not supported" |
|
13782 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13783 elem := doc createElement:'dom3:elem' ns:'http://www.w3.org/DOM/Test'. |
|
13784 txt := doc createTextNode:'Text '. |
|
13785 comment := doc createComment:'Comment '. |
|
13786 entRef := doc createEntityReference:'beta'. |
|
13787 pi := doc createProcessingInstruction:'PIT' data:'PIData '. |
|
13788 cdata := doc createCDATASection:'CData'. |
|
13789 appendedChild := elem appendChild:txt. |
|
13790 appendedChild := elem appendChild:comment. |
|
13791 appendedChild := elem appendChild:entRef. |
|
13792 appendedChild := elem appendChild:pi. |
|
13793 appendedChild := elem appendChild:cdata. |
|
13794 textContent := elem textContent. |
|
13795 doc normalizeDocument. |
|
13796 self assert: ( textContent = 'Text βCData' ). |
|
13797 |
|
13798 ! |
|
13799 |
|
13800 test_nodegettextcontent16 |
|
13801 " |
|
13802 The method getTextContent returns the text content of this node and its descendants. |
|
13803 |
|
13804 Invoke the method getTextContent on a new DocumentFragment node with new Text, EntityReferences |
|
13805 CDATASection, PI and Comment nodes and check if the value returned is a single |
|
13806 concatenated String with its content. |
|
13807 |
|
13808 Creator: IBM |
|
13809 Autor Neil Delima |
|
13810 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13811 " |
|
13812 | |
|
13813 doc "Document" |
|
13814 docFrag "DocumentFragment" |
|
13815 elem "Element" |
|
13816 elemChild "Element" |
|
13817 txt "Text" |
|
13818 comment "Comment" |
|
13819 entRef "EntityReference" |
|
13820 cdata "CDATASection" |
|
13821 pi "ProcessingInstruction" |
|
13822 textContent "String" |
|
13823 appendedChild "Node" |
|
13824 | |
|
13825 "implementationAttribute not supported: namespaceAware" |
|
13826 ^self. "Validation not supported" |
|
13827 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13828 docFrag := doc createDocumentFragment. |
|
13829 elem := doc createElement:'dom3:elem' ns:'http://www.w3.org/DOM/Test'. |
|
13830 txt := doc createTextNode:'Text '. |
|
13831 comment := doc createComment:'Comment '. |
|
13832 entRef := doc createEntityReference:'beta'. |
|
13833 pi := doc createProcessingInstruction:'PIT' data:'PIData '. |
|
13834 cdata := doc createCDATASection:'CData'. |
|
13835 appendedChild := elem appendChild:txt. |
|
13836 appendedChild := elem appendChild:comment. |
|
13837 appendedChild := elem appendChild:entRef. |
|
13838 appendedChild := elem appendChild:pi. |
|
13839 appendedChild := elem appendChild:cdata. |
|
13840 appendedChild := docFrag appendChild:elem. |
|
13841 doc normalizeDocument. |
|
13842 textContent := docFrag textContent. |
|
13843 self assert: ( textContent = 'Text βCData' ). |
|
13844 |
|
13845 ! |
|
13846 |
|
13847 test_nodegettextcontent17 |
|
13848 " |
|
13849 Invoke the method getTextContent on a new EntityReference node and check if the |
|
13850 value returned is the EntityReference's content. |
|
13851 |
|
13852 Creator: IBM |
|
13853 Autor Neil Delima |
|
13854 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13855 " |
|
13856 | |
|
13857 doc "Document" |
|
13858 elem "Element" |
|
13859 entRef "EntityReference" |
|
13860 textContent "String" |
|
13861 appendedChild "Node" |
|
13862 | |
|
13863 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13864 elem := doc documentElement. |
|
13865 entRef := doc createEntityReference:'beta'. |
|
13866 appendedChild := elem appendChild:entRef. |
|
13867 textContent := entRef textContent. |
|
13868 self assert: ( textContent = 'β' ). |
|
13869 |
|
13870 ! |
|
13871 |
|
13872 test_nodegettextcontent18 |
|
13873 " |
|
13874 Invoke the method getTextContent on an Entity node and check if the value returned |
|
13875 is its replacement text. |
|
13876 |
|
13877 Creator: IBM |
|
13878 Autor Neil Delima |
|
13879 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13880 " |
|
13881 | |
|
13882 doc "Document" |
|
13883 docType "DocumentType" |
|
13884 entity "Entity" |
|
13885 entitymap "NamedNodeMap" |
|
13886 textContent "String" |
|
13887 | |
|
13888 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13889 docType := doc doctype. |
|
13890 entitymap := docType entities. |
|
13891 entity := entitymap getNamedItem:'delta'. |
|
13892 textContent := entity textContent. |
|
13893 self assert: ( textContent = 'δ' ). |
|
13894 |
|
13895 ! |
|
13896 |
|
13897 test_nodegettextcontent19 |
|
13898 " |
|
13899 Checks that element content whitespace is not added to textContent. Determination |
|
13900 of element content whitespace is only assured if validating. |
|
13901 |
|
13902 Creator: Curt Arnold |
|
13903 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
13904 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=538 |
|
13905 " |
|
13906 | |
|
13907 doc "Document" |
|
13908 elemList "NodeList" |
|
13909 elem "Element" |
|
13910 textContent "String" |
|
13911 | |
|
13912 "implementationAttribute not supported: ignoringElementContentWhitespace" |
|
13913 ^self. "Validation not supported" |
|
13914 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13915 elemList := doc getElementsByTagName: 'body'. |
|
13916 elem := elemList item:0. |
|
13917 textContent := elem textContent. |
|
13918 self assert: ( textContent = 'bar' ). |
|
13919 |
|
13920 ! |
|
13921 |
|
13922 test_nodegetuserdata01 |
|
13923 " |
|
13924 |
|
13925 |
|
13926 Using getUserData with a junk value for the key attempt to retreive the UserData object |
|
13927 of this Document node without setting it and verify if null is returned. |
|
13928 |
|
13929 Creator: IBM |
|
13930 Autor Neil Delima |
|
13931 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getUserData |
|
13932 " |
|
13933 | |
|
13934 doc "Document" |
|
13935 userData "DOMUserData" |
|
13936 | |
|
13937 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13938 userData := doc getUserDataForKey:'key1'. |
|
13939 self assert: userData isNil. |
|
13940 |
|
13941 ! |
|
13942 |
|
13943 test_nodegetuserdata02 |
|
13944 " |
|
13945 |
|
13946 |
|
13947 Using getUserData with a junk value for the key attempt to retreive the UserData object |
|
13948 of this Document node without setting it and verify if null is returned. |
|
13949 |
|
13950 Creator: IBM |
|
13951 Autor Neil Delima |
|
13952 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getUserData |
|
13953 " |
|
13954 | |
|
13955 doc "Document" |
|
13956 userData "DOMUserData" |
|
13957 | |
|
13958 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
13959 userData := doc getUserDataForKey:'key1'. |
|
13960 self assert: userData isNil. |
|
13961 |
|
13962 ! |
|
13963 |
|
13964 test_nodegetuserdata03 |
|
13965 " |
|
13966 |
|
13967 |
|
13968 Invoke setUserData on this Document to set this Documents UserData to a new |
|
13969 Element node and using getUserData and isEqualNode check if the returned |
|
13970 UserData object is the same as the object that was set. |
|
13971 |
|
13972 Creator: IBM |
|
13973 Autor Neil Delima |
|
13974 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getUserData |
|
13975 " |
|
13976 | |
|
13977 doc "Document" |
|
13978 userData "DOMUserData" |
|
13979 retUserData "DOMUserData" |
|
13980 success "Boolean" |
|
13981 elem "Element" |
|
13982 returnedUserData "DOMUserData" |
|
13983 nullHandler "UserDataHandler" |
|
13984 | |
|
13985 nullHandler := nil. |
|
13986 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
13987 elem := doc createElement:'body' ns:'http://www.w3.org/1999/xhtml'. |
|
13988 returnedUserData := doc setUserData:elem handler: nullHandler forKey:'something'. |
|
13989 retUserData := doc getUserDataForKey:'something'. |
|
13990 success := retUserData isEqualNode:elem. |
|
13991 self assert: success. |
|
13992 |
|
13993 ! |
|
13994 |
|
13995 test_nodegetuserdata04 |
|
13996 " |
|
13997 |
|
13998 |
|
13999 Invoke setUserData on this DocumentType to set this its UserData to a this |
|
14000 Document node and using getUserData and isEqualNode check if the returned |
|
14001 UserData object is the same as the object that was set. |
|
14002 |
|
14003 Creator: IBM |
|
14004 Autor Neil Delima |
|
14005 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getUserData |
|
14006 " |
|
14007 | |
|
14008 doc "Document" |
|
14009 docType "DocumentType" |
|
14010 userData "DOMUserData" |
|
14011 retUserData "DOMUserData" |
|
14012 success "Boolean" |
|
14013 nullHandler "UserDataHandler" |
|
14014 prevUserData "DOMUserData" |
|
14015 | |
|
14016 nullHandler := nil. |
|
14017 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14018 docType := doc doctype. |
|
14019 prevUserData := docType setUserData:doc handler: nullHandler forKey:'KeyDoc'. |
|
14020 retUserData := docType getUserDataForKey:'KeyDoc'. |
|
14021 success := retUserData isEqualNode:doc. |
|
14022 self assert: success. |
|
14023 |
|
14024 ! |
|
14025 |
|
14026 test_nodegetuserdata05 |
|
14027 " |
|
14028 Invoke setUserData on this Entity node to set this its UserData to a new |
|
14029 Attr node and using getUserData with an invalid Key check if the returned |
|
14030 UserData object is Null. |
|
14031 |
|
14032 Creator: IBM |
|
14033 Autor Neil Delima |
|
14034 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getUserData |
|
14035 " |
|
14036 | |
|
14037 doc "Document" |
|
14038 docType "DocumentType" |
|
14039 entities "NamedNodeMap" |
|
14040 entity "Entity" |
|
14041 attr "Attr" |
|
14042 userData "DOMUserData" |
|
14043 retUserData "DOMUserData" |
|
14044 nullHandler "UserDataHandler" |
|
14045 prevUserData "DOMUserData" |
|
14046 | |
|
14047 nullHandler := nil. |
|
14048 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14049 docType := doc doctype. |
|
14050 entities := docType entities. |
|
14051 entity := entities getNamedItem:'delta'. |
|
14052 attr := doc createAttribute:'lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
14053 prevUserData := entity setUserData:attr handler: nullHandler forKey:'key'. |
|
14054 retUserData := entity getUserDataForKey:'Key'. |
|
14055 self assert: retUserData isNil. |
|
14056 |
|
14057 ! |
|
14058 |
|
14059 test_nodegetuserdata06 |
|
14060 " |
|
14061 |
|
14062 |
|
14063 Invoke getUserData on a new Text node with an ampty Key check if the returned |
|
14064 UserData object is Null. |
|
14065 |
|
14066 Creator: IBM |
|
14067 Autor Neil Delima |
|
14068 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getUserData |
|
14069 " |
|
14070 | |
|
14071 doc "Document" |
|
14072 txt "Text" |
|
14073 retUserData "DOMUserData" |
|
14074 | |
|
14075 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14076 txt := doc createTextNode:'TEXT'. |
|
14077 retUserData := txt getUserDataForKey:''. |
|
14078 self assert: retUserData isNil. |
|
14079 |
|
14080 ! |
|
14081 |
|
14082 test_nodegetuserdata07 |
|
14083 " |
|
14084 |
|
14085 |
|
14086 Invoke setUserData on a new PI node to set this its UserData to itself |
|
14087 and using getUserData with an valid Key and isEqualsNode check if the |
|
14088 returned UserData object is the same as that was set. |
|
14089 |
|
14090 Creator: IBM |
|
14091 Autor Neil Delima |
|
14092 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-getUserData |
|
14093 " |
|
14094 | |
|
14095 doc "Document" |
|
14096 pi "ProcessingInstruction" |
|
14097 userData "DOMUserData" |
|
14098 retUserData "DOMUserData" |
|
14099 success "Boolean" |
|
14100 nullHandler "UserDataHandler" |
|
14101 prevUserData "DOMUserData" |
|
14102 | |
|
14103 nullHandler := nil. |
|
14104 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14105 pi := doc createProcessingInstruction:'PITARGET' data:'PIDATA'. |
|
14106 prevUserData := pi setUserData:pi handler: nullHandler forKey:'key'. |
|
14107 retUserData := pi getUserDataForKey:'key'. |
|
14108 success := retUserData isEqualNode:pi. |
|
14109 self assert: success. |
|
14110 |
|
14111 ! |
|
14112 |
|
14113 test_nodeinsertbefore01 |
|
14114 " |
|
14115 |
|
14116 |
|
14117 |
|
14118 Using insertBefore on this Document node attempt to insert a new Comment node before |
|
14119 this DocumentElement node and verify the name of the inserted Comment node. Now |
|
14120 attempt to insert a new Processing Instruction node before the new Comment and |
|
14121 verify the target of the inserted ProcessingInstruction. |
|
14122 |
|
14123 Creator: IBM |
|
14124 Autor Neil Delima |
|
14125 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14126 " |
|
14127 | |
|
14128 doc "Document" |
|
14129 docElem "Element" |
|
14130 newComment "Comment" |
|
14131 insertedComment "Comment" |
|
14132 data "String" |
|
14133 newPI "ProcessingInstruction" |
|
14134 insertedPI "ProcessingInstruction" |
|
14135 target "String" |
|
14136 | |
|
14137 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14138 docElem := doc documentElement. |
|
14139 newComment := doc createComment:'Comment'. |
|
14140 newPI := doc createProcessingInstruction:'PITarget' data:'PIData'. |
|
14141 doc insert:newComment before: docElem. |
|
14142 data := insertedComment data. |
|
14143 self assert: ( data = 'Comment' ). |
|
14144 doc insert:newPI before: newComment. |
|
14145 target := insertedPI target. |
|
14146 self assert: ( target = 'PITarget' ). |
|
14147 |
|
14148 ! |
|
14149 |
|
14150 test_nodeinsertbefore02 |
|
14151 " |
|
14152 Using insertBefore on a new Document node attempt to insert a new Comment node before |
|
14153 this DocumentType node and verify the name of the inserted Comment node. Now |
|
14154 attempt to insert a new Processing Instruction node before the new Comment and |
|
14155 verify the target of the inserted ProcessingInstruction. |
|
14156 |
|
14157 Creator: IBM |
|
14158 Autor Neil Delima |
|
14159 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14160 " |
|
14161 | |
|
14162 doc "Document" |
|
14163 newDoc "Document" |
|
14164 domImpl "DOMImplementation" |
|
14165 newDocType "DocumentType" |
|
14166 newComment "Comment" |
|
14167 insertedComment "Comment" |
|
14168 data "String" |
|
14169 newPI "ProcessingInstruction" |
|
14170 insertedPI "ProcessingInstruction" |
|
14171 target "String" |
|
14172 nullPubId "String" |
|
14173 nullSysId "String" |
|
14174 rootNS "String" |
|
14175 rootName "String" |
|
14176 docElem "Element" |
|
14177 | |
|
14178 nullPubId := nil. |
|
14179 nullSysId := nil. |
|
14180 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14181 docElem := doc documentElement. |
|
14182 rootNS := docElem namespaceURI. |
|
14183 rootName := docElem tagName. |
|
14184 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
14185 newDocType := domImpl createDocumentType:rootName publicId:nullPubId systemId:nullSysId. |
|
14186 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: newDocType. |
|
14187 newComment := newDoc createComment:'Comment'. |
|
14188 newPI := newDoc createProcessingInstruction:'PITarget' data:'PIData'. |
|
14189 newDoc insert:newComment before: newDocType. |
|
14190 data := insertedComment data. |
|
14191 self assert: ( data = 'Comment' ). |
|
14192 newDoc insert:newPI before: newComment. |
|
14193 target := insertedPI target. |
|
14194 self assert: ( target = 'PITarget' ). |
|
14195 |
|
14196 ! |
|
14197 |
|
14198 test_nodeinsertbefore03 |
|
14199 " |
|
14200 Using insertBefore on this Document node attempt to insert a new Attr node before |
|
14201 this DocumentType node and verify if a HIERARCHY_REQUEST_ERR is raised. |
|
14202 |
|
14203 Creator: IBM |
|
14204 Autor Neil Delima |
|
14205 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14206 " |
|
14207 | |
|
14208 doc "Document" |
|
14209 docType "DocumentType" |
|
14210 newAttr "Attr" |
|
14211 inserted "Node" |
|
14212 | |
|
14213 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14214 docType := doc doctype. |
|
14215 newAttr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
14216 "assertDOMException..." |
|
14217 self should:[ |
|
14218 doc insert:newAttr before: docType. |
|
14219 ] raise: DOMException. |
|
14220 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
14221 "end of assertDOMException..." |
|
14222 |
|
14223 ! |
|
14224 |
|
14225 test_nodeinsertbefore04 |
|
14226 " |
|
14227 Using insertBefore on this Document node attempt to insert this Document node before |
|
14228 this DocumentType node and verify if a HIERARCHY_REQUEST_ERR is raised. |
|
14229 |
|
14230 Creator: IBM |
|
14231 Autor Neil Delima |
|
14232 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14233 " |
|
14234 | |
|
14235 doc "Document" |
|
14236 docType "DocumentType" |
|
14237 inserted "Node" |
|
14238 | |
|
14239 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14240 docType := doc doctype. |
|
14241 "assertDOMException..." |
|
14242 self should:[ |
|
14243 doc insert:doc before: docType. |
|
14244 ] raise: DOMException. |
|
14245 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
14246 "end of assertDOMException..." |
|
14247 |
|
14248 ! |
|
14249 |
|
14250 test_nodeinsertbefore05 |
|
14251 " |
|
14252 Attempt to insert a second DocumentType node in a document using Node.insertBefore, |
|
14253 should raise either DOMException with either a HIERARCHY_REQUEST_ERR |
|
14254 or NOT_SUPPORTED_ERR code. |
|
14255 |
|
14256 Creator: IBM |
|
14257 Autor Neil Delima |
|
14258 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14259 " |
|
14260 | |
|
14261 doc "Document" |
|
14262 docType "DocumentType" |
|
14263 domImpl "DOMImplementation" |
|
14264 newDocType "DocumentType" |
|
14265 inserted "Node" |
|
14266 nullPubId "String" |
|
14267 nullSysId "String" |
|
14268 rootName "String" |
|
14269 | |
|
14270 nullPubId := nil. |
|
14271 nullSysId := nil. |
|
14272 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14273 docType := doc doctype. |
|
14274 rootName := docType name. |
|
14275 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
14276 newDocType := domImpl createDocumentType:rootName publicId:nullPubId systemId:nullSysId. |
|
14277 "try" |
|
14278 [ |
|
14279 doc insert:newDocType before: docType. |
|
14280 self assert:false. ] on: DOMException do: [:ex| ]. |
|
14281 "end of try" |
|
14282 |
|
14283 ! |
|
14284 |
|
14285 test_nodeinsertbefore06 |
|
14286 " |
|
14287 Using insertBefore on this Document node attempt to insert an Element node before |
|
14288 the existing element node and verify if a HIERARCHY_REQUEST_ERR or NOT_SUPPORTED_ERR is raised. |
|
14289 |
|
14290 Creator: IBM |
|
14291 Autor Neil Delima |
|
14292 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14293 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=415 |
|
14294 " |
|
14295 | |
|
14296 doc "Document" |
|
14297 docElem "Element" |
|
14298 newElem "Element" |
|
14299 inserted "Node" |
|
14300 rootNS "String" |
|
14301 rootTagname "String" |
|
14302 | |
|
14303 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14304 docElem := doc documentElement. |
|
14305 rootNS := docElem namespaceURI. |
|
14306 rootTagname := docElem tagName. |
|
14307 newElem := doc createElement:rootTagname ns:rootNS. |
|
14308 "try" |
|
14309 [ |
|
14310 doc insert:newElem before: docElem. |
|
14311 self assert:false. ] on: DOMException do: [:ex| ]. |
|
14312 "end of try" |
|
14313 |
|
14314 ! |
|
14315 |
|
14316 test_nodeinsertbefore07 |
|
14317 " |
|
14318 |
|
14319 |
|
14320 |
|
14321 Using insertBefore on this Document node attempt to insert a Comment node created by |
|
14322 another Document before this DocumentElement node and verify if a WRONG_DOCUMENT_ERR |
|
14323 is raised. |
|
14324 |
|
14325 Creator: IBM |
|
14326 Autor Neil Delima |
|
14327 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14328 " |
|
14329 | |
|
14330 doc "Document" |
|
14331 docAlt "Document" |
|
14332 docElem "Element" |
|
14333 newComment "Comment" |
|
14334 inserted "Node" |
|
14335 | |
|
14336 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14337 docAlt := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14338 docElem := doc documentElement. |
|
14339 newComment := docAlt createComment:'Comment'. |
|
14340 "assertDOMException..." |
|
14341 self should:[ |
|
14342 doc insert:newComment before: docElem. |
|
14343 ] raise: DOMException. |
|
14344 self assert: (lastException code == DOMException WRONG_DOCUMENT_ERR). |
|
14345 "end of assertDOMException..." |
|
14346 |
|
14347 ! |
|
14348 |
|
14349 test_nodeinsertbefore08 |
|
14350 " |
|
14351 |
|
14352 |
|
14353 |
|
14354 Using insertBefore on this Document node attempt to insert a Comment node created by |
|
14355 this Document before another Document's DocumentElement node and verify if a |
|
14356 NOT_FOUND_ERR is raised. |
|
14357 |
|
14358 Creator: IBM |
|
14359 Autor Neil Delima |
|
14360 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14361 " |
|
14362 | |
|
14363 doc "Document" |
|
14364 docAlt "Document" |
|
14365 docElem "Element" |
|
14366 newComment "Comment" |
|
14367 inserted "Node" |
|
14368 | |
|
14369 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14370 docAlt := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14371 docElem := docAlt documentElement. |
|
14372 newComment := doc createComment:'Comment'. |
|
14373 "assertDOMException..." |
|
14374 self should:[ |
|
14375 doc insert:newComment before: docElem. |
|
14376 ] raise: DOMException. |
|
14377 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
14378 "end of assertDOMException..." |
|
14379 |
|
14380 ! |
|
14381 |
|
14382 test_nodeinsertbefore09 |
|
14383 " |
|
14384 The method insertBefore inserts the node newChild before the existing child node refChild. |
|
14385 If refChild is null, insert newChild at the end of the list of children. |
|
14386 If newChild is a DocumentFragment object, all of its children are inserted, in the same |
|
14387 order, before refChild. |
|
14388 |
|
14389 Using insertBefore on this Document node attempt to insert a new DocumentFragment node |
|
14390 before a Comment node and verify the contents of the Comment node that is a child |
|
14391 of the DocumentFragment. |
|
14392 |
|
14393 Creator: IBM |
|
14394 Autor Neil Delima |
|
14395 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14396 " |
|
14397 | |
|
14398 doc "Document" |
|
14399 docFrag "DocumentFragment" |
|
14400 newComment "Comment" |
|
14401 insertComment "Comment" |
|
14402 comment "Comment" |
|
14403 inserted "DocumentFragment" |
|
14404 data "String" |
|
14405 appendedChild "Node" |
|
14406 | |
|
14407 "implementationAttribute not supported: namespaceAware" |
|
14408 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14409 newComment := doc createComment:'Comment'. |
|
14410 appendedChild := doc appendChild:newComment. |
|
14411 docFrag := doc createDocumentFragment. |
|
14412 insertComment := doc createComment:'insertComment'. |
|
14413 appendedChild := docFrag appendChild:insertComment. |
|
14414 doc insert:docFrag before: newComment. |
|
14415 comment := newComment previousSibling. |
|
14416 data := comment data. |
|
14417 self assert: ( data = 'insertComment' ). |
|
14418 |
|
14419 ! |
|
14420 |
|
14421 test_nodeinsertbefore10 |
|
14422 " |
|
14423 Using insertBefore on this Document node attempt to insert a new Element node before |
|
14424 another Element node and verify a DOMException with a |
|
14425 HIERARCHY_REQUEST_ERR, NOT_FOUND_ERR or NOT_SUPPORTED_ERR is raised. |
|
14426 |
|
14427 Creator: IBM |
|
14428 Autor Neil Delima |
|
14429 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14430 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=415 |
|
14431 " |
|
14432 | |
|
14433 doc "Document" |
|
14434 elemList "NodeList" |
|
14435 elem "Element" |
|
14436 newElem "Element" |
|
14437 inserted "Node" |
|
14438 docElem "Element" |
|
14439 rootNS "String" |
|
14440 rootTagname "String" |
|
14441 | |
|
14442 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14443 docElem := doc documentElement. |
|
14444 rootNS := docElem namespaceURI. |
|
14445 rootTagname := docElem tagName. |
|
14446 elemList := doc getElementsByTagName: 'p'. |
|
14447 elem := elemList item:1. |
|
14448 newElem := doc createElement:rootTagname ns:rootNS. |
|
14449 "try" |
|
14450 [ |
|
14451 doc insert:newElem before: elem. |
|
14452 self assert:false. ] on: DOMException do: [:ex| ]. |
|
14453 "end of try" |
|
14454 |
|
14455 ! |
|
14456 |
|
14457 test_nodeinsertbefore11 |
|
14458 " |
|
14459 |
|
14460 |
|
14461 |
|
14462 Using insertBefore on a DocumentFragment node attempt to insert a child nodes before |
|
14463 other permissible nodes and verify the contents/name of each inserted node. |
|
14464 |
|
14465 Creator: IBM |
|
14466 Autor Neil Delima |
|
14467 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14468 " |
|
14469 | |
|
14470 doc "Document" |
|
14471 docFrag "DocumentFragment" |
|
14472 elem "Element" |
|
14473 pi "ProcessingInstruction" |
|
14474 comment "Comment" |
|
14475 txt "Text" |
|
14476 cdata "CDATASection" |
|
14477 eRef "EntityReference" |
|
14478 inserted "Node" |
|
14479 insertedVal "String" |
|
14480 appendedChild "Node" |
|
14481 | |
|
14482 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14483 docFrag := doc createDocumentFragment. |
|
14484 elem := doc createElement:'body' ns:'http://www.w3.org/1999/xhtml'. |
|
14485 pi := doc createProcessingInstruction:'PITarget' data:'PIData'. |
|
14486 comment := doc createComment:'Comment'. |
|
14487 txt := doc createTextNode:'Text'. |
|
14488 cdata := doc createCDATASection:'CDATA'. |
|
14489 eRef := doc createEntityReference:'alpha'. |
|
14490 appendedChild := docFrag appendChild:elem. |
|
14491 appendedChild := docFrag appendChild:pi. |
|
14492 appendedChild := docFrag appendChild:comment. |
|
14493 appendedChild := docFrag appendChild:txt. |
|
14494 appendedChild := docFrag appendChild:cdata. |
|
14495 appendedChild := docFrag appendChild:eRef. |
|
14496 docFrag insert:comment before: pi. |
|
14497 insertedVal := inserted data. |
|
14498 self assert: ( insertedVal = 'Comment' ). |
|
14499 docFrag insert:txt before: comment. |
|
14500 insertedVal := inserted data. |
|
14501 self assert: ( insertedVal = 'Text' ). |
|
14502 docFrag insert:cdata before: txt. |
|
14503 insertedVal := inserted data. |
|
14504 self assert: ( insertedVal = 'CDATA' ). |
|
14505 docFrag insert:eRef before: cdata. |
|
14506 insertedVal := inserted nodeName. |
|
14507 self assert: ( insertedVal = 'alpha' ). |
|
14508 |
|
14509 ! |
|
14510 |
|
14511 test_nodeinsertbefore12 |
|
14512 " |
|
14513 The method insertBefore inserts the node newChild before the existing child node refChild. |
|
14514 If refChild is null, insert newChild at the end of the list of children. |
|
14515 |
|
14516 Using insertBefore on a DocumentFragment node attempt to insert a new DocumentFragment node |
|
14517 before this DocumentFragment's Element node and verify the last child is still the only child |
|
14518 appended to docFrag. |
|
14519 |
|
14520 Creator: IBM |
|
14521 Autor Neil Delima |
|
14522 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14523 " |
|
14524 | |
|
14525 doc "Document" |
|
14526 docFrag "DocumentFragment" |
|
14527 docFragNew "DocumentFragment" |
|
14528 elem "Element" |
|
14529 inserted "Node" |
|
14530 appendedChild "Node" |
|
14531 last "Node" |
|
14532 name "String" |
|
14533 | |
|
14534 "implementationAttribute not supported: namespaceAware" |
|
14535 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14536 docFrag := doc createDocumentFragment. |
|
14537 docFragNew := doc createDocumentFragment. |
|
14538 elem := doc createElement:'dom3:elem' ns:'http://www.w3.org/DOM/Test'. |
|
14539 appendedChild := docFrag appendChild:elem. |
|
14540 docFrag insert:docFragNew before: elem. |
|
14541 last := docFrag lastChild. |
|
14542 name := last nodeName. |
|
14543 self assert: ( name = 'dom3:elem' ). |
|
14544 |
|
14545 ! |
|
14546 |
|
14547 test_nodeinsertbefore13 |
|
14548 " |
|
14549 |
|
14550 |
|
14551 |
|
14552 Using insertBefore on a DocumentFragment node attempt to insert a new Element node |
|
14553 created by another Document, before this DocumentFragment's Element node and |
|
14554 verify if a WRONG_DOCUMENT_ERR is raised. |
|
14555 |
|
14556 Creator: IBM |
|
14557 Autor Neil Delima |
|
14558 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14559 " |
|
14560 | |
|
14561 doc "Document" |
|
14562 docAlt "Document" |
|
14563 docFrag "DocumentFragment" |
|
14564 elemAlt "Element" |
|
14565 elem "Element" |
|
14566 appendedChild "Node" |
|
14567 inserted "Node" |
|
14568 docElem "Element" |
|
14569 rootNS "String" |
|
14570 rootTagname "String" |
|
14571 | |
|
14572 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14573 docElem := doc documentElement. |
|
14574 rootNS := docElem namespaceURI. |
|
14575 rootTagname := docElem tagName. |
|
14576 docAlt := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14577 docFrag := doc createDocumentFragment. |
|
14578 elem := doc createElement:rootTagname ns:rootNS. |
|
14579 elemAlt := docAlt createElement:rootTagname ns:rootNS. |
|
14580 appendedChild := docFrag appendChild:elem. |
|
14581 "assertDOMException..." |
|
14582 self should:[ |
|
14583 docFrag insert:elemAlt before: elem. |
|
14584 ] raise: DOMException. |
|
14585 self assert: (lastException code == DOMException WRONG_DOCUMENT_ERR). |
|
14586 "end of assertDOMException..." |
|
14587 |
|
14588 ! |
|
14589 |
|
14590 test_nodeinsertbefore14 |
|
14591 " |
|
14592 The method insertBefore inserts the node newChild before the existing child node refChild. |
|
14593 If refChild is null, insert newChild at the end of the list of children. |
|
14594 A NO_MODIFICATION_ALLOWED_ERR is raised if the node is read-only. |
|
14595 |
|
14596 Using insertBefore on this Document node attempt to insert a new Attr node before |
|
14597 this DocumentType node and verfiy if a NO_MODIFICATION_ALLOWED_ERR is raised. |
|
14598 (This can also raise a HIERARCHY_REQUEST_ERR and NOT_FOUND_ERR) |
|
14599 |
|
14600 Creator: IBM |
|
14601 Autor Neil Delima |
|
14602 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14603 " |
|
14604 | |
|
14605 doc "Document" |
|
14606 docType "DocumentType" |
|
14607 newAttr "Attr" |
|
14608 inserted "Node" |
|
14609 | |
|
14610 "implementationAttribute not supported: namespaceAware" |
|
14611 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14612 docType := doc doctype. |
|
14613 newAttr := doc createAttribute:'dom3:attr' ns:'http://www.w3.org/DOM/Test'. |
|
14614 "assertDOMException..." |
|
14615 self should:[ |
|
14616 docType insert:newAttr before: docType. |
|
14617 ] raise: DOMException. |
|
14618 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
14619 "end of assertDOMException..." |
|
14620 |
|
14621 ! |
|
14622 |
|
14623 test_nodeinsertbefore15 |
|
14624 " |
|
14625 A NO_MODIFICATION_ALLOWED_ERR is raised if the node is read-only. |
|
14626 |
|
14627 Using insertBefore on a new EntityReference node attempt to insert Element, Text, |
|
14628 Comment, ProcessingInstruction and CDATASection nodes before an element child |
|
14629 and verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
14630 |
|
14631 Creator: IBM |
|
14632 Autor Neil Delima |
|
14633 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14634 " |
|
14635 | |
|
14636 doc "Document" |
|
14637 entRef "EntityReference" |
|
14638 elemChild "Node" |
|
14639 txt "Text" |
|
14640 elem "Element" |
|
14641 comment "Comment" |
|
14642 pi "ProcessingInstruction" |
|
14643 cdata "CDATASection" |
|
14644 inserted "Node" |
|
14645 | |
|
14646 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14647 entRef := doc createEntityReference:'delta'. |
|
14648 elemChild := entRef firstChild. |
|
14649 cdata := doc createCDATASection:'CDATASection'. |
|
14650 "assertDOMException..." |
|
14651 self should:[ |
|
14652 entRef insert:cdata before: elemChild. |
|
14653 ] raise: DOMException. |
|
14654 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
14655 "end of assertDOMException..." |
|
14656 pi := doc createProcessingInstruction:'target' data:'data'. |
|
14657 "assertDOMException..." |
|
14658 self should:[ |
|
14659 entRef insert:pi before: elemChild. |
|
14660 ] raise: DOMException. |
|
14661 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
14662 "end of assertDOMException..." |
|
14663 comment := doc createComment:'Comment'. |
|
14664 "assertDOMException..." |
|
14665 self should:[ |
|
14666 entRef insert:comment before: elemChild. |
|
14667 ] raise: DOMException. |
|
14668 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
14669 "end of assertDOMException..." |
|
14670 txt := doc createTextNode:'Text'. |
|
14671 "assertDOMException..." |
|
14672 self should:[ |
|
14673 entRef insert:txt before: elemChild. |
|
14674 ] raise: DOMException. |
|
14675 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
14676 "end of assertDOMException..." |
|
14677 elem := doc createElement:'body' ns:'http://www.w3.org/1999/xhtml'. |
|
14678 "assertDOMException..." |
|
14679 self should:[ |
|
14680 entRef insert:elem before: elemChild. |
|
14681 ] raise: DOMException. |
|
14682 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
14683 "end of assertDOMException..." |
|
14684 |
|
14685 ! |
|
14686 |
|
14687 test_nodeinsertbefore16 |
|
14688 " |
|
14689 Using insertBefore on an Element node attempt to insert a new Element, node before its |
|
14690 first element child and verify the name of the new first child node. |
|
14691 |
|
14692 Creator: IBM |
|
14693 Autor Neil Delima |
|
14694 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14695 " |
|
14696 | |
|
14697 doc "Document" |
|
14698 element "Element" |
|
14699 newElem "Element" |
|
14700 refElem "Element" |
|
14701 firstChild "Node" |
|
14702 insertedElem "Element" |
|
14703 childList "NodeList" |
|
14704 nodeName "String" |
|
14705 inserted "Node" |
|
14706 | |
|
14707 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14708 childList := doc getElementsByTagName: 'p'. |
|
14709 element := childList item:0. |
|
14710 firstChild := element firstChild. |
|
14711 refElem := firstChild nextSibling. |
|
14712 newElem := doc createElement:'xhtml:br' ns:'http://www.w3.org/1999/xhtml'. |
|
14713 element insert:newElem before: refElem. |
|
14714 childList := doc getElementsByTagName: 'p'. |
|
14715 element := childList item:0. |
|
14716 firstChild := element firstChild. |
|
14717 insertedElem := firstChild nextSibling. |
|
14718 nodeName := insertedElem nodeName. |
|
14719 self assert: ( nodeName = 'xhtml:br' ). |
|
14720 |
|
14721 ! |
|
14722 |
|
14723 test_nodeinsertbefore17 |
|
14724 " |
|
14725 The method insertBefore inserts the node newChild before the existing child node refChild. |
|
14726 If refChild is null, insert newChild at the end of the list of children. |
|
14727 |
|
14728 Using insertBefore on an Element node attempt to insert a text node before its |
|
14729 first element child and verify the name of the new first child node. |
|
14730 |
|
14731 Creator: IBM |
|
14732 Autor Neil Delima |
|
14733 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14734 " |
|
14735 | |
|
14736 doc "Document" |
|
14737 element "Element" |
|
14738 newText "Text" |
|
14739 refNode "Node" |
|
14740 firstChild "Node" |
|
14741 insertedText "Text" |
|
14742 childList "NodeList" |
|
14743 nodeName "String" |
|
14744 inserted "Node" |
|
14745 | |
|
14746 "implementationAttribute not supported: namespaceAware" |
|
14747 "implementationAttribute not supported: expandEntityReferences" |
|
14748 "implementationAttribute not supported: coalescing" |
|
14749 ^self. "ignoringElementContentWhitespace supported" |
|
14750 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14751 childList := doc getElementsByTagName: 'p' ns: '*'. |
|
14752 element := childList item:1. |
|
14753 refNode := element firstChild. |
|
14754 newText := doc createTextNode:'newText'. |
|
14755 element insert:newText before: refNode. |
|
14756 insertedText := element firstChild. |
|
14757 nodeName := insertedText nodeName. |
|
14758 self assert: ( nodeName = '#text' ). |
|
14759 |
|
14760 ! |
|
14761 |
|
14762 test_nodeinsertbefore18 |
|
14763 " |
|
14764 The method insertBefore inserts the node newChild before the existing child node refChild. |
|
14765 If refChild is null, insert newChild at the end of the list of children. |
|
14766 |
|
14767 Using insertBefore on an Element node attempt to insert new Comment/PI and CDATA nodes |
|
14768 before each other and verify the names of the newly inserted nodes. |
|
14769 |
|
14770 Creator: IBM |
|
14771 Autor Neil Delima |
|
14772 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14773 " |
|
14774 | |
|
14775 doc "Document" |
|
14776 element "Element" |
|
14777 newElem "Element" |
|
14778 newComment "Comment" |
|
14779 newPI "ProcessingInstruction" |
|
14780 newCDATA "CDATASection" |
|
14781 insertedNode "Comment" |
|
14782 data "String" |
|
14783 target "String" |
|
14784 appendedChild "Node" |
|
14785 inserted "Node" |
|
14786 | |
|
14787 "implementationAttribute not supported: namespaceAware" |
|
14788 "implementationAttribute not supported: expandEntityReferences" |
|
14789 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14790 element := doc createElement:'element'. |
|
14791 newElem := doc createElement:'dom3:elem' ns:'http://www.w3.org/DOM'. |
|
14792 newComment := doc createComment:'Comment'. |
|
14793 newCDATA := doc createCDATASection:'CDATASection'. |
|
14794 newPI := doc createProcessingInstruction:'target' data:'data'. |
|
14795 appendedChild := element appendChild:newElem. |
|
14796 appendedChild := element appendChild:newComment. |
|
14797 appendedChild := element appendChild:newPI. |
|
14798 appendedChild := element appendChild:newCDATA. |
|
14799 element insert:newComment before: newElem. |
|
14800 insertedNode := element firstChild. |
|
14801 data := insertedNode data. |
|
14802 self assert: ( data = 'Comment' ). |
|
14803 |
|
14804 ! |
|
14805 |
|
14806 test_nodeinsertbefore19 |
|
14807 " |
|
14808 Using insertBefore on an Element node attempt to insert an EntityReference node, before |
|
14809 another new EntityReference node and verify the name of the new first child node. |
|
14810 |
|
14811 Creator: IBM |
|
14812 Autor Neil Delima |
|
14813 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14814 " |
|
14815 | |
|
14816 doc "Document" |
|
14817 refNode "Node" |
|
14818 newNode "EntityReference" |
|
14819 inserted "EntityReference" |
|
14820 childList "NodeList" |
|
14821 nodeName "String" |
|
14822 element "Element" |
|
14823 | |
|
14824 "implementationAttribute not supported: expandEntityReferences" |
|
14825 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14826 childList := doc getElementsByTagName: 'var'. |
|
14827 element := childList item:2. |
|
14828 refNode := element firstChild. |
|
14829 newNode := doc createEntityReference:'alpha'. |
|
14830 element insert:newNode before: refNode. |
|
14831 nodeName := inserted nodeName. |
|
14832 self assert: ( nodeName = 'alpha' ). |
|
14833 |
|
14834 ! |
|
14835 |
|
14836 test_nodeinsertbefore20 |
|
14837 " |
|
14838 Using insertBefore on an Element node attempt to insert a new Attr node, before |
|
14839 an EntityReference child and verify if a HIERARCHY_REQUEST_ERR is raised. |
|
14840 |
|
14841 Creator: IBM |
|
14842 Autor Neil Delima |
|
14843 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14844 " |
|
14845 | |
|
14846 doc "Document" |
|
14847 element "Element" |
|
14848 refNode "Node" |
|
14849 newNode "Attr" |
|
14850 childList "NodeList" |
|
14851 inserted "Node" |
|
14852 | |
|
14853 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14854 childList := doc getElementsByTagName: 'var'. |
|
14855 element := childList item:2. |
|
14856 refNode := element firstChild. |
|
14857 newNode := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
14858 "assertDOMException..." |
|
14859 self should:[ |
|
14860 element insert:newNode before: refNode. |
|
14861 ] raise: DOMException. |
|
14862 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
14863 "end of assertDOMException..." |
|
14864 |
|
14865 ! |
|
14866 |
|
14867 test_nodeinsertbefore21 |
|
14868 " |
|
14869 Using insertBefore on an Element node attempt to insert the parent Element node, before |
|
14870 an EntityReference or Text child and verify if a HIERARCHY_REQUEST_ERR is raised. |
|
14871 |
|
14872 Creator: IBM |
|
14873 Autor Neil Delima |
|
14874 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14875 " |
|
14876 | |
|
14877 doc "Document" |
|
14878 element "Element" |
|
14879 refNode "Node" |
|
14880 newNode "Element" |
|
14881 childList "NodeList" |
|
14882 inserted "Node" |
|
14883 | |
|
14884 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14885 childList := doc getElementsByTagName: 'var'. |
|
14886 element := childList item:2. |
|
14887 refNode := element firstChild. |
|
14888 newNode := element parentNode. |
|
14889 "assertDOMException..." |
|
14890 self should:[ |
|
14891 element insert:newNode before: refNode. |
|
14892 ] raise: DOMException. |
|
14893 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
14894 "end of assertDOMException..." |
|
14895 |
|
14896 ! |
|
14897 |
|
14898 test_nodeinsertbefore22 |
|
14899 " |
|
14900 Using insertBefore on an Element node attempt to insert the ancestor of an Element node |
|
14901 before its child and verify if a HIERARCHY_REQUEST_ERR is raised. |
|
14902 |
|
14903 Creator: IBM |
|
14904 Autor Neil Delima |
|
14905 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14906 " |
|
14907 | |
|
14908 doc "Document" |
|
14909 element "Element" |
|
14910 refNode "Element" |
|
14911 ancestor "Element" |
|
14912 childList "NodeList" |
|
14913 appendedChild "Node" |
|
14914 inserted "Node" |
|
14915 | |
|
14916 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
14917 element := doc createElement:'xhtml:body' ns:'http://www.w3.org/1999/xhtml'. |
|
14918 refNode := doc createElement:'xhtml:a' ns:'http://www.w3.org/1999/xhtml'. |
|
14919 ancestor := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
14920 appendedChild := element appendChild:refNode. |
|
14921 appendedChild := ancestor appendChild:element. |
|
14922 "assertDOMException..." |
|
14923 self should:[ |
|
14924 element insert:ancestor before: refNode. |
|
14925 ] raise: DOMException. |
|
14926 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
14927 "end of assertDOMException..." |
|
14928 |
|
14929 ! |
|
14930 |
|
14931 test_nodeinsertbefore23 |
|
14932 " |
|
14933 Using insertBefore on an Element node attempt to insert a Text node created by a different |
|
14934 Document before an Element child and verify if a WRONG_DOCUMENT_ERR is raised. |
|
14935 |
|
14936 Creator: IBM |
|
14937 Autor Neil Delima |
|
14938 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14939 " |
|
14940 | |
|
14941 doc "Document" |
|
14942 doc2 "Document" |
|
14943 element "Element" |
|
14944 refNode "Element" |
|
14945 newNode "Text" |
|
14946 childList "NodeList" |
|
14947 appendedChild "Node" |
|
14948 inserted "Node" |
|
14949 | |
|
14950 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14951 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14952 element := doc createElement:'xhtml:body' ns:'http://www.w3.org/1999/xhtml'. |
|
14953 refNode := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
14954 newNode := doc2 createTextNode:'TextNode'. |
|
14955 appendedChild := element appendChild:refNode. |
|
14956 "assertDOMException..." |
|
14957 self should:[ |
|
14958 element insert:newNode before: refNode. |
|
14959 ] raise: DOMException. |
|
14960 self assert: (lastException code == DOMException WRONG_DOCUMENT_ERR). |
|
14961 "end of assertDOMException..." |
|
14962 |
|
14963 ! |
|
14964 |
|
14965 test_nodeinsertbefore24 |
|
14966 " |
|
14967 Using insertBefore on an Element node attempt to insert a Comment node before |
|
14968 a CDATASection node that is not a child and verify if a NOT_FOUND_ERR is raised. |
|
14969 |
|
14970 Creator: IBM |
|
14971 Autor Neil Delima |
|
14972 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
14973 " |
|
14974 | |
|
14975 doc "Document" |
|
14976 element "Element" |
|
14977 refNode "CDATASection" |
|
14978 newNode "Comment" |
|
14979 childList "NodeList" |
|
14980 inserted "Node" |
|
14981 | |
|
14982 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
14983 element := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
14984 refNode := doc createCDATASection:'CDATASection'. |
|
14985 newNode := doc createComment:'Comment'. |
|
14986 "assertDOMException..." |
|
14987 self should:[ |
|
14988 element insert:newNode before: refNode. |
|
14989 ] raise: DOMException. |
|
14990 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
14991 "end of assertDOMException..." |
|
14992 |
|
14993 ! |
|
14994 |
|
14995 test_nodeinsertbefore25 |
|
14996 " |
|
14997 Using insertBefore on a child Element of an EntityReference node attempt to insert |
|
14998 a new Element node, before a Text node child of an Entity Node's replacement |
|
14999 text and verify if a NO_MODIFICATION_ALLOWED_ERR is raised. |
|
15000 |
|
15001 Creator: IBM |
|
15002 Autor Neil Delima |
|
15003 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-952280727 |
|
15004 " |
|
15005 | |
|
15006 doc "Document" |
|
15007 element "Element" |
|
15008 eRef "EntityReference" |
|
15009 span "Element" |
|
15010 spanText "Text" |
|
15011 newNode "Element" |
|
15012 childList "NodeList" |
|
15013 inserted "Node" |
|
15014 | |
|
15015 "implementationAttribute not supported: expandEntityReferences" |
|
15016 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15017 childList := doc getElementsByTagName: 'var'. |
|
15018 element := childList item:2. |
|
15019 eRef := element firstChild. |
|
15020 span := eRef firstChild. |
|
15021 self assert: span notNil. |
|
15022 spanText := span firstChild. |
|
15023 self assert: spanText notNil. |
|
15024 newNode := doc createElement:'span' ns:'http://www.w3.org/1999/xhtml'. |
|
15025 "assertDOMException..." |
|
15026 self should:[ |
|
15027 span insert:newNode before: spanText. |
|
15028 ] raise: DOMException. |
|
15029 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
15030 "end of assertDOMException..." |
|
15031 |
|
15032 ! |
|
15033 |
|
15034 test_nodeisdefaultnamespace01 |
|
15035 " |
|
15036 Using isDefaultNamespace on this Document node with the |
|
15037 namespace of the document element check if the value returned is true. |
|
15038 |
|
15039 Creator: IBM |
|
15040 Autor Neil Delima |
|
15041 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15042 " |
|
15043 | |
|
15044 doc "Document" |
|
15045 isDefault "Boolean" |
|
15046 docElem "Element" |
|
15047 docElemNS "String" |
|
15048 | |
|
15049 "implementationAttribute not supported: namespaceAware" |
|
15050 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15051 docElem := doc documentElement. |
|
15052 docElemNS := docElem namespaceURI. |
|
15053 isDefault := doc isDefaultNamespace: docElemNS. |
|
15054 self assert: isDefault. |
|
15055 |
|
15056 ! |
|
15057 |
|
15058 test_nodeisdefaultnamespace02 |
|
15059 " |
|
15060 Using isDefaultNamespace on on a new Document node with the value of the namespaceURI |
|
15061 parameter equal to the namespaceURI of the newly created Document and check if the |
|
15062 value returned is false. |
|
15063 |
|
15064 Creator: IBM |
|
15065 Autor Neil Delima |
|
15066 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15067 " |
|
15068 | |
|
15069 doc "Document" |
|
15070 domImpl "DOMImplementation" |
|
15071 newDoc "Document" |
|
15072 isDefault "Boolean" |
|
15073 nullDocType "DocumentType" |
|
15074 nullNSURI "String" |
|
15075 docElem "Element" |
|
15076 rootNS "String" |
|
15077 rootName "String" |
|
15078 | |
|
15079 "implementationAttribute not supported: namespaceAware" |
|
15080 nullDocType := nil. |
|
15081 nullNSURI := nil. |
|
15082 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15083 docElem := doc documentElement. |
|
15084 rootNS := docElem namespaceURI. |
|
15085 rootName := docElem localName. |
|
15086 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
15087 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15088 isDefault := newDoc isDefaultNamespace: rootNS. |
|
15089 self assert: isDefault. |
|
15090 isDefault := newDoc isDefaultNamespace: nullNSURI. |
|
15091 self deny: isDefault. |
|
15092 |
|
15093 ! |
|
15094 |
|
15095 test_nodeisdefaultnamespace03 |
|
15096 " |
|
15097 |
|
15098 |
|
15099 |
|
15100 Using isDefaultNamespace on this DocumentType node with the value of the namespaceURI parameter |
|
15101 as null check if the value returned is false. |
|
15102 |
|
15103 Creator: IBM |
|
15104 Autor Neil Delima |
|
15105 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15106 " |
|
15107 | |
|
15108 doc "Document" |
|
15109 docType "DocumentType" |
|
15110 isDefault "Boolean" |
|
15111 nullNSURI "String" |
|
15112 | |
|
15113 "implementationAttribute not supported: namespaceAware" |
|
15114 nullNSURI := nil. |
|
15115 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15116 docType := doc doctype. |
|
15117 isDefault := docType isDefaultNamespace: nullNSURI. |
|
15118 self deny: isDefault. |
|
15119 |
|
15120 ! |
|
15121 |
|
15122 test_nodeisdefaultnamespace04 |
|
15123 " |
|
15124 |
|
15125 |
|
15126 |
|
15127 Using isDefaultNamespace on a Notation and Entity node with the value of the namespaceURI parameter |
|
15128 as null check if the value returned is false. |
|
15129 |
|
15130 Creator: IBM |
|
15131 Autor Neil Delima |
|
15132 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15133 " |
|
15134 | |
|
15135 doc "Document" |
|
15136 docType "DocumentType" |
|
15137 entity "Entity" |
|
15138 notation "Notation" |
|
15139 entitiesMap "NamedNodeMap" |
|
15140 notationsMap "NamedNodeMap" |
|
15141 isDefault "Boolean" |
|
15142 nullNSURI "String" |
|
15143 | |
|
15144 "implementationAttribute not supported: namespaceAware" |
|
15145 nullNSURI := nil. |
|
15146 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15147 docType := doc doctype. |
|
15148 entitiesMap := docType entities. |
|
15149 notationsMap := docType notations. |
|
15150 entity := entitiesMap getNamedItem:'alpha'. |
|
15151 notation := notationsMap getNamedItem:'notation1'. |
|
15152 isDefault := entity isDefaultNamespace. |
|
15153 self deny: isDefault. |
|
15154 isDefault := notation isDefaultNamespace. |
|
15155 self deny: isDefault. |
|
15156 |
|
15157 ! |
|
15158 |
|
15159 test_nodeisdefaultnamespace05 |
|
15160 " |
|
15161 Using isDefaultNamespace on a DocumentElement of a new Document node with the value of the |
|
15162 namespaceURI parameter equal to the namespaceURI of the newly created Document and check if the |
|
15163 value returned is false. |
|
15164 |
|
15165 Creator: IBM |
|
15166 Autor Neil Delima |
|
15167 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15168 " |
|
15169 | |
|
15170 doc "Document" |
|
15171 elem "Element" |
|
15172 domImpl "DOMImplementation" |
|
15173 newDoc "Document" |
|
15174 isDefault "Boolean" |
|
15175 nullDocType "DocumentType" |
|
15176 nullNSURI "String" |
|
15177 docElem "Element" |
|
15178 rootNS "String" |
|
15179 rootName "String" |
|
15180 | |
|
15181 "implementationAttribute not supported: namespaceAware" |
|
15182 nullDocType := nil. |
|
15183 nullNSURI := nil. |
|
15184 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15185 docElem := doc documentElement. |
|
15186 rootNS := docElem namespaceURI. |
|
15187 rootName := docElem localName. |
|
15188 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
15189 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15190 elem := newDoc documentElement. |
|
15191 isDefault := elem isDefaultNamespace: rootNS. |
|
15192 self assert: isDefault. |
|
15193 isDefault := elem isDefaultNamespace: nullNSURI. |
|
15194 self deny: isDefault. |
|
15195 |
|
15196 ! |
|
15197 |
|
15198 test_nodeisdefaultnamespace06 |
|
15199 " |
|
15200 Using isDefaultNamespace on an Element node with no prefix, which has a namespace |
|
15201 attribute declaration with and without a namespace prefix and check if isDefaultNamespace |
|
15202 returns true with the namespaceURI that does not have a prefix as its parameter. |
|
15203 |
|
15204 Creator: IBM |
|
15205 Autor Neil Delima |
|
15206 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15207 " |
|
15208 | |
|
15209 doc "Document" |
|
15210 elem "Element" |
|
15211 elemList "NodeList" |
|
15212 isDefault "Boolean" |
|
15213 | |
|
15214 "implementationAttribute not supported: namespaceAware" |
|
15215 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15216 elemList := doc getElementsByTagName: 'p'. |
|
15217 elem := elemList item:0. |
|
15218 isDefault := elem isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15219 self assert: isDefault. |
|
15220 isDefault := elem isDefaultNamespace: 'http://www.usa.com'. |
|
15221 self deny: isDefault. |
|
15222 |
|
15223 ! |
|
15224 |
|
15225 test_nodeisdefaultnamespace07 |
|
15226 " |
|
15227 Using isDefaultNamespace on the child of an Element node with no prefix, which has a |
|
15228 namespace attribute declaration with and without a namespace prefix and check if isDefaultNamespace |
|
15229 returns true with the namespaceURI that does not have a prefix as its parameter. |
|
15230 |
|
15231 Creator: IBM |
|
15232 Autor Neil Delima |
|
15233 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15234 " |
|
15235 | |
|
15236 doc "Document" |
|
15237 elem "Element" |
|
15238 elemList "NodeList" |
|
15239 isDefault "Boolean" |
|
15240 | |
|
15241 "implementationAttribute not supported: namespaceAware" |
|
15242 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15243 elemList := doc getElementsByTagName: 'acronym'. |
|
15244 elem := elemList item:0. |
|
15245 isDefault := elem isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15246 self assert: isDefault. |
|
15247 isDefault := elem isDefaultNamespace: 'http://www.usa.com'. |
|
15248 self deny: isDefault. |
|
15249 |
|
15250 ! |
|
15251 |
|
15252 test_nodeisdefaultnamespace08 |
|
15253 " |
|
15254 |
|
15255 |
|
15256 |
|
15257 Using isDefaultNamespace on an Element node with a prefix, which has a namespace |
|
15258 attribute declaration with a namespace prefix and check if isDefaultNamespace |
|
15259 returns false with this namespaceURI as its parameter. |
|
15260 |
|
15261 Creator: IBM |
|
15262 Autor Neil Delima |
|
15263 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15264 " |
|
15265 | |
|
15266 doc "Document" |
|
15267 elem "Element" |
|
15268 elemList "NodeList" |
|
15269 isDefault "Boolean" |
|
15270 | |
|
15271 "implementationAttribute not supported: namespaceAware" |
|
15272 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15273 elemList := doc getElementsByTagName: 'strong'. |
|
15274 elem := elemList item:3. |
|
15275 isDefault := elem isDefaultNamespace: 'http://www.altavista.com'. |
|
15276 self deny: isDefault. |
|
15277 |
|
15278 ! |
|
15279 |
|
15280 test_nodeisdefaultnamespace09 |
|
15281 " |
|
15282 Using isDefaultNamespace on a new Child of a new Element node with a namespace URI |
|
15283 and prefix and using the parents namespace URI as an argument, verify if the |
|
15284 value returned is false. |
|
15285 |
|
15286 Creator: IBM |
|
15287 Autor Neil Delima |
|
15288 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15289 " |
|
15290 | |
|
15291 doc "Document" |
|
15292 parent "Element" |
|
15293 child "Element" |
|
15294 isDefault "Boolean" |
|
15295 appendedChild "Node" |
|
15296 | |
|
15297 "implementationAttribute not supported: namespaceAware" |
|
15298 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15299 parent := doc createElement:'xhtml:body' ns:'http://www.w3.org/1999/xhtml'. |
|
15300 child := doc createElement:'xhtml:p'. |
|
15301 appendedChild := parent appendChild:child. |
|
15302 isDefault := parent isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15303 self deny: isDefault. |
|
15304 isDefault := child isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15305 self deny: isDefault. |
|
15306 |
|
15307 ! |
|
15308 |
|
15309 test_nodeisdefaultnamespace10 |
|
15310 " |
|
15311 Using isDefaultNamespace on a new Child of a new Element node with a namespace URI |
|
15312 and prefix and using the childs namespace URI as an argument, verify if the |
|
15313 value returned is true. |
|
15314 |
|
15315 Creator: IBM |
|
15316 Autor Neil Delima |
|
15317 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15318 " |
|
15319 | |
|
15320 doc "Document" |
|
15321 parent "Element" |
|
15322 child "Element" |
|
15323 isDefault "Boolean" |
|
15324 appendedChild "Node" |
|
15325 | |
|
15326 "implementationAttribute not supported: namespaceAware" |
|
15327 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15328 parent := doc createElement:'xhtml:body' ns:'http://www.w3.org/1999/xhtml'. |
|
15329 child := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
15330 appendedChild := parent appendChild:child. |
|
15331 isDefault := child isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15332 self assert: isDefault. |
|
15333 isDefault := parent isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15334 self deny: isDefault. |
|
15335 |
|
15336 ! |
|
15337 |
|
15338 test_nodeisdefaultnamespace11 |
|
15339 " |
|
15340 Using isDefaultNamespace on an imported new Element node with a namespace URI and prefix |
|
15341 in a new Document and using the parent's namespace URI as an argument, verify if the |
|
15342 value returned is true. |
|
15343 |
|
15344 Creator: IBM |
|
15345 Autor Neil Delima |
|
15346 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15347 " |
|
15348 | |
|
15349 doc "Document" |
|
15350 domImpl "DOMImplementation" |
|
15351 newDoc "Document" |
|
15352 elem "Element" |
|
15353 importedNode "Element" |
|
15354 isDefault "Boolean" |
|
15355 nullDocType "DocumentType" |
|
15356 docElem "Element" |
|
15357 rootNS "String" |
|
15358 rootName "String" |
|
15359 | |
|
15360 "implementationAttribute not supported: namespaceAware" |
|
15361 nullDocType := nil. |
|
15362 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15363 docElem := doc documentElement. |
|
15364 rootNS := docElem namespaceURI. |
|
15365 rootName := docElem tagName. |
|
15366 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
15367 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15368 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
15369 importedNode := newDoc importNode:elem deep:true. |
|
15370 isDefault := importedNode isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15371 self assert: isDefault. |
|
15372 |
|
15373 ! |
|
15374 |
|
15375 test_nodeisdefaultnamespace13 |
|
15376 " |
|
15377 Using isDefaultNamespace on a Element's new Text node, which has a namespace attribute |
|
15378 declaration without a namespace prefix in its parent Element node and verify if the |
|
15379 value returned is true. |
|
15380 |
|
15381 Creator: IBM |
|
15382 Autor Neil Delima |
|
15383 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15384 " |
|
15385 | |
|
15386 doc "Document" |
|
15387 bodyElem "Element" |
|
15388 elem "Element" |
|
15389 txt "Text" |
|
15390 isDefault "Boolean" |
|
15391 appendedChild "Node" |
|
15392 bodyList "NodeList" |
|
15393 | |
|
15394 "implementationAttribute not supported: namespaceAware" |
|
15395 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15396 bodyList := doc getElementsByTagName: 'body'. |
|
15397 bodyElem := bodyList item:0. |
|
15398 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
15399 txt := doc createTextNode:'Text'. |
|
15400 appendedChild := elem appendChild:txt. |
|
15401 appendedChild := bodyElem appendChild:elem. |
|
15402 isDefault := txt isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15403 self assert: isDefault. |
|
15404 |
|
15405 ! |
|
15406 |
|
15407 test_nodeisdefaultnamespace14 |
|
15408 " |
|
15409 Using isDefaultNamespace on a Element's new CDATASection node, which has a namespace attribute |
|
15410 declaration without a namespace prefix in its parent Element node and verify if the |
|
15411 value returned is true. |
|
15412 |
|
15413 Creator: IBM |
|
15414 Autor Neil Delima |
|
15415 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15416 " |
|
15417 | |
|
15418 doc "Document" |
|
15419 elem "Element" |
|
15420 cdata "CDATASection" |
|
15421 isDefault "Boolean" |
|
15422 appendedChild "Node" |
|
15423 bodyList "NodeList" |
|
15424 bodyElem "Element" |
|
15425 | |
|
15426 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15427 bodyList := doc getElementsByTagName: 'body'. |
|
15428 bodyElem := bodyList item:0. |
|
15429 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
15430 cdata := doc createCDATASection:'CDATASection'. |
|
15431 appendedChild := elem appendChild:cdata. |
|
15432 appendedChild := bodyElem appendChild:elem. |
|
15433 isDefault := cdata isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15434 self assert: isDefault. |
|
15435 |
|
15436 ! |
|
15437 |
|
15438 test_nodeisdefaultnamespace15 |
|
15439 " |
|
15440 Using isDefaultNamespace on a Element's new cloned Comment node, which has a namespace attribute |
|
15441 declaration without a namespace prefix in its parent Element node and verify if the |
|
15442 value returned is true. |
|
15443 |
|
15444 Creator: IBM |
|
15445 Autor Neil Delima |
|
15446 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15447 " |
|
15448 | |
|
15449 doc "Document" |
|
15450 bodyElem "Element" |
|
15451 elem "Element" |
|
15452 comment "Comment" |
|
15453 clonedComment "Comment" |
|
15454 isDefault "Boolean" |
|
15455 appendedChild "Node" |
|
15456 bodyList "NodeList" |
|
15457 | |
|
15458 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15459 bodyList := doc getElementsByTagName: 'body'. |
|
15460 bodyElem := bodyList item:0. |
|
15461 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
15462 comment := doc createComment:'Text'. |
|
15463 clonedComment := comment cloneNode:true. |
|
15464 appendedChild := elem appendChild:clonedComment. |
|
15465 appendedChild := bodyElem appendChild:elem. |
|
15466 isDefault := clonedComment isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15467 self assert: isDefault. |
|
15468 |
|
15469 ! |
|
15470 |
|
15471 test_nodeisdefaultnamespace16 |
|
15472 " |
|
15473 Using isDefaultNamespace on a new Attribute node with with a namespace URI |
|
15474 and no prefix and verify if the value returned is false since default namespaces |
|
15475 do not apply directly to attributes. |
|
15476 |
|
15477 Creator: IBM |
|
15478 Autor Neil Delima |
|
15479 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isDefaultNamespace |
|
15480 " |
|
15481 | |
|
15482 doc "Document" |
|
15483 attr "Attr" |
|
15484 isDefault "Boolean" |
|
15485 | |
|
15486 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
15487 attr := doc createAttribute:'lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
15488 isDefault := attr isDefaultNamespace: 'http://www.w3.org/1999/xhtml'. |
|
15489 self deny: isDefault. |
|
15490 |
|
15491 ! |
|
15492 |
|
15493 test_nodeisequalnode01 |
|
15494 " |
|
15495 |
|
15496 |
|
15497 Using isEqualNode check if 2 Document nodes created by parsing the same xml document |
|
15498 are equal. |
|
15499 |
|
15500 Creator: IBM |
|
15501 Autor Neil Delima |
|
15502 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15503 " |
|
15504 | |
|
15505 doc1 "Document" |
|
15506 doc2 "Document" |
|
15507 isEqual "Boolean" |
|
15508 | |
|
15509 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15510 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15511 isEqual := doc1 isEqualNode:doc2. |
|
15512 self assert: isEqual. |
|
15513 |
|
15514 ! |
|
15515 |
|
15516 test_nodeisequalnode02 |
|
15517 " |
|
15518 Using isEqualNode check if 2 newly created Document nodes having the same namespaceURI |
|
15519 and qualifiedName are equal. |
|
15520 |
|
15521 Creator: IBM |
|
15522 Autor Neil Delima |
|
15523 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15524 " |
|
15525 | |
|
15526 doc "Document" |
|
15527 domImpl "DOMImplementation" |
|
15528 doc1 "Document" |
|
15529 doc2 "Document" |
|
15530 isEqual "Boolean" |
|
15531 nullDocType "DocumentType" |
|
15532 docElem "Element" |
|
15533 rootNS "String" |
|
15534 rootName "String" |
|
15535 | |
|
15536 nullDocType := nil. |
|
15537 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15538 docElem := doc documentElement. |
|
15539 rootNS := docElem namespaceURI. |
|
15540 rootName := docElem tagName. |
|
15541 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
15542 doc1 := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15543 doc2 := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15544 isEqual := doc1 isEqualNode:doc2. |
|
15545 self assert: isEqual. |
|
15546 |
|
15547 ! |
|
15548 |
|
15549 test_nodeisequalnode03 |
|
15550 " |
|
15551 Using isEqualNode check if 2 Document nodes created by parsing |
|
15552 documents only differing in declared encoding return false for isEqualNode on |
|
15553 the document and true on the document element. |
|
15554 |
|
15555 Creator: IBM |
|
15556 Autor Neil Delima |
|
15557 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15558 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=528 |
|
15559 " |
|
15560 | |
|
15561 doc1 "Document" |
|
15562 doc2 "Document" |
|
15563 docElem1 "Element" |
|
15564 docElem2 "Element" |
|
15565 isEqual "Boolean" |
|
15566 | |
|
15567 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf8'). |
|
15568 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_utf16'). |
|
15569 isEqual := doc1 isEqualNode:doc2. |
|
15570 self assert: isEqual. |
|
15571 docElem1 := doc1 documentElement. |
|
15572 docElem2 := doc2 documentElement. |
|
15573 isEqual := docElem1 isEqualNode:docElem2. |
|
15574 self assert: isEqual. |
|
15575 |
|
15576 ! |
|
15577 |
|
15578 test_nodeisequalnode04 |
|
15579 " |
|
15580 Create a new Element node in this Document. return its ownerDocument and check if the |
|
15581 the ownerDocument is equal to this Document using isEqualNode. |
|
15582 |
|
15583 Creator: IBM |
|
15584 Autor Neil Delima |
|
15585 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15586 " |
|
15587 | |
|
15588 doc "Document" |
|
15589 ownerDoc "Document" |
|
15590 elem "Element" |
|
15591 isEqual "Boolean" |
|
15592 | |
|
15593 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
15594 elem := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
15595 ownerDoc := elem ownerDocument. |
|
15596 isEqual := doc isEqualNode:ownerDoc. |
|
15597 self assert: isEqual. |
|
15598 |
|
15599 ! |
|
15600 |
|
15601 test_nodeisequalnode05 |
|
15602 " |
|
15603 Using isEqualNode check if 2 Document nodes created by parsing different xml document |
|
15604 are equal. |
|
15605 |
|
15606 Creator: IBM |
|
15607 Autor Neil Delima |
|
15608 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15609 " |
|
15610 | |
|
15611 doc1 "Document" |
|
15612 doc2 "Document" |
|
15613 isEqual "Boolean" |
|
15614 | |
|
15615 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_standalone_yes'). |
|
15616 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
15617 isEqual := doc1 isEqualNode:doc2. |
|
15618 self deny: isEqual. |
|
15619 |
|
15620 ! |
|
15621 |
|
15622 test_nodeisequalnode06 |
|
15623 " |
|
15624 |
|
15625 |
|
15626 Using isEqualNode check if 2 Element nodes having the same nodeName and namespaceURI attribute |
|
15627 are equal. |
|
15628 |
|
15629 Creator: IBM |
|
15630 Autor Neil Delima |
|
15631 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15632 " |
|
15633 | |
|
15634 doc "Document" |
|
15635 elem1 "Element" |
|
15636 elem2 "Element" |
|
15637 isEqual "Boolean" |
|
15638 | |
|
15639 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15640 elem1 := doc createElement:'xhtml:html' ns:'http://www.w3.org/1999/xhtml'. |
|
15641 elem2 := doc createElement:'xhtml:html' ns:'http://www.w3.org/1999/xhtml'. |
|
15642 isEqual := elem1 isEqualNode:elem2. |
|
15643 self assert: isEqual. |
|
15644 |
|
15645 ! |
|
15646 |
|
15647 test_nodeisequalnode07 |
|
15648 " |
|
15649 Using isEqualNode check if 2 Element nodes having the same nodeName and namespaceURI attribute |
|
15650 created by two different Document objects obtained by parsing the same xml document are equal. |
|
15651 |
|
15652 Creator: IBM |
|
15653 Autor Neil Delima |
|
15654 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15655 " |
|
15656 | |
|
15657 doc1 "Document" |
|
15658 doc2 "Document" |
|
15659 elem1 "Element" |
|
15660 elem2 "Element" |
|
15661 isEqual "Boolean" |
|
15662 | |
|
15663 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15664 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15665 elem1 := doc1 createElement:'xhtml:html' ns:'http://www.w3.org/1999/xhtml'. |
|
15666 elem2 := doc2 createElement:'xhtml:html' ns:'http://www.w3.org/1999/xhtml'. |
|
15667 isEqual := elem1 isEqualNode:elem2. |
|
15668 self assert: isEqual. |
|
15669 |
|
15670 ! |
|
15671 |
|
15672 test_nodeisequalnode08 |
|
15673 " |
|
15674 |
|
15675 |
|
15676 Retreive an element node of this Document having nodeName as employeeId and |
|
15677 namespaceURI as http://www.nist.gov. Create a new Element node having the same attributes |
|
15678 in this Document and using isEqualNode check if 2 Element nodes are equal. |
|
15679 |
|
15680 Creator: IBM |
|
15681 Autor Neil Delima |
|
15682 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15683 " |
|
15684 | |
|
15685 doc "Document" |
|
15686 elem1 "Element" |
|
15687 elem2 "Element" |
|
15688 employeeList "NodeList" |
|
15689 text "Text" |
|
15690 isEqual "Boolean" |
|
15691 appendedChild "Node" |
|
15692 | |
|
15693 "implementationAttribute not supported: namespaceAware" |
|
15694 ^self. "ignoringElementContentWhitespace supported" |
|
15695 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15696 employeeList := doc getElementsByTagName: 'em'. |
|
15697 elem1 := employeeList item:0. |
|
15698 elem2 := doc createElement:'em' ns:'http://www.w3.org/1999/xhtml'. |
|
15699 text := doc createTextNode:'EMP0001'. |
|
15700 appendedChild := elem2 appendChild:text. |
|
15701 isEqual := elem1 isEqualNode:elem2. |
|
15702 self assert: isEqual. |
|
15703 |
|
15704 ! |
|
15705 |
|
15706 test_nodeisequalnode09 |
|
15707 " |
|
15708 Get the first em node, construct an equivalent in a new document and see if isEqualNode |
|
15709 returns true. |
|
15710 |
|
15711 Creator: IBM |
|
15712 Autor Neil Delima |
|
15713 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15714 " |
|
15715 | |
|
15716 doc "Document" |
|
15717 domImpl "DOMImplementation" |
|
15718 newDoc "Document" |
|
15719 elem1 "Element" |
|
15720 elem2 "Element" |
|
15721 employeeList "NodeList" |
|
15722 text "Text" |
|
15723 isEqual "Boolean" |
|
15724 nullDocType "DocumentType" |
|
15725 appendedChild "Node" |
|
15726 docElem "Element" |
|
15727 rootNS "String" |
|
15728 rootName "String" |
|
15729 | |
|
15730 "implementationAttribute not supported: namespaceAware" |
|
15731 ^self. "ignoringElementContentWhitespace supported" |
|
15732 nullDocType := nil. |
|
15733 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15734 docElem := doc documentElement. |
|
15735 rootNS := docElem namespaceURI. |
|
15736 rootName := docElem localName. |
|
15737 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
15738 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15739 employeeList := doc getElementsByTagName: 'em'. |
|
15740 elem1 := employeeList item:0. |
|
15741 elem2 := newDoc createElement:'em' ns:'http://www.w3.org/1999/xhtml'. |
|
15742 text := newDoc createTextNode:'EMP0001'. |
|
15743 appendedChild := elem2 appendChild:text. |
|
15744 isEqual := elem1 isEqualNode:elem2. |
|
15745 self assert: isEqual. |
|
15746 |
|
15747 ! |
|
15748 |
|
15749 test_nodeisequalnode10 |
|
15750 " |
|
15751 Retreive 2 different em nodes of this Document Use isEqualNode |
|
15752 check if nodes are not equal. |
|
15753 |
|
15754 Creator: IBM |
|
15755 Autor Neil Delima |
|
15756 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15757 " |
|
15758 | |
|
15759 doc "Document" |
|
15760 elem1 "Element" |
|
15761 elem2 "Element" |
|
15762 employeeList "NodeList" |
|
15763 isEqual "Boolean" |
|
15764 | |
|
15765 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15766 employeeList := doc getElementsByTagName: 'em'. |
|
15767 elem1 := employeeList item:0. |
|
15768 elem2 := employeeList item:1. |
|
15769 isEqual := elem1 isEqualNode:elem2. |
|
15770 self deny: isEqual. |
|
15771 |
|
15772 ! |
|
15773 |
|
15774 test_nodeisequalnode11 |
|
15775 " |
|
15776 Retreive the first element node whose localName is p . Import it into a new |
|
15777 Document with deep=false. Using isEqualNode check if the original and the imported |
|
15778 Element Node are not equal the child nodes are different. |
|
15779 Import with deep and the should still be unequal if |
|
15780 validating since the |
|
15781 new document does not provide the same default attributes. |
|
15782 Import it into another instance of the source document |
|
15783 and then the imported node and the source should be equal. |
|
15784 |
|
15785 Creator: IBM |
|
15786 Autor Neil Delima |
|
15787 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15788 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=529 |
|
15789 " |
|
15790 | |
|
15791 doc "Document" |
|
15792 domImpl "DOMImplementation" |
|
15793 employeeList "NodeList" |
|
15794 newDoc "Document" |
|
15795 dupDoc "Document" |
|
15796 elem1 "Element" |
|
15797 elem2 "Element" |
|
15798 elem3 "Element" |
|
15799 elem4 "Element" |
|
15800 isEqual "Boolean" |
|
15801 nullDocType "DocumentType" |
|
15802 docElem "Element" |
|
15803 rootNS "String" |
|
15804 rootName "String" |
|
15805 | |
|
15806 nullDocType := nil. |
|
15807 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15808 docElem := doc documentElement. |
|
15809 rootNS := docElem namespaceURI. |
|
15810 rootName := docElem tagName. |
|
15811 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
15812 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15813 employeeList := doc getElementsByTagName: 'p'. |
|
15814 elem1 := employeeList item:0. |
|
15815 elem2 := newDoc importNode:elem1 deep:false. |
|
15816 isEqual := elem1 isEqualNode:elem2. |
|
15817 self deny: isEqual. |
|
15818 elem3 := newDoc importNode:elem1 deep:true. |
|
15819 isEqual := elem1 isEqualNode:elem3. |
|
15820 "if" |
|
15821 false "no template for element implementationAttribute" ifTrue: [ |
|
15822 ]. |
|
15823 dupDoc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15824 elem4 := dupDoc importNode:elem1 deep:true. |
|
15825 isEqual := elem1 isEqualNode:elem4. |
|
15826 self assert: isEqual. |
|
15827 |
|
15828 ! |
|
15829 |
|
15830 test_nodeisequalnode12 |
|
15831 " |
|
15832 |
|
15833 |
|
15834 Using isEqual verify if the 2 documentElement nodes of different documents created |
|
15835 by parsing the same xml document are equal. |
|
15836 |
|
15837 Creator: IBM |
|
15838 Autor Neil Delima |
|
15839 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15840 " |
|
15841 | |
|
15842 doc "Document" |
|
15843 elem1 "Element" |
|
15844 elem2 "Element" |
|
15845 isEqual "Boolean" |
|
15846 | |
|
15847 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15848 elem1 := doc documentElement. |
|
15849 elem2 := doc documentElement. |
|
15850 isEqual := elem1 isEqualNode:elem2. |
|
15851 self assert: isEqual. |
|
15852 |
|
15853 ! |
|
15854 |
|
15855 test_nodeisequalnode13 |
|
15856 " |
|
15857 Retreive the first element node whose localName is p . Import it into a new |
|
15858 Document with deep=false. Using isEqualNode check if the original and the imported |
|
15859 Element Node are not equal. Now import it once more with deep=true and using isEqual |
|
15860 verify if they are now equal. |
|
15861 |
|
15862 Creator: IBM |
|
15863 Autor Neil Delima |
|
15864 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15865 " |
|
15866 | |
|
15867 doc "Document" |
|
15868 domImpl "DOMImplementation" |
|
15869 newDoc "Document" |
|
15870 employeeList "NodeList" |
|
15871 elem1 "Element" |
|
15872 elem2 "Element" |
|
15873 elem3 "Element" |
|
15874 isEqual "Boolean" |
|
15875 nullDocType "DocumentType" |
|
15876 docElem "Element" |
|
15877 rootNS "String" |
|
15878 rootName "String" |
|
15879 | |
|
15880 nullDocType := nil. |
|
15881 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15882 docElem := doc documentElement. |
|
15883 rootNS := docElem namespaceURI. |
|
15884 rootName := docElem tagName. |
|
15885 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
15886 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
15887 employeeList := doc getElementsByTagName: 'p'. |
|
15888 elem1 := employeeList item:0. |
|
15889 elem2 := elem1 cloneNode:false. |
|
15890 isEqual := elem1 isEqualNode:elem2. |
|
15891 self deny: isEqual. |
|
15892 elem3 := elem1 cloneNode:true. |
|
15893 isEqual := elem1 isEqualNode:elem3. |
|
15894 self assert: isEqual. |
|
15895 |
|
15896 ! |
|
15897 |
|
15898 test_nodeisequalnode14 |
|
15899 " |
|
15900 |
|
15901 |
|
15902 Using isEqualNode check if 2 Attr nodes having the same nodeName and a null namespaceURI |
|
15903 attribute, one created using createAttribute and the other createAttributeNS, are not equal. |
|
15904 Note the localName for an Attr created with DOM Level 1 methods is null. |
|
15905 |
|
15906 Creator: IBM |
|
15907 Autor Neil Delima |
|
15908 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15909 " |
|
15910 | |
|
15911 doc "Document" |
|
15912 attr1 "Attr" |
|
15913 attr2 "Attr" |
|
15914 isEqual "Boolean" |
|
15915 nullNSURI "String" |
|
15916 | |
|
15917 nullNSURI := nil. |
|
15918 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15919 attr1 := doc createAttribute:'root'. |
|
15920 attr2 := doc createAttribute:'root' ns:nullNSURI. |
|
15921 isEqual := attr1 isEqualNode:attr2. |
|
15922 self deny: isEqual. |
|
15923 |
|
15924 ! |
|
15925 |
|
15926 test_nodeisequalnode15 |
|
15927 " |
|
15928 Using isEqualNode check if 2 Attr nodes having the same nodeName and a null namespaceURI |
|
15929 attribute, one created using createAttributeNS and the other retreived from this document |
|
15930 are equal. |
|
15931 |
|
15932 Creator: IBM |
|
15933 Autor Neil Delima |
|
15934 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15935 " |
|
15936 | |
|
15937 doc "Document" |
|
15938 attr1 "Attr" |
|
15939 attr2 "Attr" |
|
15940 addrElement "Element" |
|
15941 elementList "NodeList" |
|
15942 isEqual "Boolean" |
|
15943 nullNS "String" |
|
15944 | |
|
15945 nullNS := nil. |
|
15946 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15947 elementList := doc getElementsByTagName: 'acronym'. |
|
15948 addrElement := elementList item:3. |
|
15949 attr1 := addrElement getAttributeNode: 'title' ns: nullNS. |
|
15950 "if" |
|
15951 false "no template for element implementationAttribute" ifTrue: [ |
|
15952 ]. |
|
15953 attr2 value:'Yes'. |
|
15954 isEqual := attr1 isEqualNode:attr2. |
|
15955 self assert: isEqual. |
|
15956 |
|
15957 ! |
|
15958 |
|
15959 test_nodeisequalnode16 |
|
15960 " |
|
15961 |
|
15962 |
|
15963 Using isEqualNode check if a default attribute node and a cloned default attribute |
|
15964 node are equal. |
|
15965 |
|
15966 Creator: IBM |
|
15967 Autor Neil Delima |
|
15968 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15969 " |
|
15970 | |
|
15971 doc "Document" |
|
15972 attr1 "Attr" |
|
15973 attr2 "Attr" |
|
15974 addrElement "Element" |
|
15975 elementList "NodeList" |
|
15976 isEqual "Boolean" |
|
15977 nullNSURI "String" |
|
15978 | |
|
15979 nullNSURI := nil. |
|
15980 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
15981 elementList := doc getElementsByTagName: 'p'. |
|
15982 addrElement := elementList item:3. |
|
15983 attr1 := addrElement getAttributeNode: 'dir' ns: nullNSURI. |
|
15984 attr2 := attr1 cloneNode:true. |
|
15985 isEqual := attr1 isEqualNode:attr2. |
|
15986 self assert: isEqual. |
|
15987 |
|
15988 ! |
|
15989 |
|
15990 test_nodeisequalnode17 |
|
15991 " |
|
15992 Using isEqualNode check if a new Attr node created in this Document is equal to |
|
15993 the imported node returned when it is imported into a new Document. |
|
15994 |
|
15995 Creator: IBM |
|
15996 Autor Neil Delima |
|
15997 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
15998 " |
|
15999 | |
|
16000 doc "Document" |
|
16001 newDoc "Document" |
|
16002 domImpl "DOMImplementation" |
|
16003 attr1 "Attr" |
|
16004 attr2 "Attr" |
|
16005 isEqual "Boolean" |
|
16006 nullDocType "DocumentType" |
|
16007 nullNSURI "String" |
|
16008 docElem "Element" |
|
16009 rootNS "String" |
|
16010 rootName "String" |
|
16011 | |
|
16012 nullDocType := nil. |
|
16013 nullNSURI := nil. |
|
16014 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16015 docElem := doc documentElement. |
|
16016 rootNS := docElem namespaceURI. |
|
16017 rootName := docElem tagName. |
|
16018 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16019 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
16020 attr1 := doc createAttribute:'root' ns:nullNSURI. |
|
16021 attr2 := newDoc importNode:attr1 deep:true. |
|
16022 isEqual := attr1 isEqualNode:attr2. |
|
16023 self assert: isEqual. |
|
16024 |
|
16025 ! |
|
16026 |
|
16027 test_nodeisequalnode18 |
|
16028 " |
|
16029 Using isEqualNode check if a new Attr node created in this Document is equal to |
|
16030 the attr node adopted by a new document. |
|
16031 |
|
16032 Creator: IBM |
|
16033 Autor Neil Delima |
|
16034 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16035 " |
|
16036 | |
|
16037 doc "Document" |
|
16038 newDoc "Document" |
|
16039 domImpl "DOMImplementation" |
|
16040 attr1 "Attr" |
|
16041 attr2 "Attr" |
|
16042 isEqual "Boolean" |
|
16043 nullDocType "DocumentType" |
|
16044 nullNSURI "String" |
|
16045 docElem "Element" |
|
16046 rootNS "String" |
|
16047 rootName "String" |
|
16048 | |
|
16049 nullDocType := nil. |
|
16050 nullNSURI := nil. |
|
16051 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16052 docElem := doc documentElement. |
|
16053 rootName := docElem tagName. |
|
16054 rootNS := docElem namespaceURI. |
|
16055 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16056 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
16057 attr1 := doc createAttribute:'title' ns:nullNSURI. |
|
16058 attr2 := newDoc adoptNode: attr1. |
|
16059 "if" |
|
16060 ( attr2 notNil ) ifTrue: [ |
|
16061 ]. |
|
16062 |
|
16063 ! |
|
16064 |
|
16065 test_nodeisequalnode19 |
|
16066 " |
|
16067 |
|
16068 |
|
16069 Using isEqualNode check if 2 Attr nodes having the same nodeName but different namespaceURIs |
|
16070 are not equal. |
|
16071 |
|
16072 Creator: IBM |
|
16073 Autor Neil Delima |
|
16074 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16075 " |
|
16076 | |
|
16077 doc "Document" |
|
16078 attr1 "Attr" |
|
16079 attr2 "Attr" |
|
16080 isEqual "Boolean" |
|
16081 nullNSURI "String" |
|
16082 | |
|
16083 nullNSURI := nil. |
|
16084 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16085 attr1 := doc createAttribute:'lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
16086 attr2 := doc createAttribute:'lang' ns:nullNSURI. |
|
16087 isEqual := attr1 isEqualNode:attr2. |
|
16088 self deny: isEqual. |
|
16089 |
|
16090 ! |
|
16091 |
|
16092 test_nodeisequalnode20 |
|
16093 " |
|
16094 Using isEqualNode check if an Element and an Attr nodes having the same nodeName |
|
16095 and namsepaceURI are not equal. |
|
16096 |
|
16097 Creator: IBM |
|
16098 Autor Neil Delima |
|
16099 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16100 " |
|
16101 | |
|
16102 doc "Document" |
|
16103 attr1 "Attr" |
|
16104 elem1 "Element" |
|
16105 isEqual "Boolean" |
|
16106 | |
|
16107 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16108 elem1 := doc createElement:'xhtml:html' ns:'http://www.w3.org/1999/xhtml'. |
|
16109 attr1 := doc createAttribute:'xhtml:html' ns:'http://www.w3.org/1999/xhtml'. |
|
16110 isEqual := attr1 isEqualNode:elem1. |
|
16111 self deny: isEqual. |
|
16112 |
|
16113 ! |
|
16114 |
|
16115 test_nodeisequalnode21 |
|
16116 " |
|
16117 |
|
16118 |
|
16119 Using isEqualNode check if 2 DocumentType nodes returned by parsing the same xml document |
|
16120 are equal. |
|
16121 |
|
16122 Creator: IBM |
|
16123 Autor Neil Delima |
|
16124 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16125 " |
|
16126 | |
|
16127 doc1 "Document" |
|
16128 doc2 "Document" |
|
16129 docType1 "DocumentType" |
|
16130 docType2 "DocumentType" |
|
16131 isEqual "Boolean" |
|
16132 | |
|
16133 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16134 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16135 docType1 := doc1 doctype. |
|
16136 docType2 := doc2 doctype. |
|
16137 isEqual := docType1 isEqualNode:docType2. |
|
16138 self assert: isEqual. |
|
16139 |
|
16140 ! |
|
16141 |
|
16142 test_nodeisequalnode22 |
|
16143 " |
|
16144 |
|
16145 |
|
16146 Using isEqualNode check if 2 new DocumentType having null public and system ids |
|
16147 are equal. |
|
16148 |
|
16149 Creator: IBM |
|
16150 Autor Neil Delima |
|
16151 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16152 " |
|
16153 | |
|
16154 doc1 "Document" |
|
16155 doc2 "Document" |
|
16156 domImpl1 "DOMImplementation" |
|
16157 domImpl2 "DOMImplementation" |
|
16158 docType1 "DocumentType" |
|
16159 docType2 "DocumentType" |
|
16160 isEqual "Boolean" |
|
16161 nullPubId "String" |
|
16162 nullSysId "String" |
|
16163 oldDocType "DocumentType" |
|
16164 rootName "String" |
|
16165 | |
|
16166 nullPubId := nil. |
|
16167 nullSysId := nil. |
|
16168 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
16169 oldDocType := doc1 doctype. |
|
16170 rootName := oldDocType name. |
|
16171 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
16172 domImpl1 := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16173 domImpl2 := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16174 docType1 := domImpl1 createDocumentType:rootName publicId:nullPubId systemId:nullSysId. |
|
16175 docType2 := domImpl2 createDocumentType:rootName publicId:nullPubId systemId:nullSysId. |
|
16176 isEqual := docType1 isEqualNode:docType2. |
|
16177 self assert: isEqual. |
|
16178 |
|
16179 ! |
|
16180 |
|
16181 test_nodeisequalnode25 |
|
16182 " |
|
16183 |
|
16184 |
|
16185 Using isEqualNode check if 2 EntityNode having the same name of two DocumentType nodes |
|
16186 returned by parsing the same xml document are equal. |
|
16187 |
|
16188 Creator: IBM |
|
16189 Autor Neil Delima |
|
16190 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16191 " |
|
16192 | |
|
16193 doc1 "Document" |
|
16194 doc2 "Document" |
|
16195 docType1 "DocumentType" |
|
16196 docType2 "DocumentType" |
|
16197 entitiesMap1 "NamedNodeMap" |
|
16198 entitiesMap2 "NamedNodeMap" |
|
16199 alpha "Entity" |
|
16200 beta "Entity" |
|
16201 isEqual "Boolean" |
|
16202 | |
|
16203 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16204 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16205 docType1 := doc1 doctype. |
|
16206 docType2 := doc2 doctype. |
|
16207 entitiesMap1 := docType1 entities. |
|
16208 entitiesMap2 := docType2 entities. |
|
16209 alpha := entitiesMap1 getNamedItem:'delta'. |
|
16210 beta := entitiesMap2 getNamedItem:'delta'. |
|
16211 isEqual := alpha isEqualNode:beta. |
|
16212 self assert: isEqual. |
|
16213 |
|
16214 ! |
|
16215 |
|
16216 test_nodeisequalnode26 |
|
16217 " |
|
16218 |
|
16219 |
|
16220 Using isEqualNode check if 2 NotationNode having the same name of two DocumnotationType nodes |
|
16221 returned by parsing the same xml documnotation are equal. |
|
16222 |
|
16223 Creator: IBM |
|
16224 Autor Neil Delima |
|
16225 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16226 " |
|
16227 | |
|
16228 doc1 "Document" |
|
16229 doc2 "Document" |
|
16230 docType1 "DocumentType" |
|
16231 docType2 "DocumentType" |
|
16232 notationsMap1 "NamedNodeMap" |
|
16233 notationsMap2 "NamedNodeMap" |
|
16234 notation1 "Notation" |
|
16235 notation2 "Notation" |
|
16236 isEqual "Boolean" |
|
16237 | |
|
16238 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16239 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16240 docType1 := doc1 doctype. |
|
16241 docType2 := doc2 doctype. |
|
16242 notationsMap1 := docType1 notations. |
|
16243 notationsMap2 := docType2 notations. |
|
16244 notation1 := notationsMap1 getNamedItem:'notation1'. |
|
16245 notation2 := notationsMap2 getNamedItem:'notation1'. |
|
16246 isEqual := notation1 isEqualNode:notation2. |
|
16247 self assert: isEqual. |
|
16248 |
|
16249 ! |
|
16250 |
|
16251 test_nodeisequalnode27 |
|
16252 " |
|
16253 |
|
16254 |
|
16255 Using isEqualNode check if 2 EntityNode having the same name of two DocumentType nodes |
|
16256 returned by parsing the same xml document are equal. |
|
16257 |
|
16258 Creator: IBM |
|
16259 Autor Neil Delima |
|
16260 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16261 " |
|
16262 | |
|
16263 doc "Document" |
|
16264 docType "DocumentType" |
|
16265 entitiesMap "NamedNodeMap" |
|
16266 notationsMap "NamedNodeMap" |
|
16267 alpha "Entity" |
|
16268 notation1 "Notation" |
|
16269 isEqual "Boolean" |
|
16270 | |
|
16271 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16272 docType := doc doctype. |
|
16273 entitiesMap := docType entities. |
|
16274 notationsMap := docType notations. |
|
16275 alpha := entitiesMap getNamedItem:'alpha'. |
|
16276 notation1 := notationsMap getNamedItem:'notation1'. |
|
16277 isEqual := notation1 isEqualNode:alpha. |
|
16278 self deny: isEqual. |
|
16279 |
|
16280 ! |
|
16281 |
|
16282 test_nodeisequalnode28 |
|
16283 " |
|
16284 |
|
16285 |
|
16286 Using isEqualNode check if 2 new Text nodes having null text are equal and two others |
|
16287 having different data are not equal. |
|
16288 |
|
16289 Creator: IBM |
|
16290 Autor Neil Delima |
|
16291 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16292 " |
|
16293 | |
|
16294 doc "Document" |
|
16295 text1 "Text" |
|
16296 text2 "Text" |
|
16297 text3 "Text" |
|
16298 isEqual "Boolean" |
|
16299 | |
|
16300 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16301 text1 := doc createTextNode:''. |
|
16302 text2 := doc createTextNode:''. |
|
16303 text3 := doc createTextNode:'#Text'. |
|
16304 isEqual := text1 isEqualNode:text2. |
|
16305 self assert: isEqual. |
|
16306 isEqual := text1 isEqualNode:text3. |
|
16307 self deny: isEqual. |
|
16308 |
|
16309 ! |
|
16310 |
|
16311 test_nodeisequalnode29 |
|
16312 " |
|
16313 |
|
16314 |
|
16315 Using isEqualNode check if 2 new Comment nodes having the same data are equal and two others |
|
16316 having different data are not equal. |
|
16317 |
|
16318 Creator: IBM |
|
16319 Autor Neil Delima |
|
16320 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16321 " |
|
16322 | |
|
16323 doc "Document" |
|
16324 comment1 "Comment" |
|
16325 comment2 "Comment" |
|
16326 comment3 "Comment" |
|
16327 isEqual "Boolean" |
|
16328 | |
|
16329 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16330 comment1 := doc createComment:'comment'. |
|
16331 comment2 := doc createComment:'comment'. |
|
16332 comment3 := doc createComment:'#Comment'. |
|
16333 isEqual := comment1 isEqualNode:comment2. |
|
16334 self assert: isEqual. |
|
16335 isEqual := comment1 isEqualNode:comment3. |
|
16336 self deny: isEqual. |
|
16337 |
|
16338 ! |
|
16339 |
|
16340 test_nodeisequalnode31 |
|
16341 " |
|
16342 |
|
16343 |
|
16344 Using isEqualNode check if 2 new CDATASection nodes having the same data are equal and two others |
|
16345 having different data are not equal. |
|
16346 |
|
16347 Creator: IBM |
|
16348 Autor Neil Delima |
|
16349 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16350 " |
|
16351 | |
|
16352 doc "Document" |
|
16353 cdata1 "CDATASection" |
|
16354 cdata2 "CDATASection" |
|
16355 cdata3 "CDATASection" |
|
16356 isEqual "Boolean" |
|
16357 | |
|
16358 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16359 cdata1 := doc createCDATASection:'cdata'. |
|
16360 cdata2 := doc createCDATASection:'cdata'. |
|
16361 cdata3 := doc createCDATASection:'#CDATASection'. |
|
16362 isEqual := cdata1 isEqualNode:cdata2. |
|
16363 self assert: isEqual. |
|
16364 isEqual := cdata1 isEqualNode:cdata3. |
|
16365 self deny: isEqual. |
|
16366 |
|
16367 ! |
|
16368 |
|
16369 test_nodeisequalnode32 |
|
16370 " |
|
16371 |
|
16372 |
|
16373 Using isEqualNode check if 2 new ProcessingInstruction nodes having the same data are equal and two others |
|
16374 having different data are not equal. |
|
16375 |
|
16376 Creator: IBM |
|
16377 Autor Neil Delima |
|
16378 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isEqualNode |
|
16379 " |
|
16380 | |
|
16381 doc "Document" |
|
16382 pi1 "ProcessingInstruction" |
|
16383 pi2 "ProcessingInstruction" |
|
16384 pi3 "ProcessingInstruction" |
|
16385 isEqual "Boolean" |
|
16386 | |
|
16387 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16388 pi1 := doc createProcessingInstruction:'Target1' data:'pi'. |
|
16389 pi2 := doc createProcessingInstruction:'Target1' data:'pi'. |
|
16390 pi3 := doc createProcessingInstruction:'Target1' data:'#ProcessingInstruction'. |
|
16391 isEqual := pi1 isEqualNode:pi2. |
|
16392 self assert: isEqual. |
|
16393 isEqual := pi1 isEqualNode:pi3. |
|
16394 self deny: isEqual. |
|
16395 |
|
16396 ! |
|
16397 |
|
16398 test_nodeissamenode01 |
|
16399 " |
|
16400 |
|
16401 |
|
16402 Using isSameNode to check if 2 Document nodes that are equal but do not reference the |
|
16403 same object are not the same |
|
16404 |
|
16405 Creator: IBM |
|
16406 Autor Neil Delima |
|
16407 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16408 " |
|
16409 | |
|
16410 doc1 "Document" |
|
16411 doc2 "Document" |
|
16412 isSame "Boolean" |
|
16413 | |
|
16414 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16415 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16416 isSame := doc1 isSameNode: doc2. |
|
16417 self deny: isSame. |
|
16418 |
|
16419 ! |
|
16420 |
|
16421 test_nodeissamenode02 |
|
16422 " |
|
16423 |
|
16424 |
|
16425 Using isSameNode check if 2 DocumentType nodes that reference the same object are |
|
16426 the same. |
|
16427 |
|
16428 Creator: IBM |
|
16429 Autor Neil Delima |
|
16430 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16431 " |
|
16432 | |
|
16433 doc "Document" |
|
16434 docType1 "DocumentType" |
|
16435 docType2 "DocumentType" |
|
16436 isSame "Boolean" |
|
16437 | |
|
16438 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16439 docType1 := doc doctype. |
|
16440 docType2 := doc doctype. |
|
16441 isSame := docType1 isSameNode: docType2. |
|
16442 self assert: isSame. |
|
16443 |
|
16444 ! |
|
16445 |
|
16446 test_nodeissamenode03 |
|
16447 " |
|
16448 Using isSameNode check if 2 Element nodes that reference the same object are |
|
16449 the same. |
|
16450 |
|
16451 Creator: IBM |
|
16452 Autor Neil Delima |
|
16453 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16454 " |
|
16455 | |
|
16456 doc "Document" |
|
16457 element1 "Element" |
|
16458 element2 "Element" |
|
16459 childList "NodeList" |
|
16460 isSame "Boolean" |
|
16461 | |
|
16462 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16463 childList := doc getElementsByTagName: 'p'. |
|
16464 element1 := childList item:0. |
|
16465 element2 := childList item:0. |
|
16466 isSame := element2 isSameNode: element1. |
|
16467 self assert: isSame. |
|
16468 |
|
16469 ! |
|
16470 |
|
16471 test_nodeissamenode04 |
|
16472 " |
|
16473 Using isSameNode check if 2 Element nodes that are equal but do not reference the |
|
16474 same object are not the same. |
|
16475 |
|
16476 Creator: IBM |
|
16477 Autor Neil Delima |
|
16478 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16479 " |
|
16480 | |
|
16481 doc "Document" |
|
16482 element1 "Element" |
|
16483 element2 "Element" |
|
16484 isSame "Boolean" |
|
16485 | |
|
16486 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16487 element1 := doc createElement:'xhtml:br' ns:'http://www.w3.org/1999/xhtml'. |
|
16488 element2 := doc createElement:'xhtml:br' ns:'http://www.w3.org/1999/xhtml'. |
|
16489 isSame := element2 isSameNode: element1. |
|
16490 self deny: isSame. |
|
16491 |
|
16492 ! |
|
16493 |
|
16494 test_nodeissamenode05 |
|
16495 " |
|
16496 |
|
16497 |
|
16498 Using isSameNode check if 2 Document Element nodes that reference the same object are |
|
16499 the same. |
|
16500 |
|
16501 Creator: IBM |
|
16502 Autor Neil Delima |
|
16503 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16504 " |
|
16505 | |
|
16506 doc "Document" |
|
16507 element1 "Element" |
|
16508 element2 "Element" |
|
16509 isSame "Boolean" |
|
16510 | |
|
16511 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16512 element1 := doc documentElement. |
|
16513 element2 := doc documentElement. |
|
16514 isSame := element2 isSameNode: element1. |
|
16515 self assert: isSame. |
|
16516 |
|
16517 ! |
|
16518 |
|
16519 test_nodeissamenode06 |
|
16520 " |
|
16521 Using isSameNode check if 2 Document Element nodes that reference the same object are |
|
16522 the same. |
|
16523 |
|
16524 Creator: IBM |
|
16525 Autor Neil Delima |
|
16526 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16527 " |
|
16528 | |
|
16529 doc "Document" |
|
16530 element "Element" |
|
16531 element1 "Element" |
|
16532 attr1 "Attr" |
|
16533 attr2 "Attr" |
|
16534 childList "NodeList" |
|
16535 isSame "Boolean" |
|
16536 | |
|
16537 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16538 childList := doc getElementsByTagName: 'acronym'. |
|
16539 element := childList item:2. |
|
16540 element1 := childList item:2. |
|
16541 attr1 := element getAttributeNode:'class'. |
|
16542 attr2 := element1 getAttributeNode:'class'. |
|
16543 isSame := attr1 isSameNode: attr2. |
|
16544 self assert: isSame. |
|
16545 |
|
16546 ! |
|
16547 |
|
16548 test_nodeissamenode07 |
|
16549 " |
|
16550 |
|
16551 |
|
16552 Using isSameNode check if 2 Entity nodes that reference the same object are |
|
16553 the same. |
|
16554 |
|
16555 Creator: IBM |
|
16556 Autor Neil Delima |
|
16557 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16558 " |
|
16559 | |
|
16560 doc "Document" |
|
16561 docType "DocumentType" |
|
16562 entitiesMap "NamedNodeMap" |
|
16563 entity1 "Entity" |
|
16564 entity2 "Entity" |
|
16565 isSame "Boolean" |
|
16566 | |
|
16567 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16568 docType := doc doctype. |
|
16569 entitiesMap := docType entities. |
|
16570 entity1 := entitiesMap getNamedItem:'delta'. |
|
16571 entity2 := entitiesMap getNamedItem:'delta'. |
|
16572 isSame := entity1 isSameNode: entity2. |
|
16573 self assert: isSame. |
|
16574 |
|
16575 ! |
|
16576 |
|
16577 test_nodeissamenode08 |
|
16578 " |
|
16579 |
|
16580 |
|
16581 Using isSameNode check if 2 Notation nodes that reference the same object are |
|
16582 the same. |
|
16583 |
|
16584 Creator: IBM |
|
16585 Autor Neil Delima |
|
16586 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16587 " |
|
16588 | |
|
16589 doc "Document" |
|
16590 docType "DocumentType" |
|
16591 entitiesMap "NamedNodeMap" |
|
16592 notation1 "Notation" |
|
16593 notation2 "Notation" |
|
16594 isSame "Boolean" |
|
16595 | |
|
16596 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16597 docType := doc doctype. |
|
16598 entitiesMap := docType notations. |
|
16599 notation1 := entitiesMap getNamedItem:'notation1'. |
|
16600 notation2 := entitiesMap getNamedItem:'notation1'. |
|
16601 isSame := notation1 isSameNode: notation2. |
|
16602 self assert: isSame. |
|
16603 |
|
16604 ! |
|
16605 |
|
16606 test_nodeissamenode09 |
|
16607 " |
|
16608 |
|
16609 |
|
16610 Using isSameNode check if an Entity and its docType nodes are not the same. |
|
16611 |
|
16612 Creator: IBM |
|
16613 Autor Neil Delima |
|
16614 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16615 " |
|
16616 | |
|
16617 doc "Document" |
|
16618 docType "DocumentType" |
|
16619 entitiesMap "NamedNodeMap" |
|
16620 entity "Entity" |
|
16621 isSame "Boolean" |
|
16622 | |
|
16623 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16624 docType := doc doctype. |
|
16625 entitiesMap := docType entities. |
|
16626 entity := entitiesMap getNamedItem:'alpha'. |
|
16627 isSame := docType isSameNode: entity. |
|
16628 self deny: isSame. |
|
16629 |
|
16630 ! |
|
16631 |
|
16632 test_nodeissamenode10 |
|
16633 " |
|
16634 Using isSameNode check if an new Document and a new Element node are not the same. |
|
16635 |
|
16636 Creator: IBM |
|
16637 Autor Neil Delima |
|
16638 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-isSameNode |
|
16639 " |
|
16640 | |
|
16641 doc "Document" |
|
16642 newDoc "Document" |
|
16643 domImpl "DOMImplementation" |
|
16644 element "Element" |
|
16645 isSame "Boolean" |
|
16646 nullDocType "DocumentType" |
|
16647 docElem "Element" |
|
16648 rootNS "String" |
|
16649 rootName "String" |
|
16650 | |
|
16651 nullDocType := nil. |
|
16652 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16653 docElem := doc documentElement. |
|
16654 rootNS := docElem namespaceURI. |
|
16655 rootName := docElem tagName. |
|
16656 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16657 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
16658 element := newDoc createElement:rootName ns:rootNS. |
|
16659 isSame := newDoc isSameNode: element. |
|
16660 self deny: isSame. |
|
16661 |
|
16662 ! |
|
16663 |
|
16664 test_nodelookupnamespaceuri01 |
|
16665 " |
|
16666 Return value from lookupNamespaceURI(null) on a Document node with no default namespace should be null. |
|
16667 |
|
16668 Creator: IBM |
|
16669 Autor Neil Delima |
|
16670 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16671 " |
|
16672 | |
|
16673 doc "Document" |
|
16674 namespaceURI "String" |
|
16675 nullPrefix "String" |
|
16676 | |
|
16677 "implementationAttribute not supported: namespaceAware" |
|
16678 nullPrefix := nil. |
|
16679 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_nodefaultns'). |
|
16680 namespaceURI := doc lookupNamespaceURI:nullPrefix. |
|
16681 self assert: namespaceURI isNil. |
|
16682 |
|
16683 ! |
|
16684 |
|
16685 test_nodelookupnamespaceuri02 |
|
16686 " |
|
16687 Using lookupNamespaceURI on a new Document node with a namespaceURI and prefix |
|
16688 and check if the value returned is the same namespaceURI. |
|
16689 |
|
16690 Creator: IBM |
|
16691 Autor Neil Delima |
|
16692 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16693 " |
|
16694 | |
|
16695 doc "Document" |
|
16696 domImpl "DOMImplementation" |
|
16697 newDoc "Document" |
|
16698 namespaceURI "String" |
|
16699 nullDocType "DocumentType" |
|
16700 docElem "Element" |
|
16701 rootNS "String" |
|
16702 rootName "String" |
|
16703 qname "String" |
|
16704 | |
|
16705 "implementationAttribute not supported: namespaceAware" |
|
16706 nullDocType := nil. |
|
16707 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16708 docElem := doc documentElement. |
|
16709 rootNS := docElem namespaceURI. |
|
16710 rootName := docElem tagName. |
|
16711 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16712 self assert:false description:'Method "plus" is not supported yet'. |
|
16713 newDoc := domImpl createDocumentNS: rootNS qualifiedName: qname doctype: nullDocType. |
|
16714 namespaceURI := newDoc lookupNamespaceURI:'dom3'. |
|
16715 self assert: ( namespaceURI = rootNS ). |
|
16716 |
|
16717 ! |
|
16718 |
|
16719 test_nodelookupnamespaceuri03 |
|
16720 " |
|
16721 |
|
16722 |
|
16723 |
|
16724 Using lookupNamespaceURI on this DocumentType node check if the value returned is Null . |
|
16725 |
|
16726 Creator: IBM |
|
16727 Autor Neil Delima |
|
16728 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16729 " |
|
16730 | |
|
16731 doc "Document" |
|
16732 docType "DocumentType" |
|
16733 namespaceURI "String" |
|
16734 nullPrefix "String" |
|
16735 | |
|
16736 "implementationAttribute not supported: namespaceAware" |
|
16737 nullPrefix := nil. |
|
16738 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16739 docType := doc doctype. |
|
16740 namespaceURI := docType lookupNamespaceURI:nullPrefix. |
|
16741 self assert: namespaceURI isNil. |
|
16742 |
|
16743 ! |
|
16744 |
|
16745 test_nodelookupnamespaceuri04 |
|
16746 " |
|
16747 |
|
16748 |
|
16749 |
|
16750 Using lookupNamespaceURI on an Entity and Notation node and check if the value returned is Null . |
|
16751 |
|
16752 Creator: IBM |
|
16753 Autor Neil Delima |
|
16754 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16755 " |
|
16756 | |
|
16757 doc "Document" |
|
16758 docType "DocumentType" |
|
16759 entity "Entity" |
|
16760 notation "Notation" |
|
16761 entitiesMap "NamedNodeMap" |
|
16762 notationsMap "NamedNodeMap" |
|
16763 namespaceURI "String" |
|
16764 | |
|
16765 "implementationAttribute not supported: namespaceAware" |
|
16766 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16767 docType := doc doctype. |
|
16768 entitiesMap := docType entities. |
|
16769 notationsMap := docType notations. |
|
16770 entity := entitiesMap getNamedItem:'alpha'. |
|
16771 notation := notationsMap getNamedItem:'notation1'. |
|
16772 namespaceURI := entity lookupNamespaceURI:''. |
|
16773 self assert: namespaceURI isNil. |
|
16774 |
|
16775 ! |
|
16776 |
|
16777 test_nodelookupnamespaceuri05 |
|
16778 " |
|
16779 Using lookupNamespaceURI on the DocumentElement node of a new document with a |
|
16780 namespaceURI and prefix and check if the namespaceURI value returned is valid. |
|
16781 |
|
16782 Creator: IBM |
|
16783 Autor Neil Delima |
|
16784 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16785 " |
|
16786 | |
|
16787 doc "Document" |
|
16788 elem "Element" |
|
16789 domImpl "DOMImplementation" |
|
16790 newDoc "Document" |
|
16791 namespaceURI "String" |
|
16792 nullDocType "DocumentType" |
|
16793 docElem "Element" |
|
16794 rootNS "String" |
|
16795 rootName "String" |
|
16796 qname "String" |
|
16797 | |
|
16798 "implementationAttribute not supported: namespaceAware" |
|
16799 nullDocType := nil. |
|
16800 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16801 docElem := doc documentElement. |
|
16802 rootNS := docElem namespaceURI. |
|
16803 rootName := docElem tagName. |
|
16804 self assert:false description:'Method "plus" is not supported yet'. |
|
16805 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16806 newDoc := domImpl createDocumentNS: rootNS qualifiedName: qname doctype: nullDocType. |
|
16807 elem := newDoc documentElement. |
|
16808 namespaceURI := elem lookupNamespaceURI:'dom3'. |
|
16809 self assert: ( namespaceURI = rootNS ). |
|
16810 |
|
16811 ! |
|
16812 |
|
16813 test_nodelookupnamespaceuri06 |
|
16814 " |
|
16815 Invoke lookupNamespaceURI on an Element node with no prefix, which has a namespace |
|
16816 attribute declaration with a namespace prefix and check if the value of the namespaceURI |
|
16817 returned by using its prefix as a parameter is valid. |
|
16818 |
|
16819 Creator: IBM |
|
16820 Autor Neil Delima |
|
16821 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16822 " |
|
16823 | |
|
16824 doc "Document" |
|
16825 elem "Element" |
|
16826 elemList "NodeList" |
|
16827 namespaceURI "String" |
|
16828 | |
|
16829 "implementationAttribute not supported: namespaceAware" |
|
16830 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16831 elemList := doc getElementsByTagName: 'p'. |
|
16832 elem := elemList item:2. |
|
16833 namespaceURI := elem lookupNamespaceURI:'dmstc'. |
|
16834 self assert: ( namespaceURI = 'http://www.netzero.com' ). |
|
16835 |
|
16836 ! |
|
16837 |
|
16838 test_nodelookupnamespaceuri07 |
|
16839 " |
|
16840 Invoke lookupNamespaceURI on an Element node with no prefix, which has a namespace |
|
16841 attribute declaration with a namespace prefix in its parent Element node and check if |
|
16842 the value of the namespaceURI returned by using its prefix as a parameter is valid. |
|
16843 |
|
16844 Creator: IBM |
|
16845 Autor Neil Delima |
|
16846 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16847 " |
|
16848 | |
|
16849 doc "Document" |
|
16850 elem "Element" |
|
16851 elemList "NodeList" |
|
16852 namespaceURI "String" |
|
16853 | |
|
16854 "implementationAttribute not supported: namespaceAware" |
|
16855 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16856 elemList := doc getElementsByTagName: 'em'. |
|
16857 elem := elemList item:2. |
|
16858 namespaceURI := elem lookupNamespaceURI:'dmstc'. |
|
16859 self assert: ( namespaceURI = 'http://www.netzero.com' ). |
|
16860 |
|
16861 ! |
|
16862 |
|
16863 test_nodelookupnamespaceuri08 |
|
16864 " |
|
16865 Invoke lookupNamespaceURI on an Element node with no prefix, which has 2 namespace |
|
16866 attribute declarations with and without namespace prefixes and check if the value of the prefix |
|
16867 returned by using a valid prefix and an empty prefix as a parameter is a valid |
|
16868 namespaceURI or null. |
|
16869 |
|
16870 Creator: IBM |
|
16871 Autor Neil Delima |
|
16872 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16873 " |
|
16874 | |
|
16875 doc "Document" |
|
16876 elem "Element" |
|
16877 elemList "NodeList" |
|
16878 namespaceURI "String" |
|
16879 namespaceURIEmpty "String" |
|
16880 | |
|
16881 "implementationAttribute not supported: namespaceAware" |
|
16882 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16883 elemList := doc getElementsByTagName: 'p'. |
|
16884 elem := elemList item:0. |
|
16885 namespaceURI := elem lookupNamespaceURI:'dmstc'. |
|
16886 self assert: ( namespaceURI = 'http://www.usa.com' ). |
|
16887 namespaceURIEmpty := elem lookupNamespaceURI:''. |
|
16888 self assert: namespaceURIEmpty isNil. |
|
16889 |
|
16890 ! |
|
16891 |
|
16892 test_nodelookupnamespaceuri09 |
|
16893 " |
|
16894 Invoke lookupNamespaceURI on an Element node with no prefix, whose parent has no prefix and |
|
16895 2 namespace attribute declarations with and without namespace prefixes and check if the value of |
|
16896 the namespaceURI returned by using each prefix as a parameter is valid. |
|
16897 |
|
16898 Creator: IBM |
|
16899 Autor Neil Delima |
|
16900 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16901 " |
|
16902 | |
|
16903 doc "Document" |
|
16904 elem "Element" |
|
16905 elemList "NodeList" |
|
16906 namespaceURI "String" |
|
16907 namespaceURIEmpty "String" |
|
16908 | |
|
16909 "implementationAttribute not supported: namespaceAware" |
|
16910 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16911 elemList := doc getElementsByTagName: 'em'. |
|
16912 elem := elemList item:0. |
|
16913 namespaceURI := elem lookupNamespaceURI:'dmstc'. |
|
16914 self assert: ( namespaceURI = 'http://www.usa.com' ). |
|
16915 namespaceURIEmpty := elem lookupNamespaceURI:''. |
|
16916 self assert: namespaceURIEmpty isNil. |
|
16917 |
|
16918 ! |
|
16919 |
|
16920 test_nodelookupnamespaceuri10 |
|
16921 " |
|
16922 Invoke lookupNamespaceURI on a new Child of a new Element node with a namespace URI |
|
16923 and prefix and using the parents prefix as an argument, verify if the namespaceURI |
|
16924 returned is a valid namespaceURI for the parent. |
|
16925 |
|
16926 Creator: IBM |
|
16927 Autor Neil Delima |
|
16928 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16929 " |
|
16930 | |
|
16931 doc "Document" |
|
16932 parent "Element" |
|
16933 child "Element" |
|
16934 namespaceURI "String" |
|
16935 appendedChild "Node" |
|
16936 | |
|
16937 "implementationAttribute not supported: namespaceAware" |
|
16938 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16939 parent := doc createElement:'xhtml:body' ns:'http://www.w3.org/1999/xhtml'. |
|
16940 child := doc createElement:'p'. |
|
16941 appendedChild := parent appendChild:child. |
|
16942 namespaceURI := child lookupNamespaceURI:'xhtml'. |
|
16943 self assert: ( namespaceURI = 'http://www.w3.org/1999/xhtml' ). |
|
16944 |
|
16945 ! |
|
16946 |
|
16947 test_nodelookupnamespaceuri11 |
|
16948 " |
|
16949 Invoke lookupNamespaceURI on an imported new Element node with a namespace URI and prefix |
|
16950 in a new Document and using the parents prefix as an argument, verify if the namespaceURI |
|
16951 returned is a valid namespaceURI of the parent. |
|
16952 |
|
16953 Creator: IBM |
|
16954 Autor Neil Delima |
|
16955 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16956 " |
|
16957 | |
|
16958 doc "Document" |
|
16959 domImpl "DOMImplementation" |
|
16960 newDoc "Document" |
|
16961 elem "Element" |
|
16962 importedNode "Element" |
|
16963 namespaceURI "String" |
|
16964 nullDocType "DocumentType" |
|
16965 docElem "Element" |
|
16966 rootNS "String" |
|
16967 rootName "String" |
|
16968 | |
|
16969 "implementationAttribute not supported: namespaceAware" |
|
16970 nullDocType := nil. |
|
16971 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
16972 docElem := doc documentElement. |
|
16973 rootNS := docElem namespaceURI. |
|
16974 rootName := docElem tagName. |
|
16975 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
16976 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
16977 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
16978 importedNode := newDoc importNode:elem deep:true. |
|
16979 namespaceURI := importedNode lookupNamespaceURI:'dom3'. |
|
16980 self assert: ( namespaceURI = 'http://www.w3.org/1999/xhtml' ). |
|
16981 |
|
16982 ! |
|
16983 |
|
16984 test_nodelookupnamespaceuri13 |
|
16985 " |
|
16986 Invoke lookupNamespaceURI on a Element's new Text node, which has a namespace attribute declaration |
|
16987 with a namespace prefix in its parent Element node and check if the value of the namespaceURI |
|
16988 returned by using its prefix as a parameter is valid. |
|
16989 |
|
16990 Creator: IBM |
|
16991 Autor Neil Delima |
|
16992 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
16993 " |
|
16994 | |
|
16995 doc "Document" |
|
16996 docElem "Element" |
|
16997 elem "Element" |
|
16998 txt "Text" |
|
16999 namespaceURI "String" |
|
17000 appendedChild "Node" |
|
17001 | |
|
17002 "implementationAttribute not supported: namespaceAware" |
|
17003 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17004 docElem := doc documentElement. |
|
17005 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17006 txt := doc createTextNode:'Text'. |
|
17007 appendedChild := elem appendChild:txt. |
|
17008 appendedChild := docElem appendChild:elem. |
|
17009 namespaceURI := txt lookupNamespaceURI:'dom3'. |
|
17010 self assert: ( namespaceURI = 'http://www.w3.org/1999/xhtml' ). |
|
17011 |
|
17012 ! |
|
17013 |
|
17014 test_nodelookupnamespaceuri14 |
|
17015 " |
|
17016 Invoke lookupNamespaceURI on a Element's new Text node, which has a namespace attribute declaration |
|
17017 with a namespace prefix in its parent Element node and check if the value of the namespaceURI |
|
17018 returned by using its prefix as a parameter is valid. |
|
17019 |
|
17020 Creator: IBM |
|
17021 Autor Neil Delima |
|
17022 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
17023 " |
|
17024 | |
|
17025 doc "Document" |
|
17026 docElem "Element" |
|
17027 elem "Element" |
|
17028 cdata "CDATASection" |
|
17029 lookupNamespaceURI "String" |
|
17030 appendedChild "Node" |
|
17031 | |
|
17032 "implementationAttribute not supported: namespaceAware" |
|
17033 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17034 docElem := doc documentElement. |
|
17035 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17036 cdata := doc createCDATASection:'Text'. |
|
17037 appendedChild := elem appendChild:cdata. |
|
17038 appendedChild := docElem appendChild:elem. |
|
17039 lookupNamespaceURI := cdata lookupNamespaceURI:'dom3'. |
|
17040 self assert: ( lookupNamespaceURI = 'http://www.w3.org/1999/xhtml' ). |
|
17041 |
|
17042 ! |
|
17043 |
|
17044 test_nodelookupnamespaceuri15 |
|
17045 " |
|
17046 Invoke lookupNamespaceURI on a Element's new Comment node, which has a namespace attribute declaration |
|
17047 with a namespace prefix in its parent Element node and check if the value of the namespaceURI |
|
17048 returned by using its prefix as a parameter is valid. |
|
17049 |
|
17050 Creator: IBM |
|
17051 Autor Neil Delima |
|
17052 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
17053 " |
|
17054 | |
|
17055 doc "Document" |
|
17056 docElem "Element" |
|
17057 elem "Element" |
|
17058 comment "Comment" |
|
17059 clonedComment "Comment" |
|
17060 namespaceURI "String" |
|
17061 appendedChild "Node" |
|
17062 | |
|
17063 "implementationAttribute not supported: namespaceAware" |
|
17064 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17065 docElem := doc documentElement. |
|
17066 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17067 comment := doc createComment:'Text'. |
|
17068 clonedComment := comment cloneNode:true. |
|
17069 appendedChild := elem appendChild:clonedComment. |
|
17070 appendedChild := docElem appendChild:elem. |
|
17071 namespaceURI := clonedComment lookupNamespaceURI:'dom3'. |
|
17072 self assert: ( namespaceURI = 'http://www.w3.org/1999/xhtml' ). |
|
17073 |
|
17074 ! |
|
17075 |
|
17076 test_nodelookupnamespaceuri16 |
|
17077 " |
|
17078 Invoke lookupNamespaceURI on a new Attribute node with with a namespace URI |
|
17079 and prefix and verify if the namespaceURI returned is null. |
|
17080 |
|
17081 Creator: IBM |
|
17082 Autor Neil Delima |
|
17083 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
17084 " |
|
17085 | |
|
17086 doc "Document" |
|
17087 elem "Element" |
|
17088 attr "Attr" |
|
17089 attNode "Attr" |
|
17090 namespaceURI "String" |
|
17091 | |
|
17092 "implementationAttribute not supported: namespaceAware" |
|
17093 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17094 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17095 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
17096 attNode := elem setAttributeNodeNS: attr. |
|
17097 namespaceURI := attr lookupNamespaceURI:'xml'. |
|
17098 self assert: namespaceURI isNil. |
|
17099 |
|
17100 ! |
|
17101 |
|
17102 test_nodelookupnamespaceuri17 |
|
17103 " |
|
17104 Invoke lookupNamespaceURI on the title attribute node of the acronym node with |
|
17105 a namespaceURI and a node prefix and check if the value of the namespaceURI returned by |
|
17106 using its prefix as a parameter is valid. |
|
17107 |
|
17108 Creator: IBM |
|
17109 Autor Neil Delima |
|
17110 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
17111 " |
|
17112 | |
|
17113 doc "Document" |
|
17114 elem "Element" |
|
17115 elemList "NodeList" |
|
17116 attributesMap "NamedNodeMap" |
|
17117 attr "Attr" |
|
17118 namespaceURI "String" |
|
17119 | |
|
17120 "implementationAttribute not supported: namespaceAware" |
|
17121 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17122 elemList := doc getElementsByTagName: 'acronym'. |
|
17123 elem := elemList item:2. |
|
17124 attributesMap := elem attributes. |
|
17125 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
17126 namespaceURI := attr lookupNamespaceURI:'dmstc'. |
|
17127 self assert: ( namespaceURI = 'http://www.netzero.com' ). |
|
17128 |
|
17129 ! |
|
17130 |
|
17131 test_nodelookupnamespaceuri18 |
|
17132 " |
|
17133 Invoke lookupNamespaceURI on the default attribute node of the p node with |
|
17134 a namespaceURI and a node prefix and check if the value of the namespaceURI returned by |
|
17135 using its prefix as a parameter is valid. |
|
17136 |
|
17137 Creator: IBM |
|
17138 Autor Neil Delima |
|
17139 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
17140 " |
|
17141 | |
|
17142 doc "Document" |
|
17143 elem "Element" |
|
17144 elemList "NodeList" |
|
17145 attributesMap "NamedNodeMap" |
|
17146 attr "Attr" |
|
17147 namespaceURI "String" |
|
17148 | |
|
17149 "implementationAttribute not supported: namespaceAware" |
|
17150 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17151 elemList := doc getElementsByTagName: 'p'. |
|
17152 elem := elemList item:3. |
|
17153 attributesMap := elem attributes. |
|
17154 attr := attributesMap getNamedItem:'dir'. |
|
17155 namespaceURI := attr lookupNamespaceURI:'nm'. |
|
17156 self assert: ( namespaceURI = 'http://www.altavista.com' ). |
|
17157 |
|
17158 ! |
|
17159 |
|
17160 test_nodelookupnamespaceuri19 |
|
17161 " |
|
17162 Invoke lookupNamespaceURI on the an attribute node without a namespace prefix of |
|
17163 an Element node that has a namespaceURI and prefix, and check if the value of the namespaceURI |
|
17164 returned by using the Elements prefix as a parameter is valid. |
|
17165 |
|
17166 Creator: IBM |
|
17167 Autor Neil Delima |
|
17168 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
17169 " |
|
17170 | |
|
17171 doc "Document" |
|
17172 elem "Element" |
|
17173 elemList "NodeList" |
|
17174 attributesMap "NamedNodeMap" |
|
17175 attr "Attr" |
|
17176 namespaceURI "String" |
|
17177 | |
|
17178 "implementationAttribute not supported: namespaceAware" |
|
17179 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17180 elemList := doc getElementsByTagName: 'acronym'. |
|
17181 elem := elemList item:3. |
|
17182 attributesMap := elem attributes. |
|
17183 attr := attributesMap getNamedItem:'class'. |
|
17184 namespaceURI := attr lookupNamespaceURI:'xsi'. |
|
17185 self assert: ( namespaceURI = 'http://www.w3.org/2001/XMLSchema-instance' ). |
|
17186 |
|
17187 ! |
|
17188 |
|
17189 test_nodelookupnamespaceuri20 |
|
17190 " |
|
17191 |
|
17192 |
|
17193 |
|
17194 Invoke lookupNamespaceURI on the an attribute node without a namespace prefix of |
|
17195 an Element node that has a namespaceURI and prefix, and check if the value of the namespaceURI |
|
17196 returned by using the Elements prefix as a parameter is valid. |
|
17197 |
|
17198 Creator: IBM |
|
17199 Autor Neil Delima |
|
17200 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespaceURI |
|
17201 " |
|
17202 | |
|
17203 doc "Document" |
|
17204 elem "Element" |
|
17205 elemList "NodeList" |
|
17206 attributesMap "NamedNodeMap" |
|
17207 attr "Attr" |
|
17208 namespaceURI "String" |
|
17209 | |
|
17210 "implementationAttribute not supported: namespaceAware" |
|
17211 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17212 elemList := doc getElementsByTagName: 'p'. |
|
17213 elem := elemList item:3. |
|
17214 attributesMap := elem attributes. |
|
17215 attr := attributesMap getNamedItem:'xmlns:nm'. |
|
17216 namespaceURI := attr lookupNamespaceURI:'nm'. |
|
17217 self assert: ( namespaceURI = 'http://www.altavista.com' ). |
|
17218 |
|
17219 ! |
|
17220 |
|
17221 test_nodelookupprefix01 |
|
17222 " |
|
17223 |
|
17224 |
|
17225 |
|
17226 Using lookupPrefix on this Document node check if the value returned is Null . |
|
17227 |
|
17228 Creator: IBM |
|
17229 Autor Jenny Hsu |
|
17230 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17231 " |
|
17232 | |
|
17233 doc "Document" |
|
17234 prefix "String" |
|
17235 nullNSURI "String" |
|
17236 | |
|
17237 "implementationAttribute not supported: namespaceAware" |
|
17238 nullNSURI := nil. |
|
17239 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17240 prefix := doc lookupPrefix. |
|
17241 self assert: prefix isNil. |
|
17242 |
|
17243 ! |
|
17244 |
|
17245 test_nodelookupprefix02 |
|
17246 " |
|
17247 Using lookupPrefix on a new Document node with a namespaceURI and prefix |
|
17248 and check if the value returned is the same prefix. |
|
17249 |
|
17250 Creator: IBM |
|
17251 Autor Jenny Hsu |
|
17252 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17253 " |
|
17254 | |
|
17255 doc "Document" |
|
17256 domImpl "DOMImplementation" |
|
17257 newDoc "Document" |
|
17258 prefix "String" |
|
17259 nullDocType "DocumentType" |
|
17260 docElem "Element" |
|
17261 rootNS "String" |
|
17262 rootName "String" |
|
17263 qname "String" |
|
17264 | |
|
17265 "implementationAttribute not supported: namespaceAware" |
|
17266 nullDocType := nil. |
|
17267 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17268 docElem := doc documentElement. |
|
17269 rootNS := docElem namespaceURI. |
|
17270 rootName := docElem tagName. |
|
17271 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
17272 self assert:false description:'Method "plus" is not supported yet'. |
|
17273 newDoc := domImpl createDocumentNS: rootNS qualifiedName: qname doctype: nullDocType. |
|
17274 prefix := newDoc lookupPrefix. |
|
17275 self assert: ( prefix = 'dom3' ). |
|
17276 |
|
17277 ! |
|
17278 |
|
17279 test_nodelookupprefix03 |
|
17280 " |
|
17281 |
|
17282 |
|
17283 |
|
17284 Using lookupPrefix on this DocumentType node check if the value returned is Null . |
|
17285 |
|
17286 Creator: IBM |
|
17287 Autor Jenny Hsu |
|
17288 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17289 " |
|
17290 | |
|
17291 doc "Document" |
|
17292 docType "DocumentType" |
|
17293 prefix "String" |
|
17294 nullNSURI "String" |
|
17295 | |
|
17296 "implementationAttribute not supported: namespaceAware" |
|
17297 nullNSURI := nil. |
|
17298 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17299 docType := doc doctype. |
|
17300 prefix := docType lookupPrefix. |
|
17301 self assert: prefix isNil. |
|
17302 |
|
17303 ! |
|
17304 |
|
17305 test_nodelookupprefix04 |
|
17306 " |
|
17307 |
|
17308 |
|
17309 |
|
17310 Using lookupPrefix on an Entity and Notation node and check if the value returned is Null . |
|
17311 |
|
17312 Creator: IBM |
|
17313 Autor Jenny Hsu |
|
17314 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17315 " |
|
17316 | |
|
17317 doc "Document" |
|
17318 docType "DocumentType" |
|
17319 entity "Entity" |
|
17320 notation "Notation" |
|
17321 entitiesMap "NamedNodeMap" |
|
17322 notationsMap "NamedNodeMap" |
|
17323 prefix "String" |
|
17324 | |
|
17325 "implementationAttribute not supported: namespaceAware" |
|
17326 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17327 docType := doc doctype. |
|
17328 entitiesMap := docType entities. |
|
17329 notationsMap := docType notations. |
|
17330 entity := entitiesMap getNamedItem:'alpha'. |
|
17331 notation := notationsMap getNamedItem:'notation1'. |
|
17332 prefix := entity lookupPrefix. |
|
17333 self assert: prefix isNil. |
|
17334 prefix := notation lookupPrefix. |
|
17335 self assert: prefix isNil. |
|
17336 |
|
17337 ! |
|
17338 |
|
17339 test_nodelookupprefix05 |
|
17340 " |
|
17341 Using lookupPrefix on the DocumentElement node of a new document with a |
|
17342 namespaceURI and prefix and check if the prefix value returned is valid. |
|
17343 |
|
17344 Creator: IBM |
|
17345 Autor Jenny Hsu |
|
17346 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17347 " |
|
17348 | |
|
17349 doc "Document" |
|
17350 elem "Element" |
|
17351 domImpl "DOMImplementation" |
|
17352 newDoc "Document" |
|
17353 prefix "String" |
|
17354 nullDocType "DocumentType" |
|
17355 docElem "Element" |
|
17356 rootNS "String" |
|
17357 rootName "String" |
|
17358 qname "String" |
|
17359 | |
|
17360 "implementationAttribute not supported: namespaceAware" |
|
17361 nullDocType := nil. |
|
17362 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17363 docElem := doc documentElement. |
|
17364 rootNS := docElem namespaceURI. |
|
17365 rootName := docElem tagName. |
|
17366 self assert:false description:'Method "plus" is not supported yet'. |
|
17367 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
17368 newDoc := domImpl createDocumentNS: rootNS qualifiedName: qname doctype: nullDocType. |
|
17369 elem := newDoc documentElement. |
|
17370 prefix := elem lookupPrefix. |
|
17371 self assert: ( prefix = 'dom3' ). |
|
17372 |
|
17373 ! |
|
17374 |
|
17375 test_nodelookupprefix06 |
|
17376 " |
|
17377 Invoke lookupPrefix on an Element node with no prefix, which has a namespace |
|
17378 attribute declaration with a namespace prefix and check if the value of the prefix |
|
17379 returned by using its namespaceURI as a parameter is valid. |
|
17380 |
|
17381 Creator: IBM |
|
17382 Autor Jenny Hsu |
|
17383 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17384 " |
|
17385 | |
|
17386 doc "Document" |
|
17387 elem "Element" |
|
17388 elemList "NodeList" |
|
17389 prefix "String" |
|
17390 | |
|
17391 "implementationAttribute not supported: namespaceAware" |
|
17392 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17393 elemList := doc getElementsByTagName: 'p'. |
|
17394 elem := elemList item:2. |
|
17395 prefix := elem lookupPrefix. |
|
17396 self assert: ( prefix = 'dmstc' ). |
|
17397 |
|
17398 ! |
|
17399 |
|
17400 test_nodelookupprefix07 |
|
17401 " |
|
17402 Invoke lookupPrefix on an Element node with no prefix, which has a namespace |
|
17403 attribute declaration with a namespace prefix in its parent Element node and check if the value of the prefix |
|
17404 returned by using its namespaceURI as a parameter is valid. |
|
17405 |
|
17406 Creator: IBM |
|
17407 Autor Neil Delima |
|
17408 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17409 " |
|
17410 | |
|
17411 doc "Document" |
|
17412 elem "Element" |
|
17413 elemList "NodeList" |
|
17414 prefix "String" |
|
17415 | |
|
17416 "implementationAttribute not supported: namespaceAware" |
|
17417 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17418 elemList := doc getElementsByTagName: 'em'. |
|
17419 elem := elemList item:2. |
|
17420 prefix := elem lookupPrefix. |
|
17421 self assert: ( prefix = 'dmstc' ). |
|
17422 |
|
17423 ! |
|
17424 |
|
17425 test_nodelookupprefix08 |
|
17426 " |
|
17427 Invoke lookupPrefix on an Element node with no prefix, which has 2 namespace |
|
17428 attribute declarations with and without namespace prefixes and check if the value of the prefix |
|
17429 returned by using each namespaceURI as a parameter is valid. |
|
17430 |
|
17431 Creator: IBM |
|
17432 Autor Jenny Hsu |
|
17433 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17434 " |
|
17435 | |
|
17436 doc "Document" |
|
17437 elem "Element" |
|
17438 elemList "NodeList" |
|
17439 prefix "String" |
|
17440 prefixEmpty "String" |
|
17441 | |
|
17442 "implementationAttribute not supported: namespaceAware" |
|
17443 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17444 elemList := doc getElementsByTagName: 'p'. |
|
17445 elem := elemList item:0. |
|
17446 prefix := elem lookupPrefix. |
|
17447 self assert: ( prefix = 'dmstc' ). |
|
17448 prefixEmpty := elem lookupPrefix. |
|
17449 self assert: prefixEmpty isNil. |
|
17450 |
|
17451 ! |
|
17452 |
|
17453 test_nodelookupprefix09 |
|
17454 " |
|
17455 |
|
17456 |
|
17457 |
|
17458 Invoke lookupPrefix on an Element node with no prefix, whose parent has no prefix and |
|
17459 2 namespace attribute declarations with and without namespace prefixes and check if the value of |
|
17460 the prefix returned by using each namespaceURI as a parameter is valid. |
|
17461 |
|
17462 Creator: IBM |
|
17463 Autor Jenny Hsu |
|
17464 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17465 " |
|
17466 | |
|
17467 doc "Document" |
|
17468 elem "Element" |
|
17469 elemList "NodeList" |
|
17470 prefix "String" |
|
17471 prefixEmpty "String" |
|
17472 | |
|
17473 "implementationAttribute not supported: namespaceAware" |
|
17474 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17475 elemList := doc getElementsByTagName: 'em'. |
|
17476 elem := elemList item:0. |
|
17477 prefix := elem lookupPrefix. |
|
17478 self assert: ( prefix = 'dmstc' ). |
|
17479 prefixEmpty := elem lookupPrefix. |
|
17480 self assert: prefixEmpty isNil. |
|
17481 |
|
17482 ! |
|
17483 |
|
17484 test_nodelookupprefix10 |
|
17485 " |
|
17486 Invoke lookupPrefix on a new Child of a new Element node with a namespace URI |
|
17487 and prefix and using the parents namespace URI as an argument, verify if the prefix |
|
17488 returned is a valid prefix of the parent. |
|
17489 |
|
17490 Creator: IBM |
|
17491 Autor Jenny Hsu |
|
17492 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17493 " |
|
17494 | |
|
17495 doc "Document" |
|
17496 parent "Element" |
|
17497 child "Element" |
|
17498 prefix "String" |
|
17499 appendedChild "Node" |
|
17500 | |
|
17501 "implementationAttribute not supported: namespaceAware" |
|
17502 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17503 parent := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17504 child := doc createElement:'br'. |
|
17505 appendedChild := parent appendChild:child. |
|
17506 prefix := child lookupPrefix. |
|
17507 self assert: ( prefix = 'dom3' ). |
|
17508 |
|
17509 ! |
|
17510 |
|
17511 test_nodelookupprefix11 |
|
17512 " |
|
17513 Invoke lookupPrefix on an imported new Element node with a namespace URI |
|
17514 and prefix in a new Document and using the parents namespace URI as an argument, verify if the prefix |
|
17515 returned is a valid prefix of the parent. |
|
17516 |
|
17517 Creator: IBM |
|
17518 Autor Jenny Hsu |
|
17519 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17520 " |
|
17521 | |
|
17522 doc "Document" |
|
17523 domImpl "DOMImplementation" |
|
17524 newDoc "Document" |
|
17525 elem "Element" |
|
17526 importedNode "Element" |
|
17527 prefix "String" |
|
17528 nullDocType "DocumentType" |
|
17529 docElem "Element" |
|
17530 rootNS "String" |
|
17531 rootName "String" |
|
17532 qname "String" |
|
17533 | |
|
17534 "implementationAttribute not supported: namespaceAware" |
|
17535 nullDocType := nil. |
|
17536 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17537 docElem := doc documentElement. |
|
17538 rootNS := docElem namespaceURI. |
|
17539 rootName := docElem tagName. |
|
17540 self assert:false description:'Method "plus" is not supported yet'. |
|
17541 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
17542 newDoc := domImpl createDocumentNS: rootNS qualifiedName: qname doctype: nullDocType. |
|
17543 elem := doc createElement:'dom3:br' ns:'http://www.w3.org/1999/xhtml'. |
|
17544 importedNode := newDoc importNode:elem deep:true. |
|
17545 prefix := importedNode lookupPrefix. |
|
17546 self assert: ( prefix = 'dom3' ). |
|
17547 |
|
17548 ! |
|
17549 |
|
17550 test_nodelookupprefix12 |
|
17551 " |
|
17552 Invoke lookupPrefix on an renamed new Element node with a namespace URI |
|
17553 and prefix in a new Document and using the parents namespace URI as an argument, verify if the prefix |
|
17554 returned is a valid prefix of the parent. |
|
17555 |
|
17556 Creator: IBM |
|
17557 Autor Jenny Hsu |
|
17558 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17559 " |
|
17560 | |
|
17561 doc "Document" |
|
17562 domImpl "DOMImplementation" |
|
17563 elem "Element" |
|
17564 renamedNode "Element" |
|
17565 prefix "String" |
|
17566 | |
|
17567 "implementationAttribute not supported: namespaceAware" |
|
17568 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17569 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
17570 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17571 renamedNode := doc renameNode:elem namespaceUri:'http://www.w3.org/1999/xhtml' qualifiedName:'ren:br'. |
|
17572 prefix := renamedNode lookupPrefix. |
|
17573 self assert: ( prefix = 'ren' ). |
|
17574 |
|
17575 ! |
|
17576 |
|
17577 test_nodelookupprefix13 |
|
17578 " |
|
17579 Invoke lookupPrefix on a Element's new Text node, which has a namespace attribute declaration |
|
17580 with a namespace prefix in its parent Element node and check if the value of the prefix |
|
17581 returned by using its namespaceURI as a parameter is valid. |
|
17582 |
|
17583 Creator: IBM |
|
17584 Autor Jenny Hsu |
|
17585 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17586 " |
|
17587 | |
|
17588 doc "Document" |
|
17589 bodyElem "Element" |
|
17590 elem "Element" |
|
17591 txt "Text" |
|
17592 prefix "String" |
|
17593 appendedChild "Node" |
|
17594 bodyList "NodeList" |
|
17595 | |
|
17596 "implementationAttribute not supported: namespaceAware" |
|
17597 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17598 bodyList := doc getElementsByTagName: 'body'. |
|
17599 bodyElem := bodyList item:0. |
|
17600 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17601 txt := doc createTextNode:'Text'. |
|
17602 appendedChild := elem appendChild:txt. |
|
17603 appendedChild := bodyElem appendChild:elem. |
|
17604 prefix := txt lookupPrefix. |
|
17605 self assert: ( prefix = 'dom3' ). |
|
17606 |
|
17607 ! |
|
17608 |
|
17609 test_nodelookupprefix14 |
|
17610 " |
|
17611 Invoke lookupPrefix on a Element's new CDATA node, which has a namespace attribute declaration |
|
17612 with a namespace prefix in its parent Element node and check if the value of the prefix |
|
17613 returned by using its namespaceURI as a parameter is valid. |
|
17614 |
|
17615 Creator: IBM |
|
17616 Autor Jenny Hsu |
|
17617 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17618 " |
|
17619 | |
|
17620 doc "Document" |
|
17621 bodyElem "Element" |
|
17622 elem "Element" |
|
17623 cdata "CDATASection" |
|
17624 prefix "String" |
|
17625 appendedChild "Node" |
|
17626 bodyList "NodeList" |
|
17627 | |
|
17628 "implementationAttribute not supported: namespaceAware" |
|
17629 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17630 bodyList := doc getElementsByTagName: 'body'. |
|
17631 bodyElem := bodyList item:0. |
|
17632 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17633 cdata := doc createCDATASection:'Text'. |
|
17634 appendedChild := elem appendChild:cdata. |
|
17635 appendedChild := bodyElem appendChild:elem. |
|
17636 prefix := cdata lookupPrefix. |
|
17637 self assert: ( prefix = 'dom3' ). |
|
17638 |
|
17639 ! |
|
17640 |
|
17641 test_nodelookupprefix15 |
|
17642 " |
|
17643 Invoke lookupPrefix on a Element's new Comment node, which has a namespace attribute declaration |
|
17644 with a namespace prefix in its parent Element node and check if the value of the prefix |
|
17645 returned by using its namespaceURI as a parameter is valid. |
|
17646 |
|
17647 Creator: IBM |
|
17648 Autor Jenny Hsu |
|
17649 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17650 " |
|
17651 | |
|
17652 doc "Document" |
|
17653 bodyElem "Element" |
|
17654 elem "Element" |
|
17655 comment "Comment" |
|
17656 clonedComment "Comment" |
|
17657 prefix "String" |
|
17658 appendedChild "Node" |
|
17659 bodyList "NodeList" |
|
17660 | |
|
17661 "implementationAttribute not supported: namespaceAware" |
|
17662 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17663 bodyList := doc getElementsByTagName: 'body'. |
|
17664 bodyElem := bodyList item:0. |
|
17665 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17666 comment := doc createComment:'Text'. |
|
17667 clonedComment := comment cloneNode:true. |
|
17668 appendedChild := elem appendChild:clonedComment. |
|
17669 appendedChild := bodyElem appendChild:elem. |
|
17670 prefix := clonedComment lookupPrefix. |
|
17671 self assert: ( prefix = 'dom3' ). |
|
17672 |
|
17673 ! |
|
17674 |
|
17675 test_nodelookupprefix16 |
|
17676 " |
|
17677 Invoke lookupPrefix on a new Attribute node with with a namespace URI |
|
17678 and prefix and verify if the prefix returned is null. |
|
17679 |
|
17680 Creator: IBM |
|
17681 Autor Jenny Hsu |
|
17682 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17683 " |
|
17684 | |
|
17685 doc "Document" |
|
17686 elem "Element" |
|
17687 attr "Attr" |
|
17688 prefix "String" |
|
17689 attNode "Attr" |
|
17690 | |
|
17691 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
17692 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
17693 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
17694 attNode := elem setAttributeNodeNS: attr. |
|
17695 prefix := attr lookupPrefix. |
|
17696 self assert: prefix isNil. |
|
17697 |
|
17698 ! |
|
17699 |
|
17700 test_nodelookupprefix17 |
|
17701 " |
|
17702 Invoke lookupPrefix on the title attribute node of the acronym node with |
|
17703 a namespaceURI and a node prefix and check if the value of the prefix returned by |
|
17704 using its namespaceURI as a parameter is valid. |
|
17705 |
|
17706 Creator: IBM |
|
17707 Autor Jenny Hsu |
|
17708 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17709 " |
|
17710 | |
|
17711 doc "Document" |
|
17712 elem "Element" |
|
17713 elemList "NodeList" |
|
17714 attributesMap "NamedNodeMap" |
|
17715 attr "Attr" |
|
17716 prefix "String" |
|
17717 | |
|
17718 "implementationAttribute not supported: namespaceAware" |
|
17719 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17720 elemList := doc getElementsByTagName: 'acronym'. |
|
17721 elem := elemList item:2. |
|
17722 attributesMap := elem attributes. |
|
17723 attr := attributesMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
17724 prefix := attr lookupPrefix. |
|
17725 self assert: ( prefix = 'dmstc' ). |
|
17726 |
|
17727 ! |
|
17728 |
|
17729 test_nodelookupprefix18 |
|
17730 " |
|
17731 Invoke lookupPrefix on the default attribute node of the p node with |
|
17732 a namespaceURI and a node prefix and check if the value of the prefix returned by |
|
17733 using its namespaceURI as a parameter is valid. |
|
17734 |
|
17735 Creator: IBM |
|
17736 Autor Jenny Hsu |
|
17737 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17738 " |
|
17739 | |
|
17740 doc "Document" |
|
17741 elem "Element" |
|
17742 elemList "NodeList" |
|
17743 attributesMap "NamedNodeMap" |
|
17744 attr "Attr" |
|
17745 prefix "String" |
|
17746 | |
|
17747 "implementationAttribute not supported: namespaceAware" |
|
17748 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17749 elemList := doc getElementsByTagName: 'p'. |
|
17750 elem := elemList item:3. |
|
17751 attributesMap := elem attributes. |
|
17752 attr := attributesMap getNamedItem:'dir'. |
|
17753 prefix := attr lookupPrefix. |
|
17754 self assert: prefix isNil. |
|
17755 prefix := attr lookupPrefix. |
|
17756 self assert: ( prefix = 'nm' ). |
|
17757 |
|
17758 ! |
|
17759 |
|
17760 test_nodelookupprefix19 |
|
17761 " |
|
17762 Invoke lookupPrefix on the an attribute node without a namespace prefix of |
|
17763 an Element node that has a namespaceURI and prefix, and check if the value of the prefix |
|
17764 returned by using the Elements namespaceURI as a parameter is valid. |
|
17765 |
|
17766 Creator: IBM |
|
17767 Autor Jenny Hsu |
|
17768 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17769 " |
|
17770 | |
|
17771 doc "Document" |
|
17772 elem "Element" |
|
17773 elemList "NodeList" |
|
17774 attributesMap "NamedNodeMap" |
|
17775 attr "Attr" |
|
17776 prefix "String" |
|
17777 | |
|
17778 "implementationAttribute not supported: namespaceAware" |
|
17779 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo_nodefaultns'). |
|
17780 elemList := doc getElementsByTagName: 'html:p'. |
|
17781 elem := elemList item:0. |
|
17782 attributesMap := elem attributes. |
|
17783 attr := attributesMap getNamedItem:'class'. |
|
17784 prefix := attr lookupPrefix. |
|
17785 self assert: ( prefix = 'html' ). |
|
17786 |
|
17787 ! |
|
17788 |
|
17789 test_nodelookupprefix20 |
|
17790 " |
|
17791 |
|
17792 |
|
17793 |
|
17794 Invoke lookupPrefix on the an attribute node without a namespace prefix of |
|
17795 an Element node that has a namespaceURI and prefix, and check if the value of the prefix |
|
17796 returned by using the Elements namespaceURI as a parameter is valid. |
|
17797 |
|
17798 Creator: IBM |
|
17799 Autor Jenny Hsu |
|
17800 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix |
|
17801 " |
|
17802 | |
|
17803 doc "Document" |
|
17804 elem "Element" |
|
17805 elemList "NodeList" |
|
17806 attributesMap "NamedNodeMap" |
|
17807 attr "Attr" |
|
17808 prefix "String" |
|
17809 | |
|
17810 "implementationAttribute not supported: namespaceAware" |
|
17811 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17812 elemList := doc getElementsByTagName: 'p'. |
|
17813 elem := elemList item:3. |
|
17814 attributesMap := elem attributes. |
|
17815 attr := attributesMap getNamedItem:'xmlns:nm'. |
|
17816 prefix := attr lookupPrefix. |
|
17817 self assert: ( prefix = 'nm' ). |
|
17818 |
|
17819 ! |
|
17820 |
|
17821 test_noderemovechild01 |
|
17822 " |
|
17823 |
|
17824 |
|
17825 |
|
17826 Using removeChild on this Document node attempt to remove this Document node and |
|
17827 verify if a NOT_FOUND_ERR error is thrown. |
|
17828 |
|
17829 Creator: IBM |
|
17830 Autor Neil Delima |
|
17831 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
17832 " |
|
17833 | |
|
17834 doc "Document" |
|
17835 removed "Node" |
|
17836 | |
|
17837 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17838 "assertDOMException..." |
|
17839 self should:[ |
|
17840 removed := doc removeChild:doc. |
|
17841 ] raise: DOMException. |
|
17842 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
17843 "end of assertDOMException..." |
|
17844 |
|
17845 ! |
|
17846 |
|
17847 test_noderemovechild02 |
|
17848 " |
|
17849 Using removeChild on this Document node attempt to remove a new Document node and |
|
17850 vice versa and verify if a NOT_FOUND_ERR error is thrown. |
|
17851 |
|
17852 Creator: IBM |
|
17853 Autor Neil Delima |
|
17854 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
17855 " |
|
17856 | |
|
17857 doc "Document" |
|
17858 domImpl "DOMImplementation" |
|
17859 newDoc "Document" |
|
17860 removed "Node" |
|
17861 nullDocType "DocumentType" |
|
17862 docElem "Element" |
|
17863 rootNS "String" |
|
17864 rootName "String" |
|
17865 | |
|
17866 nullDocType := nil. |
|
17867 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17868 docElem := doc documentElement. |
|
17869 rootNS := docElem namespaceURI. |
|
17870 rootName := docElem tagName. |
|
17871 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
17872 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
17873 "assertDOMException..." |
|
17874 self should:[ |
|
17875 removed := doc removeChild:newDoc. |
|
17876 ] raise: DOMException. |
|
17877 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
17878 "end of assertDOMException..." |
|
17879 "assertDOMException..." |
|
17880 self should:[ |
|
17881 removed := newDoc removeChild:doc. |
|
17882 ] raise: DOMException. |
|
17883 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
17884 "end of assertDOMException..." |
|
17885 |
|
17886 ! |
|
17887 |
|
17888 test_noderemovechild03 |
|
17889 " |
|
17890 Using removeChild on this DocumentElement node attempt to remove this Document node and |
|
17891 verify if the DocumentElement is null. Now try the reverse and a NOT_FOUND_ERR should be |
|
17892 thrown. |
|
17893 |
|
17894 Creator: IBM |
|
17895 Autor Neil Delima |
|
17896 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
17897 " |
|
17898 | |
|
17899 doc "Document" |
|
17900 docElem "Element" |
|
17901 removedChild "Element" |
|
17902 removed "Node" |
|
17903 | |
|
17904 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17905 docElem := doc documentElement. |
|
17906 removed := doc removeChild:docElem. |
|
17907 removedChild := doc documentElement. |
|
17908 self assert: removedChild isNil. |
|
17909 "assertDOMException..." |
|
17910 self should:[ |
|
17911 removed := docElem removeChild:doc. |
|
17912 ] raise: DOMException. |
|
17913 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
17914 "end of assertDOMException..." |
|
17915 |
|
17916 ! |
|
17917 |
|
17918 test_noderemovechild04 |
|
17919 " |
|
17920 |
|
17921 |
|
17922 |
|
17923 Using removeChild on this Document node attempt to remove DocumentType node and |
|
17924 verify if the DocumentType node is null. Now try the reverse and a NOT_FOUND_ERR should be |
|
17925 thrown. |
|
17926 |
|
17927 Creator: IBM |
|
17928 Autor Neil Delima |
|
17929 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
17930 " |
|
17931 | |
|
17932 doc "Document" |
|
17933 docType "DocumentType" |
|
17934 removedDocType "DocumentType" |
|
17935 removed "Node" |
|
17936 | |
|
17937 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
17938 docType := doc doctype. |
|
17939 removed := doc removeChild:docType. |
|
17940 removedDocType := doc doctype. |
|
17941 self assert: removedDocType isNil. |
|
17942 "assertDOMException..." |
|
17943 self should:[ |
|
17944 removed := docType removeChild:doc. |
|
17945 ] raise: DOMException. |
|
17946 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
17947 "end of assertDOMException..." |
|
17948 |
|
17949 ! |
|
17950 |
|
17951 test_noderemovechild05 |
|
17952 " |
|
17953 Using removeChild on this Document node attempt to remove a new DocumentType node and |
|
17954 verify if the DocumentType node is null. Attempting to remove the DocumentType |
|
17955 a second type should result in a NOT_FOUND_ERR. |
|
17956 |
|
17957 Creator: IBM |
|
17958 Autor Neil Delima |
|
17959 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
17960 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=417 |
|
17961 " |
|
17962 | |
|
17963 doc "Document" |
|
17964 domImpl "DOMImplementation" |
|
17965 docType "DocumentType" |
|
17966 removedDocType "DocumentType" |
|
17967 nullPubId "String" |
|
17968 nullSysId "String" |
|
17969 appendedChild "Node" |
|
17970 removedChild "Node" |
|
17971 | |
|
17972 nullPubId := nil. |
|
17973 nullSysId := nil. |
|
17974 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
17975 docType := doc doctype. |
|
17976 "try" |
|
17977 [ |
|
17978 removedChild := doc removeChild:docType. |
|
17979 ] on: DOMException do: [:ex| ]. |
|
17980 "end of try" |
|
17981 self assert: removedChild notNil. |
|
17982 removedDocType := doc doctype. |
|
17983 self assert: removedDocType isNil. |
|
17984 "assertDOMException..." |
|
17985 self should:[ |
|
17986 removedChild := docType removeChild:doc. |
|
17987 ] raise: DOMException. |
|
17988 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
17989 "end of assertDOMException..." |
|
17990 |
|
17991 ! |
|
17992 |
|
17993 test_noderemovechild07 |
|
17994 " |
|
17995 Attempts to remove a notation from a Document node. Since notations are children of |
|
17996 DocumentType, not Document the operation should fail with a NOT_FOUND_ERR. Attempting |
|
17997 to remove Document from a Notation should also fail either with a NOT_FOUND_ERR |
|
17998 or a NO_MODIFICATION_ALLOWED_ERR. |
|
17999 |
|
18000 Creator: IBM |
|
18001 Autor Neil Delima |
|
18002 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18003 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=418 |
|
18004 " |
|
18005 | |
|
18006 doc "Document" |
|
18007 docType "DocumentType" |
|
18008 notations "NamedNodeMap" |
|
18009 notation "Notation" |
|
18010 removedChild "Node" |
|
18011 | |
|
18012 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18013 docType := doc doctype. |
|
18014 notations := docType notations. |
|
18015 notation := notations getNamedItem:'notation1'. |
|
18016 "assertDOMException..." |
|
18017 self should:[ |
|
18018 removedChild := doc removeChild:notation. |
|
18019 ] raise: DOMException. |
|
18020 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18021 "end of assertDOMException..." |
|
18022 "try" |
|
18023 [ |
|
18024 removedChild := notation removeChild:doc. |
|
18025 ] on: DOMException do: [:ex| ]. |
|
18026 "end of try" |
|
18027 |
|
18028 ! |
|
18029 |
|
18030 test_noderemovechild08 |
|
18031 " |
|
18032 |
|
18033 |
|
18034 |
|
18035 Using removeChild on this Document node attempt to remove a new Comment node and |
|
18036 verify the data of the removed comment node.. |
|
18037 |
|
18038 Creator: IBM |
|
18039 Autor Neil Delima |
|
18040 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18041 " |
|
18042 | |
|
18043 doc "Document" |
|
18044 comment "Comment" |
|
18045 removedCmt "Comment" |
|
18046 data "String" |
|
18047 appendedChild "Node" |
|
18048 | |
|
18049 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18050 comment := doc createComment:'Comment'. |
|
18051 appendedChild := doc appendChild:comment. |
|
18052 removedCmt := doc removeChild:comment. |
|
18053 data := removedCmt data. |
|
18054 self assert: ( data = 'Comment' ). |
|
18055 |
|
18056 ! |
|
18057 |
|
18058 test_noderemovechild09 |
|
18059 " |
|
18060 |
|
18061 |
|
18062 |
|
18063 Using removeChild on this Document node attempt to remove a new ProcessingInstruction node and |
|
18064 verify the target of the removed ProcessingInstruction node. |
|
18065 |
|
18066 Creator: IBM |
|
18067 Autor Neil Delima |
|
18068 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18069 " |
|
18070 | |
|
18071 doc "Document" |
|
18072 pi "ProcessingInstruction" |
|
18073 removedPi "ProcessingInstruction" |
|
18074 target "String" |
|
18075 appendedChild "Node" |
|
18076 | |
|
18077 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18078 pi := doc createProcessingInstruction:'PIT' data:'PID'. |
|
18079 appendedChild := doc appendChild:pi. |
|
18080 removedPi := doc removeChild:pi. |
|
18081 target := removedPi target. |
|
18082 self assert: ( target = 'PIT' ). |
|
18083 |
|
18084 ! |
|
18085 |
|
18086 test_noderemovechild10 |
|
18087 " |
|
18088 Using removeChild on a new DocumentFragment node attempt to remove a new Element node and |
|
18089 verify the name of the removed Element node. |
|
18090 |
|
18091 Creator: IBM |
|
18092 Autor Neil Delima |
|
18093 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18094 " |
|
18095 | |
|
18096 doc "Document" |
|
18097 docFrag "DocumentFragment" |
|
18098 elem "Element" |
|
18099 removedElem "Element" |
|
18100 elemName "String" |
|
18101 appendedChild "Node" |
|
18102 removedChild "Node" |
|
18103 | |
|
18104 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
18105 docFrag := doc createDocumentFragment. |
|
18106 elem := doc createElement:'dom3:br' ns:'http://www.w3.org/1999/xhtml'. |
|
18107 appendedChild := docFrag appendChild:elem. |
|
18108 removedElem := docFrag removeChild:elem. |
|
18109 elemName := removedElem nodeName. |
|
18110 self assert: ( elemName = 'dom3:br' ). |
|
18111 |
|
18112 ! |
|
18113 |
|
18114 test_noderemovechild11 |
|
18115 " |
|
18116 |
|
18117 |
|
18118 |
|
18119 Using removeChild on a new DocumentFragment node attempt to remove a new Text node and |
|
18120 verify the name of the removed Element node. |
|
18121 |
|
18122 Creator: IBM |
|
18123 Autor Neil Delima |
|
18124 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18125 " |
|
18126 | |
|
18127 doc "Document" |
|
18128 docFrag "DocumentFragment" |
|
18129 txt "Text" |
|
18130 removedTxt "Text" |
|
18131 appendedChild "Node" |
|
18132 removedChild "Node" |
|
18133 | |
|
18134 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18135 docFrag := doc createDocumentFragment. |
|
18136 txt := doc createTextNode:'TEXT'. |
|
18137 appendedChild := docFrag appendChild:txt. |
|
18138 removedChild := docFrag removeChild:txt. |
|
18139 removedTxt := docFrag firstChild. |
|
18140 self assert: removedTxt isNil. |
|
18141 |
|
18142 ! |
|
18143 |
|
18144 test_noderemovechild12 |
|
18145 " |
|
18146 The method removeChild removes the child node indicated by oldChild from the list |
|
18147 of children, and returns it. |
|
18148 |
|
18149 Using removeChild on a new DocumentFragment node attempt to remove a new EntityReference node. |
|
18150 Also attempt to remove the document fragment node from the EntityReference. Verify that a |
|
18151 NO_MODIFICATION_ALLOWED_ERR (EntityReference node is read-only) or a NOT_FOUND_ERR is thrown. |
|
18152 |
|
18153 Creator: IBM |
|
18154 Autor Neil Delima |
|
18155 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18156 " |
|
18157 | |
|
18158 doc "Document" |
|
18159 docFrag "DocumentFragment" |
|
18160 eRef "EntityReference" |
|
18161 removedERef "EntityReference" |
|
18162 appendedChild "Node" |
|
18163 removedChild "Node" |
|
18164 | |
|
18165 "implementationAttribute not supported: namespaceAware" |
|
18166 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18167 docFrag := doc createDocumentFragment. |
|
18168 eRef := doc createEntityReference:'ent1'. |
|
18169 appendedChild := docFrag appendChild:eRef. |
|
18170 removedChild := docFrag removeChild:eRef. |
|
18171 removedERef := docFrag firstChild. |
|
18172 self assert: removedERef isNil. |
|
18173 "try" |
|
18174 [ |
|
18175 removedChild := eRef removeChild:docFrag. |
|
18176 ] on: DOMException do: [:ex| ]. |
|
18177 "end of try" |
|
18178 |
|
18179 ! |
|
18180 |
|
18181 test_noderemovechild13 |
|
18182 " |
|
18183 Using removeChild on a new EntityReference node attempt to remove the first child |
|
18184 of this node and verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
18185 |
|
18186 Creator: IBM |
|
18187 Autor Neil Delima |
|
18188 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18189 " |
|
18190 | |
|
18191 doc "Document" |
|
18192 txt "Text" |
|
18193 eRef "EntityReference" |
|
18194 removed "Node" |
|
18195 | |
|
18196 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18197 eRef := doc createEntityReference:'alpha'. |
|
18198 txt := eRef firstChild. |
|
18199 self assert: txt notNil. |
|
18200 "assertDOMException..." |
|
18201 self should:[ |
|
18202 removed := eRef removeChild:txt. |
|
18203 ] raise: DOMException. |
|
18204 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
18205 "end of assertDOMException..." |
|
18206 |
|
18207 ! |
|
18208 |
|
18209 test_noderemovechild14 |
|
18210 " |
|
18211 Using removeChild on a new EntityReference node attempt to remove its last ProcessingInstruction |
|
18212 child node and verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
18213 |
|
18214 Creator: IBM |
|
18215 Autor Neil Delima |
|
18216 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18217 " |
|
18218 | |
|
18219 doc "Document" |
|
18220 removed "Node" |
|
18221 eRef "EntityReference" |
|
18222 pi "ProcessingInstruction" |
|
18223 entName "String" |
|
18224 | |
|
18225 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18226 eRef := doc createEntityReference:'ent4'. |
|
18227 pi := eRef lastChild. |
|
18228 self assert: pi notNil. |
|
18229 "assertDOMException..." |
|
18230 self should:[ |
|
18231 removed := eRef removeChild:pi. |
|
18232 ] raise: DOMException. |
|
18233 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
18234 "end of assertDOMException..." |
|
18235 |
|
18236 ! |
|
18237 |
|
18238 test_noderemovechild15 |
|
18239 " |
|
18240 Using removeChild on a new EntityReference node attempt to remove an Element child |
|
18241 and verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
18242 |
|
18243 Creator: IBM |
|
18244 Autor Neil Delima |
|
18245 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18246 " |
|
18247 | |
|
18248 doc "Document" |
|
18249 eRef "EntityReference" |
|
18250 elem "Element" |
|
18251 entName "String" |
|
18252 removed "Node" |
|
18253 | |
|
18254 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18255 eRef := doc createEntityReference:'ent4'. |
|
18256 elem := eRef firstChild. |
|
18257 self assert: elem notNil. |
|
18258 "assertDOMException..." |
|
18259 self should:[ |
|
18260 removed := eRef removeChild:elem. |
|
18261 ] raise: DOMException. |
|
18262 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
18263 "end of assertDOMException..." |
|
18264 |
|
18265 ! |
|
18266 |
|
18267 test_noderemovechild16 |
|
18268 " |
|
18269 Using removeChild on the first 'p' Element node attempt to remove its 'em' |
|
18270 Element child and verify the name of the returned node that was removed. Now attempt |
|
18271 the reverse and verify if a NOT_FOUND_ERR is thrown. |
|
18272 |
|
18273 Creator: IBM |
|
18274 Autor Neil Delima |
|
18275 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18276 " |
|
18277 | |
|
18278 doc "Document" |
|
18279 parentList "NodeList" |
|
18280 childList "NodeList" |
|
18281 parent "Element" |
|
18282 child "Element" |
|
18283 removed "Element" |
|
18284 removedName "String" |
|
18285 removedNode "Node" |
|
18286 | |
|
18287 ^self. "ignoringElementContentWhitespace supported" |
|
18288 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18289 parentList := doc getElementsByTagName: 'em'. |
|
18290 child := parentList item:0. |
|
18291 parent := child parentNode. |
|
18292 removed := parent removeChild:child. |
|
18293 removedName := removed nodeName. |
|
18294 self assert: ( removedName = 'em' ). |
|
18295 "assertDOMException..." |
|
18296 self should:[ |
|
18297 removedNode := child removeChild:parent. |
|
18298 ] raise: DOMException. |
|
18299 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18300 "end of assertDOMException..." |
|
18301 |
|
18302 ! |
|
18303 |
|
18304 test_noderemovechild17 |
|
18305 " |
|
18306 Using removeChild on the first 'p' Element node attempt to remove a Text |
|
18307 node child and verify the contents of the returned node that was removed. Now attempt |
|
18308 the reverse and verify if a NOT_FOUND_ERR is thrown. |
|
18309 |
|
18310 Creator: IBM |
|
18311 Autor Neil Delima |
|
18312 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18313 " |
|
18314 | |
|
18315 doc "Document" |
|
18316 parentList "NodeList" |
|
18317 parent "Element" |
|
18318 child "Text" |
|
18319 removed "Text" |
|
18320 removedValue "String" |
|
18321 removedNode "Node" |
|
18322 | |
|
18323 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18324 parentList := doc getElementsByTagName: 'em'. |
|
18325 parent := parentList item:0. |
|
18326 child := parent firstChild. |
|
18327 removed := parent removeChild:child. |
|
18328 removedValue := removed nodeValue. |
|
18329 self assert: ( removedValue = 'EMP0001' ). |
|
18330 "assertDOMException..." |
|
18331 self should:[ |
|
18332 removedNode := child removeChild:parent. |
|
18333 ] raise: DOMException. |
|
18334 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18335 "end of assertDOMException..." |
|
18336 |
|
18337 ! |
|
18338 |
|
18339 test_noderemovechild18 |
|
18340 " |
|
18341 |
|
18342 |
|
18343 |
|
18344 Using removeChild on the first 'p' Element node attempt to remove a CDATASection |
|
18345 node child and verify the contents of the returned node that was removed. Now attempt |
|
18346 the reverse and verify if a NOT_FOUND_ERR is thrown. |
|
18347 |
|
18348 Creator: IBM |
|
18349 Autor Neil Delima |
|
18350 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18351 " |
|
18352 | |
|
18353 doc "Document" |
|
18354 parentList "NodeList" |
|
18355 parent "Element" |
|
18356 child "CDATASection" |
|
18357 removed "CDATASection" |
|
18358 removedValue "String" |
|
18359 removedNode "Node" |
|
18360 | |
|
18361 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18362 parentList := doc getElementsByTagName: 'strong'. |
|
18363 parent := parentList item:1. |
|
18364 child := parent lastChild. |
|
18365 removed := parent removeChild:child. |
|
18366 removedValue := removed nodeValue. |
|
18367 self assert: ( removedValue = 'This is an adjacent CDATASection with a reference to a tab &tab;' ). |
|
18368 "assertDOMException..." |
|
18369 self should:[ |
|
18370 removedNode := child removeChild:parent. |
|
18371 ] raise: DOMException. |
|
18372 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18373 "end of assertDOMException..." |
|
18374 |
|
18375 ! |
|
18376 |
|
18377 test_noderemovechild19 |
|
18378 " |
|
18379 Using removeChild on the first 'p' Element node attempt to remove a EntityReference |
|
18380 node child and verify the nodeName of the returned node that was removed. Attempt |
|
18381 to remove a non-child from an entity reference and expect either a NOT_FOUND_ERR or |
|
18382 a NO_MODIFICATION_ALLOWED_ERR. Renove a child from an entity reference and expect |
|
18383 a NO_MODIFICATION_ALLOWED_ERR. |
|
18384 |
|
18385 Creator: IBM |
|
18386 Autor Neil Delima |
|
18387 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18388 " |
|
18389 | |
|
18390 doc "Document" |
|
18391 parentList "NodeList" |
|
18392 parent "Element" |
|
18393 child "EntityReference" |
|
18394 removed "EntityReference" |
|
18395 removedName "String" |
|
18396 removedNode "Node" |
|
18397 entRefChild "Node" |
|
18398 | |
|
18399 "implementationAttribute not supported: expandEntityReferences" |
|
18400 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18401 parentList := doc getElementsByTagName: 'acronym'. |
|
18402 parent := parentList item:1. |
|
18403 child := parent firstChild. |
|
18404 removed := parent removeChild:child. |
|
18405 removedName := removed nodeName. |
|
18406 self assert: ( removedName = 'beta' ). |
|
18407 "try" |
|
18408 [ |
|
18409 removedNode := child removeChild:parent. |
|
18410 self assert:false. ] on: DOMException do: [:ex| ]. |
|
18411 "end of try" |
|
18412 entRefChild := child firstChild. |
|
18413 "if" |
|
18414 ( entRefChild notNil ) ifTrue: [ |
|
18415 self assert:false description:'Method "NO_MODIFICATION_ALLOWED_ERR" is not supported yet'. |
|
18416 ]. |
|
18417 |
|
18418 ! |
|
18419 |
|
18420 test_noderemovechild20 |
|
18421 " |
|
18422 Using removeChild on the first 'p' Element node attempt to remove a new |
|
18423 Element child and verify the name of the returned node that was removed. Now attempt |
|
18424 to do the same on a cloned child and verify if a NOT_FOUND_ERR is thrown. |
|
18425 |
|
18426 Creator: IBM |
|
18427 Autor Neil Delima |
|
18428 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18429 " |
|
18430 | |
|
18431 doc "Document" |
|
18432 parentList "NodeList" |
|
18433 childList "NodeList" |
|
18434 parent "Element" |
|
18435 child "Element" |
|
18436 clonedChild "Element" |
|
18437 removed "Element" |
|
18438 removedName "String" |
|
18439 appendedChild "Node" |
|
18440 removedNode "Node" |
|
18441 | |
|
18442 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18443 parentList := doc getElementsByTagName: 'p'. |
|
18444 parent := parentList item:0. |
|
18445 child := doc createElement:'dom3:br' ns:'http://www.w3.org/1999/xhtml'. |
|
18446 appendedChild := parent appendChild:child. |
|
18447 removed := parent removeChild:child. |
|
18448 removedName := removed nodeName. |
|
18449 self assert: ( removedName = 'dom3:br' ). |
|
18450 clonedChild := child cloneNode:true. |
|
18451 "assertDOMException..." |
|
18452 self should:[ |
|
18453 removedNode := parent removeChild:clonedChild. |
|
18454 ] raise: DOMException. |
|
18455 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18456 "end of assertDOMException..." |
|
18457 |
|
18458 ! |
|
18459 |
|
18460 test_noderemovechild21 |
|
18461 " |
|
18462 Using removeChild on a new Element node attempt to remove a new Element child |
|
18463 and verify the name of the returned node that was removed. Now append the parent |
|
18464 to the documentElement and attempt to remove the child using removeChild on the |
|
18465 documentElement and verify if a NOT_FOUND_ERR is thrown. |
|
18466 |
|
18467 Creator: IBM |
|
18468 Autor Neil Delima |
|
18469 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18470 " |
|
18471 | |
|
18472 doc "Document" |
|
18473 docElem "Element" |
|
18474 parent "Element" |
|
18475 child "Element" |
|
18476 removed "Element" |
|
18477 removedName "String" |
|
18478 removedNode "Node" |
|
18479 appendedChild "Node" |
|
18480 | |
|
18481 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18482 docElem := doc documentElement. |
|
18483 parent := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
18484 child := doc createElement:'dom3:br' ns:'http://www.w3.org/1999/xhtml'. |
|
18485 appendedChild := parent appendChild:child. |
|
18486 appendedChild := docElem appendChild:parent. |
|
18487 removed := parent removeChild:child. |
|
18488 removedName := removed nodeName. |
|
18489 self assert: ( removedName = 'dom3:br' ). |
|
18490 "assertDOMException..." |
|
18491 self should:[ |
|
18492 removedNode := docElem removeChild:child. |
|
18493 ] raise: DOMException. |
|
18494 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18495 "end of assertDOMException..." |
|
18496 |
|
18497 ! |
|
18498 |
|
18499 test_noderemovechild22 |
|
18500 " |
|
18501 Using removeChild on a new Element node attempt to remove a new Comment child |
|
18502 and verify the name of the rturned node that was removed. Now to remove the child |
|
18503 using removeChild on the parent and verify if a NOT_FOUND_ERR is thrown. |
|
18504 |
|
18505 Creator: IBM |
|
18506 Autor Neil Delima |
|
18507 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18508 " |
|
18509 | |
|
18510 doc "Document" |
|
18511 parent "Element" |
|
18512 child "Comment" |
|
18513 removed "Comment" |
|
18514 removedName "String" |
|
18515 removedNode "Node" |
|
18516 appendedChild "Node" |
|
18517 | |
|
18518 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18519 parent := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
18520 child := doc createComment:'DATA'. |
|
18521 appendedChild := parent appendChild:child. |
|
18522 removed := parent removeChild:child. |
|
18523 removedName := removed nodeValue. |
|
18524 self assert: ( removedName = 'DATA' ). |
|
18525 "assertDOMException..." |
|
18526 self should:[ |
|
18527 removedNode := parent removeChild:child. |
|
18528 ] raise: DOMException. |
|
18529 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18530 "end of assertDOMException..." |
|
18531 |
|
18532 ! |
|
18533 |
|
18534 test_noderemovechild23 |
|
18535 " |
|
18536 Using removeChild on a new Element node attempt to remove a new ProcessingInstruction child |
|
18537 and verify the name of the returned node that was removed. Now to remove the child |
|
18538 using removeChild on the parent and verify if a NOT_FOUND_ERR is thrown. |
|
18539 |
|
18540 Creator: IBM |
|
18541 Autor Neil Delima |
|
18542 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18543 " |
|
18544 | |
|
18545 doc "Document" |
|
18546 parent "Element" |
|
18547 child "ProcessingInstruction" |
|
18548 removed "ProcessingInstruction" |
|
18549 removedName "String" |
|
18550 removedNode "Node" |
|
18551 appendedChild "Node" |
|
18552 | |
|
18553 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18554 parent := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
18555 child := doc createProcessingInstruction:'TARGET' data:'DATA'. |
|
18556 appendedChild := parent appendChild:child. |
|
18557 removed := parent removeChild:child. |
|
18558 removedName := removed target. |
|
18559 self assert: ( removedName = 'TARGET' ). |
|
18560 "assertDOMException..." |
|
18561 self should:[ |
|
18562 removedNode := parent removeChild:child. |
|
18563 ] raise: DOMException. |
|
18564 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18565 "end of assertDOMException..." |
|
18566 |
|
18567 ! |
|
18568 |
|
18569 test_noderemovechild24 |
|
18570 " |
|
18571 Using removeChild on an Entity node attempt to remove a Text child |
|
18572 and verify if a NO_MODIFICATION_ALLOWED_ERR gets thrown. |
|
18573 |
|
18574 Creator: IBM |
|
18575 Autor Neil Delima |
|
18576 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18577 " |
|
18578 | |
|
18579 doc "Document" |
|
18580 docType "DocumentType" |
|
18581 entitiesMap "NamedNodeMap" |
|
18582 alphaEntity "Entity" |
|
18583 alphaText "Text" |
|
18584 removed "Text" |
|
18585 | |
|
18586 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18587 docType := doc doctype. |
|
18588 entitiesMap := docType entities. |
|
18589 alphaEntity := entitiesMap getNamedItem:'alpha'. |
|
18590 self assert: alphaEntity notNil. |
|
18591 alphaText := alphaEntity firstChild. |
|
18592 self assert: alphaText notNil. |
|
18593 "assertDOMException..." |
|
18594 self should:[ |
|
18595 removed := alphaEntity removeChild:alphaText. |
|
18596 ] raise: DOMException. |
|
18597 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
18598 "end of assertDOMException..." |
|
18599 |
|
18600 ! |
|
18601 |
|
18602 test_noderemovechild25 |
|
18603 " |
|
18604 Using removeChild on an Entity node attempt to remove an Element child |
|
18605 and verify if a NO_MODIFICATION_ALLOWED_ERR gets thrown. |
|
18606 |
|
18607 Creator: IBM |
|
18608 Autor Neil Delima |
|
18609 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18610 " |
|
18611 | |
|
18612 doc "Document" |
|
18613 docType "DocumentType" |
|
18614 entitiesMap "NamedNodeMap" |
|
18615 ent4 "Entity" |
|
18616 span "Element" |
|
18617 removed "Node" |
|
18618 | |
|
18619 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18620 docType := doc doctype. |
|
18621 entitiesMap := docType entities. |
|
18622 ent4 := entitiesMap getNamedItem:'ent4'. |
|
18623 self assert: ent4 notNil. |
|
18624 span := ent4 firstChild. |
|
18625 self assert: span notNil. |
|
18626 "assertDOMException..." |
|
18627 self should:[ |
|
18628 removed := ent4 removeChild:span. |
|
18629 ] raise: DOMException. |
|
18630 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
18631 "end of assertDOMException..." |
|
18632 |
|
18633 ! |
|
18634 |
|
18635 test_noderemovechild26 |
|
18636 " |
|
18637 Using removeChild on an Entity node attempt to remove a ProcessingInstruction child |
|
18638 and verify if a NO_MODIFICATION_ALLOWED_ERR gets thrown. |
|
18639 |
|
18640 Creator: IBM |
|
18641 Autor Neil Delima |
|
18642 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18643 " |
|
18644 | |
|
18645 doc "Document" |
|
18646 docType "DocumentType" |
|
18647 entitiesMap "NamedNodeMap" |
|
18648 ent4 "Entity" |
|
18649 pi "ProcessingInstruction" |
|
18650 removed "Node" |
|
18651 | |
|
18652 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18653 docType := doc doctype. |
|
18654 entitiesMap := docType entities. |
|
18655 ent4 := entitiesMap getNamedItem:'ent4'. |
|
18656 self assert: ent4 notNil. |
|
18657 pi := ent4 lastChild. |
|
18658 self assert: pi notNil. |
|
18659 "assertDOMException..." |
|
18660 self should:[ |
|
18661 removed := ent4 removeChild:pi. |
|
18662 ] raise: DOMException. |
|
18663 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
18664 "end of assertDOMException..." |
|
18665 |
|
18666 ! |
|
18667 |
|
18668 test_noderemovechild27 |
|
18669 " |
|
18670 The method removeChild removes the child node indicated by oldChild from the list |
|
18671 of children, and returns it. |
|
18672 |
|
18673 Using removeChild on a Notation node attempt to remove an Entity node |
|
18674 and verify if a NO_MODIFICATION_ALLOWED_ERR or a NOT_FOUND_ERR gets thrown. |
|
18675 |
|
18676 Creator: IBM |
|
18677 Autor Neil Delima |
|
18678 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18679 " |
|
18680 | |
|
18681 doc "Document" |
|
18682 docType "DocumentType" |
|
18683 entitiesMap "NamedNodeMap" |
|
18684 notationsMap "NamedNodeMap" |
|
18685 child "Entity" |
|
18686 parent "Notation" |
|
18687 removed "Node" |
|
18688 | |
|
18689 "implementationAttribute not supported: namespaceAware" |
|
18690 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18691 docType := doc doctype. |
|
18692 entitiesMap := docType entities. |
|
18693 notationsMap := docType notations. |
|
18694 child := entitiesMap getNamedItem:'ent1'. |
|
18695 parent := notationsMap getNamedItem:'notation1'. |
|
18696 "try" |
|
18697 [ |
|
18698 removed := parent removeChild:child. |
|
18699 ] on: DOMException do: [:ex| ]. |
|
18700 "end of try" |
|
18701 |
|
18702 ! |
|
18703 |
|
18704 test_noderemovechild28 |
|
18705 " |
|
18706 Using removeChild on an Attribute node attempt to remove its Text child node and |
|
18707 and verify the name of the returned node that was removed. Now attempt the reverse |
|
18708 and verify if a NOT_FOUND_ERR is thrown. |
|
18709 |
|
18710 Creator: IBM |
|
18711 Autor Neil Delima |
|
18712 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18713 " |
|
18714 | |
|
18715 doc "Document" |
|
18716 parentList "NodeList" |
|
18717 attrsMap "NamedNodeMap" |
|
18718 parent "Attr" |
|
18719 child "Text" |
|
18720 elem "Element" |
|
18721 removed "Text" |
|
18722 removedName "String" |
|
18723 removedNode "Node" |
|
18724 | |
|
18725 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18726 parentList := doc getElementsByTagName: 'acronym'. |
|
18727 elem := parentList item:0. |
|
18728 attrsMap := elem attributes. |
|
18729 parent := attrsMap getNamedItem:'xsi:noNamespaceSchemaLocation'. |
|
18730 child := parent firstChild. |
|
18731 removed := parent removeChild:child. |
|
18732 removedName := removed nodeValue. |
|
18733 self assert: ( removedName = 'Yes' ). |
|
18734 "assertDOMException..." |
|
18735 self should:[ |
|
18736 removedNode := child removeChild:parent. |
|
18737 ] raise: DOMException. |
|
18738 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18739 "end of assertDOMException..." |
|
18740 |
|
18741 ! |
|
18742 |
|
18743 test_noderemovechild29 |
|
18744 " |
|
18745 Using removeChild on a namespace Attribute node attempt to remove its Text child node and |
|
18746 and verify the name of the returned node that was removed. Now attempt the reverse |
|
18747 and verify if a NOT_FOUND_ERR is thrown. |
|
18748 |
|
18749 Creator: IBM |
|
18750 Autor Neil Delima |
|
18751 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18752 " |
|
18753 | |
|
18754 doc "Document" |
|
18755 parentList "NodeList" |
|
18756 attrsMap "NamedNodeMap" |
|
18757 parent "Attr" |
|
18758 child "Text" |
|
18759 elem "Element" |
|
18760 removed "Text" |
|
18761 removedName "String" |
|
18762 removedNode "Node" |
|
18763 | |
|
18764 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18765 parentList := doc getElementsByTagName: 'p'. |
|
18766 elem := parentList item:0. |
|
18767 attrsMap := elem attributes. |
|
18768 parent := attrsMap getNamedItem:'xmlns:dmstc'. |
|
18769 child := parent firstChild. |
|
18770 removed := parent removeChild:child. |
|
18771 removedName := removed nodeValue. |
|
18772 self assert: ( removedName = 'http://www.usa.com' ). |
|
18773 "assertDOMException..." |
|
18774 self should:[ |
|
18775 removedNode := child removeChild:parent. |
|
18776 ] raise: DOMException. |
|
18777 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18778 "end of assertDOMException..." |
|
18779 |
|
18780 ! |
|
18781 |
|
18782 test_noderemovechild30 |
|
18783 " |
|
18784 |
|
18785 |
|
18786 |
|
18787 Using removeChild on a default Attribute node attempt to remove its Text child node and |
|
18788 and verify the name of the returned node that was removed. Now attempt the reverse |
|
18789 and verify if a NOT_FOUND_ERR is thrown. |
|
18790 |
|
18791 Creator: IBM |
|
18792 Autor Neil Delima |
|
18793 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18794 " |
|
18795 | |
|
18796 doc "Document" |
|
18797 parentList "NodeList" |
|
18798 attrsMap "NamedNodeMap" |
|
18799 parent "Attr" |
|
18800 child "Text" |
|
18801 elem "Element" |
|
18802 removed "Text" |
|
18803 removedNode "Node" |
|
18804 removedName "String" |
|
18805 appendedChild "Node" |
|
18806 | |
|
18807 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18808 parentList := doc getElementsByTagName: 'p'. |
|
18809 elem := parentList item:3. |
|
18810 attrsMap := elem attributes. |
|
18811 parent := attrsMap getNamedItem:'dir'. |
|
18812 child := parent firstChild. |
|
18813 removed := parent removeChild:child. |
|
18814 removedName := removed nodeValue. |
|
18815 self assert: ( removedName = 'rtl' ). |
|
18816 "assertDOMException..." |
|
18817 self should:[ |
|
18818 removedNode := child removeChild:parent. |
|
18819 ] raise: DOMException. |
|
18820 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
18821 "end of assertDOMException..." |
|
18822 |
|
18823 ! |
|
18824 |
|
18825 test_noderemovechild31 |
|
18826 " |
|
18827 Using removeChild on a default Attribute node attempt to remove its EntityReference child node and |
|
18828 and verify the name of the returned node that was removed. Now attempt the reverse |
|
18829 and verify if a NO_MODIFICATION_ALLOWED_ERR or NOT_FOUND_ERR is thrown. |
|
18830 Then remove an child of the entity reference and expect a NO_MODIFICATION_ALLOWED_ERR. |
|
18831 |
|
18832 Creator: IBM |
|
18833 Autor Neil Delima |
|
18834 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-1734834066 |
|
18835 " |
|
18836 | |
|
18837 doc "Document" |
|
18838 parentList "NodeList" |
|
18839 attrsMap "NamedNodeMap" |
|
18840 parent "Attr" |
|
18841 child "EntityReference" |
|
18842 entRef "EntityReference" |
|
18843 elem "Element" |
|
18844 removed "EntityReference" |
|
18845 removedNode "Node" |
|
18846 removedName "String" |
|
18847 appendedChild "Node" |
|
18848 entRefChild "Node" |
|
18849 | |
|
18850 "implementationAttribute not supported: expandEntityReferences" |
|
18851 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18852 parentList := doc getElementsByTagName: 'acronym'. |
|
18853 elem := parentList item:3. |
|
18854 attrsMap := elem attributes. |
|
18855 parent := attrsMap getNamedItem:'class'. |
|
18856 entRef := doc createEntityReference:'delta'. |
|
18857 appendedChild := parent appendChild:entRef. |
|
18858 child := parent lastChild. |
|
18859 removed := parent removeChild:child. |
|
18860 removedName := removed nodeName. |
|
18861 self assert: ( removedName = 'delta' ). |
|
18862 "try" |
|
18863 [ |
|
18864 removedNode := child removeChild:parent. |
|
18865 self assert:false. ] on: DOMException do: [:ex| ]. |
|
18866 "end of try" |
|
18867 entRefChild := child firstChild. |
|
18868 "if" |
|
18869 ( entRefChild notNil ) ifTrue: [ |
|
18870 self assert:false description:'Method "NO_MODIFICATION_ALLOWED_ERR" is not supported yet'. |
|
18871 ]. |
|
18872 |
|
18873 ! |
|
18874 |
|
18875 test_nodereplacechild01 |
|
18876 " |
|
18877 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
18878 children, and returns the oldChild node. |
|
18879 |
|
18880 |
|
18881 Using replaceChild on this Document node attempt to replace this Document node with itself |
|
18882 and verify if a HIERARCHY_REQUEST_ERR error or a NOT_FOUND_ERR (since oldChild |
|
18883 is not a child of this node) is thrown. |
|
18884 |
|
18885 Creator: IBM |
|
18886 Autor Neil Delima |
|
18887 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
18888 " |
|
18889 | |
|
18890 doc "Document" |
|
18891 replaced "Node" |
|
18892 | |
|
18893 "implementationAttribute not supported: namespaceAware" |
|
18894 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18895 "try" |
|
18896 [ |
|
18897 doc replaceChild:doc with: doc. |
|
18898 ] on: DOMException do: [:ex| ]. |
|
18899 "end of try" |
|
18900 |
|
18901 ! |
|
18902 |
|
18903 test_nodereplacechild02 |
|
18904 " |
|
18905 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
18906 children, and returns the oldChild node. |
|
18907 |
|
18908 Using replaceChild on this Document node attempt to replace this DocumentType node with |
|
18909 its DocumentType (replacing node with itself -- implementation dependent) |
|
18910 |
|
18911 Creator: IBM |
|
18912 Autor Neil Delima |
|
18913 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
18914 " |
|
18915 | |
|
18916 doc "Document" |
|
18917 docType "DocumentType" |
|
18918 replaced "Node" |
|
18919 | |
|
18920 "implementationAttribute not supported: namespaceAware" |
|
18921 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18922 docType := doc doctype. |
|
18923 doc replaceChild:docType with: docType. |
|
18924 |
|
18925 ! |
|
18926 |
|
18927 test_nodereplacechild03 |
|
18928 " |
|
18929 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
18930 children, and returns the oldChild node. |
|
18931 |
|
18932 Using replaceChild on this Document node attempt to replace this Document node with |
|
18933 a new DocumentNode and verify if a HIERARCHY_REQUEST_ERR, WRONG_DOCUMENT_ERR |
|
18934 or NOT_FOUND_ERR is thrown. |
|
18935 |
|
18936 Creator: IBM |
|
18937 Autor Neil Delima |
|
18938 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
18939 " |
|
18940 | |
|
18941 doc "Document" |
|
18942 newDoc "Document" |
|
18943 domImpl "DOMImplementation" |
|
18944 nullDocType "DocumentType" |
|
18945 replaced "Node" |
|
18946 | |
|
18947 "implementationAttribute not supported: namespaceAware" |
|
18948 nullDocType := nil. |
|
18949 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18950 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
18951 newDoc := domImpl createDocumentNS: 'http://www.w3.org/DOM' qualifiedName: 'dom3:doc' doctype: nullDocType. |
|
18952 "try" |
|
18953 [ |
|
18954 doc replaceChild:doc with: newDoc. |
|
18955 ] on: DOMException do: [:ex| ]. |
|
18956 "end of try" |
|
18957 |
|
18958 ! |
|
18959 |
|
18960 test_nodereplacechild04 |
|
18961 " |
|
18962 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
18963 children, and returns the oldChild node. |
|
18964 |
|
18965 Using replaceChild on this Document node attempt to replace this DocumentElement node with |
|
18966 this Document Node and verify if a HIERARCHY_REQUEST_ERR or a NOT_FOUND_ERR error is thrown. |
|
18967 |
|
18968 Creator: IBM |
|
18969 Autor Neil Delima |
|
18970 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
18971 " |
|
18972 | |
|
18973 doc "Document" |
|
18974 docElem "Element" |
|
18975 replaced "Node" |
|
18976 | |
|
18977 "implementationAttribute not supported: namespaceAware" |
|
18978 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
18979 docElem := doc documentElement. |
|
18980 "try" |
|
18981 [ |
|
18982 doc replaceChild:docElem with: doc. |
|
18983 ] on: DOMException do: [:ex| ]. |
|
18984 "end of try" |
|
18985 |
|
18986 ! |
|
18987 |
|
18988 test_nodereplacechild06 |
|
18989 " |
|
18990 Using replaceChild on this Document node attempt to replace this DocumentElement node |
|
18991 with one of its child elements and verify if the name of the replaced documentElement Node. |
|
18992 |
|
18993 Creator: IBM |
|
18994 Autor Neil Delima |
|
18995 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
18996 " |
|
18997 | |
|
18998 doc "Document" |
|
18999 docElem "Element" |
|
19000 replaced "Element" |
|
19001 elem "Element" |
|
19002 childList "NodeList" |
|
19003 nodeName "String" |
|
19004 replacedNode "Node" |
|
19005 | |
|
19006 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19007 docElem := doc documentElement. |
|
19008 childList := doc getElementsByTagName: 'p'. |
|
19009 elem := childList item:0. |
|
19010 "try" |
|
19011 [ |
|
19012 doc replaceChild:docElem with: elem. |
|
19013 ] on: DOMException do: [:ex| ]. |
|
19014 "end of try" |
|
19015 replaced := doc documentElement. |
|
19016 nodeName := replaced nodeName. |
|
19017 self assert: ( nodeName = 'p' ). |
|
19018 |
|
19019 ! |
|
19020 |
|
19021 test_nodereplacechild07 |
|
19022 " |
|
19023 Using replaceChild on this Document node attempt to replace this DocumentElement node |
|
19024 with a new element and verify if the name of the replaced documentElement Node. |
|
19025 |
|
19026 Creator: IBM |
|
19027 Autor Neil Delima |
|
19028 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19029 " |
|
19030 | |
|
19031 doc "Document" |
|
19032 docElem "Element" |
|
19033 replaced "Element" |
|
19034 elem "Element" |
|
19035 nodeName "String" |
|
19036 replacedNode "Node" |
|
19037 rootNS "String" |
|
19038 rootName "String" |
|
19039 | |
|
19040 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19041 docElem := doc documentElement. |
|
19042 rootName := docElem tagName. |
|
19043 rootNS := docElem namespaceURI. |
|
19044 elem := doc createElement:rootName ns:rootNS. |
|
19045 "try" |
|
19046 [ |
|
19047 doc replaceChild:docElem with: elem. |
|
19048 ] on: DOMException do: [:ex| ]. |
|
19049 "end of try" |
|
19050 replaced := doc documentElement. |
|
19051 nodeName := replaced nodeName. |
|
19052 self assert: ( nodeName = rootName ). |
|
19053 |
|
19054 ! |
|
19055 |
|
19056 test_nodereplacechild08 |
|
19057 " |
|
19058 Using replaceChild on this Document node attempt to replace this DocumentElement node |
|
19059 with a new element that was created in another document and verify if a |
|
19060 WRONG_DOCUMENT_ERR is thrown. |
|
19061 |
|
19062 Creator: IBM |
|
19063 Autor Neil Delima |
|
19064 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19065 " |
|
19066 | |
|
19067 doc "Document" |
|
19068 doc2 "Document" |
|
19069 docElem "Element" |
|
19070 elem "Element" |
|
19071 nodeName "String" |
|
19072 replaced "Node" |
|
19073 rootNS "String" |
|
19074 rootName "String" |
|
19075 domImpl "DOMImplementation" |
|
19076 nullDocType "DocumentType" |
|
19077 | |
|
19078 nullDocType := nil. |
|
19079 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
19080 docElem := doc documentElement. |
|
19081 rootName := docElem tagName. |
|
19082 rootNS := docElem namespaceURI. |
|
19083 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
19084 doc2 := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: nullDocType. |
|
19085 elem := doc2 createElement:rootName ns:rootNS. |
|
19086 "try" |
|
19087 [ |
|
19088 doc replaceChild:docElem with: elem. |
|
19089 self assert:false. ] on: DOMException do: [:ex| ]. |
|
19090 "end of try" |
|
19091 |
|
19092 ! |
|
19093 |
|
19094 test_nodereplacechild10 |
|
19095 " |
|
19096 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
19097 children, and returns the oldChild node. |
|
19098 |
|
19099 Using replaceChild on this Document node attempt to replace an Entity node with |
|
19100 a notation node of retieved from the DTD of another document and verify if a |
|
19101 NOT_FOUND_ERR or WRONG_DOCUMENT_ERR or HIERARCHY_REQUEST err is thrown. |
|
19102 |
|
19103 Creator: IBM |
|
19104 Autor Neil Delima |
|
19105 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19106 " |
|
19107 | |
|
19108 doc "Document" |
|
19109 docType "DocumentType" |
|
19110 entitiesMap "NamedNodeMap" |
|
19111 ent "Entity" |
|
19112 doc1 "Document" |
|
19113 docType1 "DocumentType" |
|
19114 notationsMap "NamedNodeMap" |
|
19115 notation "Notation" |
|
19116 replaced "Node" |
|
19117 | |
|
19118 "implementationAttribute not supported: namespaceAware" |
|
19119 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19120 docType := doc doctype. |
|
19121 entitiesMap := docType entities. |
|
19122 ent := entitiesMap getNamedItem:'alpha'. |
|
19123 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19124 docType1 := doc1 doctype. |
|
19125 notationsMap := docType1 notations. |
|
19126 notation := notationsMap getNamedItem:'notation1'. |
|
19127 "try" |
|
19128 [ |
|
19129 doc replaceChild:ent with: notation. |
|
19130 ] on: DOMException do: [:ex| ]. |
|
19131 "end of try" |
|
19132 |
|
19133 ! |
|
19134 |
|
19135 test_nodereplacechild12 |
|
19136 " |
|
19137 Using replaceChild on this Document node, attempt to replace a new ProcessingInstruction |
|
19138 node with new Comment node. |
|
19139 |
|
19140 Creator: IBM |
|
19141 Autor Neil Delima |
|
19142 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19143 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=416 |
|
19144 " |
|
19145 | |
|
19146 doc "Document" |
|
19147 pi "ProcessingInstruction" |
|
19148 replaced "Node" |
|
19149 comment "Comment" |
|
19150 lastChild "Node" |
|
19151 nodeName "String" |
|
19152 replacedNode "Node" |
|
19153 appendedChild "Node" |
|
19154 | |
|
19155 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
19156 comment := doc createComment:'dom3:doc'. |
|
19157 pi := doc createProcessingInstruction:'PITarget' data:'PIData'. |
|
19158 appendedChild := doc appendChild:comment. |
|
19159 appendedChild := doc appendChild:pi. |
|
19160 doc replaceChild:pi with: comment. |
|
19161 self assert: replacedNode notNil. |
|
19162 nodeName := replacedNode nodeName. |
|
19163 self assert: ( nodeName = 'PITarget' ). |
|
19164 lastChild := doc lastChild. |
|
19165 self assert: lastChild notNil. |
|
19166 nodeName := lastChild nodeName. |
|
19167 self assert: ( nodeName = '#comment' ). |
|
19168 |
|
19169 ! |
|
19170 |
|
19171 test_nodereplacechild13 |
|
19172 " |
|
19173 Using replaceChild on this Document node attempt to replace this DocumentType node with |
|
19174 a new DocumentType and verify the name of the replaced DocumentType node. |
|
19175 |
|
19176 Creator: IBM |
|
19177 Autor Neil Delima |
|
19178 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19179 " |
|
19180 | |
|
19181 doc "Document" |
|
19182 docType "DocumentType" |
|
19183 newDocType "DocumentType" |
|
19184 replaced "DocumentType" |
|
19185 domImpl "DOMImplementation" |
|
19186 nodeName "String" |
|
19187 nullPubId "String" |
|
19188 nullSysId "String" |
|
19189 docElem "Element" |
|
19190 docElemName "String" |
|
19191 docElemNS "String" |
|
19192 | |
|
19193 nullPubId := nil. |
|
19194 nullSysId := nil. |
|
19195 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19196 docElem := doc documentElement. |
|
19197 docElemName := docElem tagName. |
|
19198 docElemNS := docElem namespaceURI. |
|
19199 docType := doc doctype. |
|
19200 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
19201 newDocType := domImpl createDocumentType:docElemName publicId:nullPubId systemId:nullSysId. |
|
19202 "try" |
|
19203 [ |
|
19204 doc replaceChild:docType with: newDocType. |
|
19205 ] on: DOMException do: [:ex| ]. |
|
19206 "end of try" |
|
19207 nodeName := replaced nodeName. |
|
19208 self assert: ( nodeName = docElemName ). |
|
19209 |
|
19210 ! |
|
19211 |
|
19212 test_nodereplacechild14 |
|
19213 " |
|
19214 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
19215 children, and returns the oldChild node. |
|
19216 |
|
19217 Using replaceChild on the documentElement of a newly created Document node, attempt to replace an |
|
19218 element child of this documentElement node with a child that was imported from another document. |
|
19219 Verify the nodeName of the replaced element node. |
|
19220 |
|
19221 Creator: IBM |
|
19222 Autor Neil Delima |
|
19223 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19224 " |
|
19225 | |
|
19226 doc "Document" |
|
19227 newDoc "Document" |
|
19228 docElem "Element" |
|
19229 elem "Element" |
|
19230 elem2 "Element" |
|
19231 imported "Node" |
|
19232 replaced "Element" |
|
19233 domImpl "DOMImplementation" |
|
19234 nodeName "String" |
|
19235 appendedChild "Node" |
|
19236 nullDocType "DocumentType" |
|
19237 | |
|
19238 "implementationAttribute not supported: namespaceAware" |
|
19239 nullDocType := nil. |
|
19240 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19241 elem := doc createElement:'dom3:doc1elem' ns:'http://www.w3.org/DOM/Test'. |
|
19242 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
19243 newDoc := domImpl createDocumentNS: 'http://www.w3.org/DOM/test' qualifiedName: 'dom3:doc' doctype: nullDocType. |
|
19244 elem2 := newDoc createElement:'dom3:doc2elem' ns:'http://www.w3.org/DOM/Test'. |
|
19245 imported := newDoc importNode:elem deep:true. |
|
19246 docElem := newDoc documentElement. |
|
19247 appendedChild := docElem appendChild:imported. |
|
19248 appendedChild := docElem appendChild:elem2. |
|
19249 docElem replaceChild:elem2 with: imported. |
|
19250 nodeName := replaced nodeName. |
|
19251 self assert: ( nodeName = 'dom3:doc2elem' ). |
|
19252 |
|
19253 ! |
|
19254 |
|
19255 test_nodereplacechild15 |
|
19256 " |
|
19257 Using replaceChild on a DocumentFragment node attempt to replace an Element node with |
|
19258 another Element and the replaced element. |
|
19259 |
|
19260 Creator: IBM |
|
19261 Autor Neil Delima |
|
19262 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19263 " |
|
19264 | |
|
19265 doc "Document" |
|
19266 docFrag "DocumentFragment" |
|
19267 elem "Element" |
|
19268 elem2 "Element" |
|
19269 replaced "Element" |
|
19270 domImpl "DOMImplementation" |
|
19271 title "String" |
|
19272 appendedChild "Node" |
|
19273 docElem "Element" |
|
19274 rootName "String" |
|
19275 rootNS "String" |
|
19276 | |
|
19277 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19278 docElem := doc documentElement. |
|
19279 rootName := docElem tagName. |
|
19280 rootNS := docElem namespaceURI. |
|
19281 elem := doc createElement:rootName ns:rootNS. |
|
19282 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
19283 docFrag := doc createDocumentFragment. |
|
19284 elem2 := doc createElement:rootName ns:rootNS. |
|
19285 elem2 setAttribute:'title' value:'new element'. |
|
19286 appendedChild := docFrag appendChild:elem2. |
|
19287 docFrag replaceChild:elem2 with: elem. |
|
19288 title := replaced getAttribute:'title'. |
|
19289 self assert: ( title = 'new element' ). |
|
19290 |
|
19291 ! |
|
19292 |
|
19293 test_nodereplacechild16 |
|
19294 " |
|
19295 Using replaceChild on a DocumentFragment node attempt to replace an Element node with |
|
19296 another Element and verify the name of the replaced Element node. |
|
19297 |
|
19298 Creator: IBM |
|
19299 Autor Neil Delima |
|
19300 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19301 " |
|
19302 | |
|
19303 doc "Document" |
|
19304 docFrag "DocumentFragment" |
|
19305 elem "Element" |
|
19306 txt "Text" |
|
19307 replaced "Element" |
|
19308 nodeName "String" |
|
19309 appendedChild "Node" |
|
19310 | |
|
19311 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19312 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
19313 docFrag := doc createDocumentFragment. |
|
19314 txt := doc createTextNode:'Comment'. |
|
19315 appendedChild := docFrag appendChild:txt. |
|
19316 appendedChild := docFrag appendChild:elem. |
|
19317 docFrag replaceChild:elem with: txt. |
|
19318 nodeName := replaced nodeName. |
|
19319 self assert: ( nodeName = 'dom3:p' ). |
|
19320 |
|
19321 ! |
|
19322 |
|
19323 test_nodereplacechild17 |
|
19324 " |
|
19325 |
|
19326 |
|
19327 |
|
19328 Using replaceChild on a DocumentFragment node attempt to replace a Comment node with |
|
19329 a ProcessingInstruction and vice versa verify the data of the replaced nodes. |
|
19330 |
|
19331 Creator: IBM |
|
19332 Autor Neil Delima |
|
19333 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19334 " |
|
19335 | |
|
19336 doc "Document" |
|
19337 docFrag "DocumentFragment" |
|
19338 pi "ProcessingInstruction" |
|
19339 cmt "Comment" |
|
19340 replacedCmt "Comment" |
|
19341 replacedPi "ProcessingInstruction" |
|
19342 data "String" |
|
19343 target "String" |
|
19344 appendedChild "Node" |
|
19345 | |
|
19346 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19347 docFrag := doc createDocumentFragment. |
|
19348 cmt := doc createComment:'Comment'. |
|
19349 pi := doc createProcessingInstruction:'target' data:'Comment'. |
|
19350 appendedChild := docFrag appendChild:pi. |
|
19351 appendedChild := docFrag appendChild:cmt. |
|
19352 docFrag replaceChild:cmt with: pi. |
|
19353 data := replacedCmt data. |
|
19354 self assert: ( data = 'Comment' ). |
|
19355 docFrag replaceChild:pi with: cmt. |
|
19356 target := replacedPi target. |
|
19357 self assert: ( target = 'target' ). |
|
19358 |
|
19359 ! |
|
19360 |
|
19361 test_nodereplacechild18 |
|
19362 " |
|
19363 Using replaceChild on a DocumentFragment node attempt to replace a CDATASection node with |
|
19364 a EntityReference and vice versa verify the data of the replaced nodes. |
|
19365 |
|
19366 Creator: IBM |
|
19367 Autor Neil Delima |
|
19368 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19369 " |
|
19370 | |
|
19371 doc "Document" |
|
19372 docFrag "DocumentFragment" |
|
19373 entRef "EntityReference" |
|
19374 cdata "CDATASection" |
|
19375 replacedCData "CDATASection" |
|
19376 replacedEref "EntityReference" |
|
19377 cdataName "String" |
|
19378 erefName "String" |
|
19379 appendedChild "Node" |
|
19380 | |
|
19381 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19382 docFrag := doc createDocumentFragment. |
|
19383 cdata := doc createCDATASection:'CDATASection'. |
|
19384 entRef := doc createEntityReference:'alpha'. |
|
19385 appendedChild := docFrag appendChild:entRef. |
|
19386 appendedChild := docFrag appendChild:cdata. |
|
19387 docFrag replaceChild:cdata with: entRef. |
|
19388 cdataName := replacedCData nodeValue. |
|
19389 self assert: ( cdataName = 'CDATASection' ). |
|
19390 docFrag replaceChild:entRef with: cdata. |
|
19391 erefName := replacedEref nodeName. |
|
19392 self assert: ( erefName = 'alpha' ). |
|
19393 |
|
19394 ! |
|
19395 |
|
19396 test_nodereplacechild19 |
|
19397 " |
|
19398 Using replaceChild on a DocumentFragment node attempt to replace an Element node with |
|
19399 its EntityReference child verify the nodeName of the replaced node. |
|
19400 |
|
19401 Creator: IBM |
|
19402 Autor Neil Delima |
|
19403 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19404 " |
|
19405 | |
|
19406 doc "Document" |
|
19407 docFrag "DocumentFragment" |
|
19408 entRef "EntityReference" |
|
19409 elem "Element" |
|
19410 replaced "Element" |
|
19411 nodeName "String" |
|
19412 appendedChild "Node" |
|
19413 | |
|
19414 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19415 docFrag := doc createDocumentFragment. |
|
19416 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
19417 entRef := doc createEntityReference:'alpha'. |
|
19418 appendedChild := elem appendChild:entRef. |
|
19419 appendedChild := docFrag appendChild:elem. |
|
19420 docFrag replaceChild:elem with: entRef. |
|
19421 nodeName := replaced nodeName. |
|
19422 self assert: ( nodeName = 'dom3:p' ). |
|
19423 |
|
19424 ! |
|
19425 |
|
19426 test_nodereplacechild20 |
|
19427 " |
|
19428 Using replaceChild on a DocumentFragment node attempt to replace an Element node with |
|
19429 an Attr Node and verify if a HIERARCHY_REQUEST_ERR is thrown. |
|
19430 |
|
19431 Creator: IBM |
|
19432 Autor Neil Delima |
|
19433 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19434 " |
|
19435 | |
|
19436 doc "Document" |
|
19437 docFrag "DocumentFragment" |
|
19438 attr "Attr" |
|
19439 elem "Element" |
|
19440 replaced "Element" |
|
19441 nodeName "String" |
|
19442 appendedChild "Node" |
|
19443 | |
|
19444 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19445 docFrag := doc createDocumentFragment. |
|
19446 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
19447 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
19448 appendedChild := docFrag appendChild:elem. |
|
19449 "assertDOMException..." |
|
19450 self should:[ |
|
19451 docFrag replaceChild:elem with: attr. |
|
19452 ] raise: DOMException. |
|
19453 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
19454 "end of assertDOMException..." |
|
19455 |
|
19456 ! |
|
19457 |
|
19458 test_nodereplacechild21 |
|
19459 " |
|
19460 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
19461 children, and returns the oldChild node. |
|
19462 |
|
19463 Using replaceChild on this DocumentType node attempt to replace an Entity node with |
|
19464 a notation node of retieved from the DTD of another document and verify if a |
|
19465 NO_MODIFICATION_ALLOWED_ERR is thrown since DocumentType node is read-only. |
|
19466 Also try replacing the docType with an entity node and see if the same exception gets thrown. |
|
19467 |
|
19468 Creator: IBM |
|
19469 Autor Neil Delima |
|
19470 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19471 " |
|
19472 | |
|
19473 doc "Document" |
|
19474 docType "DocumentType" |
|
19475 entitiesMap "NamedNodeMap" |
|
19476 ent "Entity" |
|
19477 doc1 "Document" |
|
19478 docType1 "DocumentType" |
|
19479 notationsMap "NamedNodeMap" |
|
19480 notation "Notation" |
|
19481 replacedChild "Node" |
|
19482 | |
|
19483 "implementationAttribute not supported: namespaceAware" |
|
19484 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19485 docType := doc doctype. |
|
19486 entitiesMap := docType entities. |
|
19487 ent := entitiesMap getNamedItem:'alpha'. |
|
19488 doc1 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19489 docType1 := doc1 doctype. |
|
19490 notationsMap := docType1 notations. |
|
19491 notation := notationsMap getNamedItem:'notation1'. |
|
19492 "assertDOMException..." |
|
19493 self should:[ |
|
19494 docType replaceChild:ent with: notation. |
|
19495 ] raise: DOMException. |
|
19496 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19497 "end of assertDOMException..." |
|
19498 "assertDOMException..." |
|
19499 self should:[ |
|
19500 docType replaceChild:docType with: ent. |
|
19501 ] raise: DOMException. |
|
19502 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19503 "end of assertDOMException..." |
|
19504 |
|
19505 ! |
|
19506 |
|
19507 test_nodereplacechild22 |
|
19508 " |
|
19509 Using replaceChild on a new EntityReference node attempt to replace an EntityReference node with |
|
19510 its Element parent, with itself and vice versa verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
19511 |
|
19512 Creator: IBM |
|
19513 Autor Neil Delima |
|
19514 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19515 " |
|
19516 | |
|
19517 doc "Document" |
|
19518 entRefMain "EntityReference" |
|
19519 entRef "EntityReference" |
|
19520 elem "Element" |
|
19521 appendedChild "Node" |
|
19522 replacedChild "Node" |
|
19523 | |
|
19524 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19525 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
19526 entRefMain := doc createEntityReference:'delta'. |
|
19527 entRef := doc createEntityReference:'beta'. |
|
19528 appendedChild := elem appendChild:entRef. |
|
19529 "assertDOMException..." |
|
19530 self should:[ |
|
19531 entRefMain replaceChild:entRef with: elem. |
|
19532 ] raise: DOMException. |
|
19533 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19534 "end of assertDOMException..." |
|
19535 "assertDOMException..." |
|
19536 self should:[ |
|
19537 entRefMain replaceChild:elem with: entRef. |
|
19538 ] raise: DOMException. |
|
19539 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19540 "end of assertDOMException..." |
|
19541 "assertDOMException..." |
|
19542 self should:[ |
|
19543 entRefMain replaceChild:entRef with: entRefMain. |
|
19544 ] raise: DOMException. |
|
19545 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19546 "end of assertDOMException..." |
|
19547 |
|
19548 ! |
|
19549 |
|
19550 test_nodereplacechild23 |
|
19551 " |
|
19552 Using replaceChild on a new EntityReference node attempt to replace an Element, Text, |
|
19553 Comment, ProcessingInstruction and CDATASection nodes with each other and in each case |
|
19554 verify if a NO_MODIFICATION_ALLOWED_ERR is thrown. |
|
19555 |
|
19556 Creator: IBM |
|
19557 Autor Neil Delima |
|
19558 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19559 " |
|
19560 | |
|
19561 doc "Document" |
|
19562 entRef "EntityReference" |
|
19563 txt "Text" |
|
19564 elem "Element" |
|
19565 comment "Comment" |
|
19566 pi "ProcessingInstruction" |
|
19567 cdata "CDATASection" |
|
19568 replaced "Node" |
|
19569 appendedChild "Node" |
|
19570 | |
|
19571 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19572 elem := doc createElement:'dom3:p' ns:'http://www.w3.org/1999/xhtml'. |
|
19573 entRef := doc createEntityReference:'delta'. |
|
19574 txt := doc createTextNode:'Text'. |
|
19575 comment := doc createComment:'Comment'. |
|
19576 cdata := doc createCDATASection:'CDATASection'. |
|
19577 pi := doc createProcessingInstruction:'target' data:'data'. |
|
19578 appendedChild := elem appendChild:entRef. |
|
19579 appendedChild := elem appendChild:txt. |
|
19580 appendedChild := elem appendChild:comment. |
|
19581 appendedChild := elem appendChild:pi. |
|
19582 appendedChild := elem appendChild:cdata. |
|
19583 "assertDOMException..." |
|
19584 self should:[ |
|
19585 entRef replaceChild:elem with: cdata. |
|
19586 ] raise: DOMException. |
|
19587 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19588 "end of assertDOMException..." |
|
19589 "assertDOMException..." |
|
19590 self should:[ |
|
19591 entRef replaceChild:cdata with: pi. |
|
19592 ] raise: DOMException. |
|
19593 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19594 "end of assertDOMException..." |
|
19595 "assertDOMException..." |
|
19596 self should:[ |
|
19597 entRef replaceChild:pi with: comment. |
|
19598 ] raise: DOMException. |
|
19599 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19600 "end of assertDOMException..." |
|
19601 "assertDOMException..." |
|
19602 self should:[ |
|
19603 entRef replaceChild:comment with: txt. |
|
19604 ] raise: DOMException. |
|
19605 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19606 "end of assertDOMException..." |
|
19607 "assertDOMException..." |
|
19608 self should:[ |
|
19609 entRef replaceChild:txt with: elem. |
|
19610 ] raise: DOMException. |
|
19611 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19612 "end of assertDOMException..." |
|
19613 |
|
19614 ! |
|
19615 |
|
19616 test_nodereplacechild24 |
|
19617 " |
|
19618 Using replaceChild on an EntityReference node attempt to replace an Element node with |
|
19619 an EntityReference node verify if a NO_MODIFICATION_ALLOWED_ERR gets thrown. |
|
19620 |
|
19621 Creator: IBM |
|
19622 Autor Neil Delima |
|
19623 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19624 " |
|
19625 | |
|
19626 doc "Document" |
|
19627 childList "NodeList" |
|
19628 entRef "EntityReference" |
|
19629 elem "Element" |
|
19630 replaced "Element" |
|
19631 nodeName "String" |
|
19632 | |
|
19633 "implementationAttribute not supported: expandEntityReferences" |
|
19634 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19635 childList := doc getElementsByTagName: 'acronym'. |
|
19636 elem := childList item:1. |
|
19637 entRef := elem firstChild. |
|
19638 "assertDOMException..." |
|
19639 self should:[ |
|
19640 entRef replaceChild:elem with: entRef. |
|
19641 ] raise: DOMException. |
|
19642 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19643 "end of assertDOMException..." |
|
19644 |
|
19645 ! |
|
19646 |
|
19647 test_nodereplacechild25 |
|
19648 " |
|
19649 Using replaceChild on an Element node attempt to replace an |
|
19650 EntityReference or Text child node |
|
19651 with an Entity node and with itself and verify if a HIERARCHY_REQUEST_ERR gets thrown. |
|
19652 |
|
19653 Creator: IBM |
|
19654 Autor Neil Delima |
|
19655 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19656 " |
|
19657 | |
|
19658 doc "Document" |
|
19659 docType "DocumentType" |
|
19660 entities "NamedNodeMap" |
|
19661 entity "Entity" |
|
19662 childList "NodeList" |
|
19663 entRef "Node" |
|
19664 elem "Element" |
|
19665 replaced "Element" |
|
19666 nodeName "String" |
|
19667 | |
|
19668 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19669 docType := doc doctype. |
|
19670 entities := docType entities. |
|
19671 entity := entities getNamedItem:'alpha'. |
|
19672 childList := doc getElementsByTagName: 'acronym'. |
|
19673 elem := childList item:1. |
|
19674 entRef := elem firstChild. |
|
19675 "assertDOMException..." |
|
19676 self should:[ |
|
19677 elem replaceChild:entRef with: entity. |
|
19678 ] raise: DOMException. |
|
19679 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
19680 "end of assertDOMException..." |
|
19681 "assertDOMException..." |
|
19682 self should:[ |
|
19683 elem replaceChild:entRef with: elem. |
|
19684 ] raise: DOMException. |
|
19685 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
19686 "end of assertDOMException..." |
|
19687 |
|
19688 ! |
|
19689 |
|
19690 test_nodereplacechild26 |
|
19691 " |
|
19692 Using replaceChild on an Element node attempt to replace a Text child node with an Element |
|
19693 node that is an ancestor of this Element node and verify if a HIERARCHY_REQUEST_ERR gets thrown. |
|
19694 |
|
19695 Creator: IBM |
|
19696 Autor Neil Delima |
|
19697 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19698 " |
|
19699 | |
|
19700 doc "Document" |
|
19701 childList "NodeList" |
|
19702 docElem "Element" |
|
19703 elem "Element" |
|
19704 firstChild "Node" |
|
19705 nodeName "String" |
|
19706 replaced "Node" |
|
19707 | |
|
19708 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19709 docElem := doc documentElement. |
|
19710 childList := doc getElementsByTagName: 'p'. |
|
19711 elem := childList item:0. |
|
19712 firstChild := elem firstChild. |
|
19713 "assertDOMException..." |
|
19714 self should:[ |
|
19715 elem replaceChild:firstChild with: docElem. |
|
19716 ] raise: DOMException. |
|
19717 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
19718 "end of assertDOMException..." |
|
19719 |
|
19720 ! |
|
19721 |
|
19722 test_nodereplacechild27 |
|
19723 " |
|
19724 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
19725 children, and returns the oldChild node. |
|
19726 |
|
19727 Using replaceChild on an Element node attempt to replace an Element node with another |
|
19728 Element from another document and verify if a WRONG_DOCUMENT_ERR gets thrown. |
|
19729 |
|
19730 Creator: IBM |
|
19731 Autor Neil Delima |
|
19732 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19733 " |
|
19734 | |
|
19735 doc "Document" |
|
19736 doc2 "Document" |
|
19737 childList "NodeList" |
|
19738 childList2 "NodeList" |
|
19739 elem2 "Element" |
|
19740 elem "Element" |
|
19741 firstChild "Node" |
|
19742 nodeName "String" |
|
19743 replaced "Node" |
|
19744 | |
|
19745 "implementationAttribute not supported: namespaceAware" |
|
19746 "implementationAttribute not supported: expandEntityReferences" |
|
19747 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19748 childList := doc getElementsByTagName: 'p' ns: '*'. |
|
19749 elem := childList item:0. |
|
19750 firstChild := elem firstChild. |
|
19751 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19752 childList2 := doc2 getElementsByTagName: 'p' ns: '*'. |
|
19753 elem2 := childList2 item:0. |
|
19754 "assertDOMException..." |
|
19755 self should:[ |
|
19756 elem replaceChild:firstChild with: elem2. |
|
19757 ] raise: DOMException. |
|
19758 self assert: (lastException code == DOMException WRONG_DOCUMENT_ERR). |
|
19759 "end of assertDOMException..." |
|
19760 |
|
19761 ! |
|
19762 |
|
19763 test_nodereplacechild28 |
|
19764 " |
|
19765 Attempt to replace a text node with a text node from an |
|
19766 entity reference. Since the replacing text node should be removed |
|
19767 from its current location first, a NO_MODIFICATION_ALLOWED_ERR should |
|
19768 be thrown. |
|
19769 |
|
19770 Creator: IBM |
|
19771 Autor Neil Delima |
|
19772 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19773 " |
|
19774 | |
|
19775 doc "Document" |
|
19776 childList "NodeList" |
|
19777 acronym "Element" |
|
19778 betaRef "EntityReference" |
|
19779 dallas "Text" |
|
19780 betaText "Node" |
|
19781 appendedChild "Node" |
|
19782 replacedChild "Node" |
|
19783 | |
|
19784 "implementationAttribute not supported: expandEntityReferences" |
|
19785 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19786 childList := doc getElementsByTagName: 'acronym'. |
|
19787 acronym := childList item:1. |
|
19788 betaRef := acronym firstChild. |
|
19789 self assert: betaRef notNil. |
|
19790 betaText := betaRef firstChild. |
|
19791 self assert: betaText notNil. |
|
19792 dallas := betaRef nextSibling. |
|
19793 self assert: dallas notNil. |
|
19794 "assertDOMException..." |
|
19795 self should:[ |
|
19796 acronym replaceChild:dallas with: betaText. |
|
19797 ] raise: DOMException. |
|
19798 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19799 "end of assertDOMException..." |
|
19800 |
|
19801 ! |
|
19802 |
|
19803 test_nodereplacechild29 |
|
19804 " |
|
19805 Using replaceChild on an Element node attempt to replace a new Element node with |
|
19806 another new Element node and verify if a NOT_FOUND_ERR gets thrown. |
|
19807 |
|
19808 Creator: IBM |
|
19809 Autor Neil Delima |
|
19810 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19811 " |
|
19812 | |
|
19813 doc "Document" |
|
19814 childList "NodeList" |
|
19815 elem "Element" |
|
19816 oldChild "Element" |
|
19817 newChild "Element" |
|
19818 replaced "Node" |
|
19819 | |
|
19820 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19821 childList := doc getElementsByTagName: 'p'. |
|
19822 elem := childList item:0. |
|
19823 oldChild := doc createElement:'dom3:br' ns:'http://www.w3.org/1999/xhtml'. |
|
19824 newChild := doc createElement:'dom3:span' ns:'http://www.w3.org/1999/xhtml'. |
|
19825 "assertDOMException..." |
|
19826 self should:[ |
|
19827 elem replaceChild:oldChild with: newChild. |
|
19828 ] raise: DOMException. |
|
19829 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
19830 "end of assertDOMException..." |
|
19831 |
|
19832 ! |
|
19833 |
|
19834 test_nodereplacechild30 |
|
19835 " |
|
19836 |
|
19837 |
|
19838 |
|
19839 Using replaceChild on an Element node attempt to replace a new Element child node with |
|
19840 new child nodes and vice versa and in each case verify the name of the replaced node. |
|
19841 |
|
19842 Creator: IBM |
|
19843 Autor Neil Delima |
|
19844 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19845 " |
|
19846 | |
|
19847 doc "Document" |
|
19848 parent "Element" |
|
19849 oldChild "Element" |
|
19850 newElement "Element" |
|
19851 newText "Text" |
|
19852 newComment "Comment" |
|
19853 newPI "ProcessingInstruction" |
|
19854 newCdata "CDATASection" |
|
19855 newERef "EntityReference" |
|
19856 replaced "Node" |
|
19857 nodeName "String" |
|
19858 appendedChild "Node" |
|
19859 | |
|
19860 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19861 parent := doc createElement:'xhtml:html' ns:'http://www.w3.org/1999/xhtml'. |
|
19862 oldChild := doc createElement:'xhtml:head' ns:'http://www.w3.org/1999/xhtml'. |
|
19863 newElement := doc createElement:'xhtml:body' ns:'http://www.w3.org/1999/xhtml'. |
|
19864 appendedChild := parent appendChild:oldChild. |
|
19865 appendedChild := parent appendChild:newElement. |
|
19866 newText := doc createTextNode:'Text'. |
|
19867 appendedChild := parent appendChild:newText. |
|
19868 newComment := doc createComment:'Comment'. |
|
19869 appendedChild := parent appendChild:newComment. |
|
19870 newPI := doc createProcessingInstruction:'target' data:'data'. |
|
19871 appendedChild := parent appendChild:newPI. |
|
19872 newCdata := doc createCDATASection:'Cdata'. |
|
19873 appendedChild := parent appendChild:newCdata. |
|
19874 newERef := doc createEntityReference:'delta'. |
|
19875 appendedChild := parent appendChild:newERef. |
|
19876 parent replaceChild:oldChild with: newElement. |
|
19877 nodeName := replaced nodeName. |
|
19878 self assert: ( nodeName = 'xhtml:head' ). |
|
19879 parent replaceChild:newElement with: oldChild. |
|
19880 nodeName := replaced nodeName. |
|
19881 self assert: ( nodeName = 'xhtml:body' ). |
|
19882 parent replaceChild:oldChild with: newText. |
|
19883 nodeName := replaced nodeName. |
|
19884 self assert: ( nodeName = 'xhtml:head' ). |
|
19885 parent replaceChild:newText with: oldChild. |
|
19886 nodeName := replaced nodeName. |
|
19887 self assert: ( nodeName = '#text' ). |
|
19888 parent replaceChild:oldChild with: newComment. |
|
19889 nodeName := replaced nodeName. |
|
19890 self assert: ( nodeName = 'xhtml:head' ). |
|
19891 parent replaceChild:newComment with: oldChild. |
|
19892 nodeName := replaced nodeName. |
|
19893 self assert: ( nodeName = '#comment' ). |
|
19894 parent replaceChild:newPI with: oldChild. |
|
19895 nodeName := replaced nodeName. |
|
19896 self assert: ( nodeName = 'target' ). |
|
19897 parent replaceChild:newCdata with: oldChild. |
|
19898 nodeName := replaced nodeName. |
|
19899 self assert: ( nodeName = '#cdata-section' ). |
|
19900 parent replaceChild:newERef with: oldChild. |
|
19901 nodeName := replaced nodeName. |
|
19902 self assert: ( nodeName = 'delta' ). |
|
19903 |
|
19904 ! |
|
19905 |
|
19906 test_nodereplacechild31 |
|
19907 " |
|
19908 Using replaceChild on an Element node that is the replacement Text of an EntityReference |
|
19909 node, attempt to replace its Text child node with a new Element node and verify if |
|
19910 a NO_MODIFICATION_ALLOWED_ERR gets thrown. |
|
19911 |
|
19912 Creator: IBM |
|
19913 Autor Neil Delima |
|
19914 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19915 " |
|
19916 | |
|
19917 doc "Document" |
|
19918 childList "NodeList" |
|
19919 elem "Element" |
|
19920 span "Element" |
|
19921 ent4Ref "EntityReference" |
|
19922 spanText "Text" |
|
19923 newChild "Element" |
|
19924 replaced "Node" |
|
19925 | |
|
19926 "implementationAttribute not supported: expandEntityReferences" |
|
19927 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19928 childList := doc getElementsByTagName: 'var'. |
|
19929 elem := childList item:2. |
|
19930 ent4Ref := elem firstChild. |
|
19931 span := ent4Ref firstChild. |
|
19932 self assert: span notNil. |
|
19933 spanText := span firstChild. |
|
19934 self assert: spanText notNil. |
|
19935 newChild := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
19936 "assertDOMException..." |
|
19937 self should:[ |
|
19938 span replaceChild:spanText with: newChild. |
|
19939 ] raise: DOMException. |
|
19940 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
19941 "end of assertDOMException..." |
|
19942 |
|
19943 ! |
|
19944 |
|
19945 test_nodereplacechild32 |
|
19946 " |
|
19947 The method replaceChild replaces the child node oldChild with newChild in the list of |
|
19948 children, and returns the oldChild node. |
|
19949 |
|
19950 Using replaceChild on an Attr node to replace its EntityReference Child with a |
|
19951 new Text Node and verify the name of the replaced child. |
|
19952 |
|
19953 Creator: IBM |
|
19954 Autor Neil Delima |
|
19955 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19956 " |
|
19957 | |
|
19958 doc "Document" |
|
19959 childList "NodeList" |
|
19960 elem "Element" |
|
19961 parent "Attr" |
|
19962 oldChild "Node" |
|
19963 newChild "Text" |
|
19964 replaced "Node" |
|
19965 nodeName "String" |
|
19966 nodeType "SmallInteger" |
|
19967 enRef "EntityReference" |
|
19968 enRefChild "EntityReference" |
|
19969 reference "String" |
|
19970 | |
|
19971 "implementationAttribute not supported: namespaceAware" |
|
19972 "implementationAttribute not supported: expandEntityReferences" |
|
19973 reference := 'entity1'. |
|
19974 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
19975 newChild := doc createTextNode:'Text'. |
|
19976 childList := doc getElementsByTagName: 'acronym' ns: '*'. |
|
19977 elem := childList item:3. |
|
19978 parent := elem getAttributeNode:'class'. |
|
19979 enRef := doc createEntityReference:reference. |
|
19980 enRefChild := parent appendChild:enRef. |
|
19981 parent replaceChild:enRefChild with: newChild. |
|
19982 nodeName := replaced nodeName. |
|
19983 self assert: ( nodeName = 'entity1' ). |
|
19984 |
|
19985 ! |
|
19986 |
|
19987 test_nodereplacechild33 |
|
19988 " |
|
19989 Using replaceChild on a default Attr node to replace its Text Child with a |
|
19990 new EntityReference Node and verify the value of the replaced child. |
|
19991 |
|
19992 Creator: IBM |
|
19993 Autor Neil Delima |
|
19994 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
19995 " |
|
19996 | |
|
19997 doc "Document" |
|
19998 childList "NodeList" |
|
19999 elem "Element" |
|
20000 parent "Attr" |
|
20001 oldChild "Node" |
|
20002 newChild "EntityReference" |
|
20003 replaced "Node" |
|
20004 nodeValue "String" |
|
20005 | |
|
20006 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20007 newChild := doc createEntityReference:'delta'. |
|
20008 childList := doc getElementsByTagName: 'p'. |
|
20009 elem := childList item:3. |
|
20010 parent := elem getAttributeNode:'dir'. |
|
20011 oldChild := parent lastChild. |
|
20012 parent replaceChild:oldChild with: newChild. |
|
20013 nodeValue := replaced nodeValue. |
|
20014 self assert: ( nodeValue = 'rtl' ). |
|
20015 |
|
20016 ! |
|
20017 |
|
20018 test_nodereplacechild34 |
|
20019 " |
|
20020 Using replaceChild on a new Attr node, replace its new EntityReference Child with a |
|
20021 new Text Node and verify the value of the new child. |
|
20022 |
|
20023 Creator: IBM |
|
20024 Autor Neil Delima |
|
20025 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
20026 " |
|
20027 | |
|
20028 doc "Document" |
|
20029 parent "Attr" |
|
20030 oldChild "EntityReference" |
|
20031 newChild "Text" |
|
20032 nodeValue "String" |
|
20033 appendedChild "Node" |
|
20034 replaced "Node" |
|
20035 | |
|
20036 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20037 parent := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
20038 oldChild := doc createEntityReference:'delta'. |
|
20039 appendedChild := parent appendChild:oldChild. |
|
20040 newChild := doc createTextNode:'Text'. |
|
20041 parent replaceChild:oldChild with: newChild. |
|
20042 nodeValue := parent value. |
|
20043 self assert: ( nodeValue = 'Text' ). |
|
20044 |
|
20045 ! |
|
20046 |
|
20047 test_nodereplacechild35 |
|
20048 " |
|
20049 Using replaceChild on a new Attr node, replace its new EntityRefernece Child with a |
|
20050 new Attr Node and verify if a HIERARCHY_REQUEST_ERR is thrown. |
|
20051 |
|
20052 Creator: IBM |
|
20053 Autor Neil Delima |
|
20054 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
20055 " |
|
20056 | |
|
20057 doc "Document" |
|
20058 parent "Attr" |
|
20059 oldChild "EntityReference" |
|
20060 newChild "Attr" |
|
20061 nodeValue "String" |
|
20062 appendedChild "Node" |
|
20063 replaced "Node" |
|
20064 | |
|
20065 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20066 parent := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
20067 oldChild := doc createEntityReference:'delta'. |
|
20068 appendedChild := parent appendChild:oldChild. |
|
20069 newChild := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
20070 "assertDOMException..." |
|
20071 self should:[ |
|
20072 parent replaceChild:oldChild with: newChild. |
|
20073 ] raise: DOMException. |
|
20074 self assert: (lastException code == DOMException HIERARCHY_REQUEST_ERR). |
|
20075 "end of assertDOMException..." |
|
20076 |
|
20077 ! |
|
20078 |
|
20079 test_nodereplacechild36 |
|
20080 " |
|
20081 Using replaceChild on a new Attr node, replace its new EntityRefernece node with a |
|
20082 new Text Node and verify if a NOT_FOUND_ERR is thrown. |
|
20083 |
|
20084 Creator: IBM |
|
20085 Autor Neil Delima |
|
20086 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
20087 " |
|
20088 | |
|
20089 doc "Document" |
|
20090 parent "Attr" |
|
20091 oldChild "EntityReference" |
|
20092 newChild "Text" |
|
20093 nodeValue "String" |
|
20094 replaced "Node" |
|
20095 | |
|
20096 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20097 parent := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
20098 oldChild := doc createEntityReference:'delta'. |
|
20099 newChild := doc createTextNode:'Text'. |
|
20100 "assertDOMException..." |
|
20101 self should:[ |
|
20102 parent replaceChild:oldChild with: newChild. |
|
20103 ] raise: DOMException. |
|
20104 self assert: (lastException code == DOMException NOT_FOUND_ERR). |
|
20105 "end of assertDOMException..." |
|
20106 |
|
20107 ! |
|
20108 |
|
20109 test_nodereplacechild37 |
|
20110 " |
|
20111 Using replaceChild on a new Attr node, replace its new Text node with a |
|
20112 new EntityReference Node created by another document and verify if a |
|
20113 WRONG_DOCUMENT_ERR is raised. |
|
20114 |
|
20115 Creator: IBM |
|
20116 Autor Neil Delima |
|
20117 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
20118 " |
|
20119 | |
|
20120 doc "Document" |
|
20121 doc2 "Document" |
|
20122 parent "Attr" |
|
20123 oldChild "Text" |
|
20124 newChild "EntityReference" |
|
20125 nodeValue "String" |
|
20126 replaced "Node" |
|
20127 appendedChild "Node" |
|
20128 | |
|
20129 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20130 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20131 parent := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
20132 oldChild := doc createTextNode:'Text'. |
|
20133 newChild := doc2 createEntityReference:'delta'. |
|
20134 appendedChild := parent appendChild:oldChild. |
|
20135 "assertDOMException..." |
|
20136 self should:[ |
|
20137 parent replaceChild:oldChild with: newChild. |
|
20138 ] raise: DOMException. |
|
20139 self assert: (lastException code == DOMException WRONG_DOCUMENT_ERR). |
|
20140 "end of assertDOMException..." |
|
20141 |
|
20142 ! |
|
20143 |
|
20144 test_nodereplacechild38 |
|
20145 " |
|
20146 Using replaceChild on an Entity node attempt to replace its Text child with new Text, |
|
20147 Comment, ProcessingInstruction and CDATASection nodes and in each case verify if |
|
20148 a NO_MODIFICATION_ALLOWED_ERR is raised. |
|
20149 |
|
20150 Creator: IBM |
|
20151 Autor Neil Delima |
|
20152 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
20153 " |
|
20154 | |
|
20155 doc "Document" |
|
20156 docType "DocumentType" |
|
20157 entitiesMap "NamedNodeMap" |
|
20158 ent "Entity" |
|
20159 oldChild "Text" |
|
20160 entRef "EntityReference" |
|
20161 txt "Text" |
|
20162 elem "Element" |
|
20163 comment "Comment" |
|
20164 pi "ProcessingInstruction" |
|
20165 cdata "CDATASection" |
|
20166 replaced "Node" |
|
20167 | |
|
20168 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20169 docType := doc doctype. |
|
20170 entitiesMap := docType entities. |
|
20171 ent := entitiesMap getNamedItem:'alpha'. |
|
20172 self assert: ent notNil. |
|
20173 oldChild := ent firstChild. |
|
20174 self assert: oldChild notNil. |
|
20175 cdata := doc createCDATASection:'CDATASection'. |
|
20176 "assertDOMException..." |
|
20177 self should:[ |
|
20178 ent replaceChild:oldChild with: cdata. |
|
20179 ] raise: DOMException. |
|
20180 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20181 "end of assertDOMException..." |
|
20182 pi := doc createProcessingInstruction:'target' data:'data'. |
|
20183 "assertDOMException..." |
|
20184 self should:[ |
|
20185 ent replaceChild:oldChild with: pi. |
|
20186 ] raise: DOMException. |
|
20187 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20188 "end of assertDOMException..." |
|
20189 comment := doc createComment:'Comment'. |
|
20190 "assertDOMException..." |
|
20191 self should:[ |
|
20192 ent replaceChild:oldChild with: comment. |
|
20193 ] raise: DOMException. |
|
20194 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20195 "end of assertDOMException..." |
|
20196 txt := doc createTextNode:'Text'. |
|
20197 "assertDOMException..." |
|
20198 self should:[ |
|
20199 ent replaceChild:oldChild with: txt. |
|
20200 ] raise: DOMException. |
|
20201 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20202 "end of assertDOMException..." |
|
20203 elem := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
20204 "assertDOMException..." |
|
20205 self should:[ |
|
20206 ent replaceChild:oldChild with: elem. |
|
20207 ] raise: DOMException. |
|
20208 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20209 "end of assertDOMException..." |
|
20210 entRef := doc createEntityReference:'delta'. |
|
20211 "assertDOMException..." |
|
20212 self should:[ |
|
20213 ent replaceChild:oldChild with: entRef. |
|
20214 ] raise: DOMException. |
|
20215 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20216 "end of assertDOMException..." |
|
20217 |
|
20218 ! |
|
20219 |
|
20220 test_nodereplacechild39 |
|
20221 " |
|
20222 Attempt to add a second document element by a replacing a trailing comment. The attempt should result |
|
20223 in a HIERARCHY_REQUEST_ERR or NOT_SUPPORTED_ERR. |
|
20224 |
|
20225 Creator: Curt Arnold |
|
20226 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
20227 " |
|
20228 | |
|
20229 doc "Document" |
|
20230 docElem "Element" |
|
20231 rootName "String" |
|
20232 rootNS "String" |
|
20233 newComment "Comment" |
|
20234 newElement "Element" |
|
20235 retNode "Node" |
|
20236 | |
|
20237 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
20238 docElem := doc documentElement. |
|
20239 rootName := docElem tagName. |
|
20240 rootNS := docElem namespaceURI. |
|
20241 newElement := doc createElement:rootName ns:rootNS. |
|
20242 newComment := doc createComment:'second element goes here'. |
|
20243 retNode := doc appendChild:newComment. |
|
20244 "try" |
|
20245 [ |
|
20246 doc replaceChild:newComment with: newElement. |
|
20247 self assert:false. ] on: DOMException do: [:ex| ]. |
|
20248 "end of try" |
|
20249 |
|
20250 ! |
|
20251 |
|
20252 test_nodereplacechild40 |
|
20253 " |
|
20254 Attempt to add a second document element by a comment. The attempt should result |
|
20255 in a HIERARCHY_REQUEST_ERR or NOT_SUPPORTED_ERR. |
|
20256 |
|
20257 Creator: Curt Arnold |
|
20258 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-785887307 |
|
20259 " |
|
20260 | |
|
20261 doc "Document" |
|
20262 docElem "Element" |
|
20263 rootName "String" |
|
20264 publicId "String" |
|
20265 systemId "String" |
|
20266 newComment "Comment" |
|
20267 newDocType "DocumentType" |
|
20268 domImpl "DOMImplementation" |
|
20269 retNode "Node" |
|
20270 | |
|
20271 publicId := nil. |
|
20272 systemId := nil. |
|
20273 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
20274 docElem := doc documentElement. |
|
20275 rootName := docElem tagName. |
|
20276 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
20277 newDocType := domImpl createDocumentType:rootName publicId:publicId systemId:systemId. |
|
20278 newComment := doc createComment:'second element goes here'. |
|
20279 doc insert:newComment before: docElem. |
|
20280 "try" |
|
20281 [ |
|
20282 doc replaceChild:newComment with: newDocType. |
|
20283 self assert:false. ] on: DOMException do: [:ex| ]. |
|
20284 "end of try" |
|
20285 |
|
20286 ! |
|
20287 |
|
20288 test_nodesettextcontent01 |
|
20289 " |
|
20290 Attempt to set textContent for a Document node and check that the document appears |
|
20291 to be unaffected. |
|
20292 |
|
20293 Creator: IBM |
|
20294 Autor Neil Delima |
|
20295 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20296 " |
|
20297 | |
|
20298 doc "Document" |
|
20299 nodeName "String" |
|
20300 elemList "NodeList" |
|
20301 elem "Element" |
|
20302 | |
|
20303 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20304 doc textContent:'textContent'. |
|
20305 elemList := doc getElementsByTagName: 'acronym'. |
|
20306 elem := elemList item:3. |
|
20307 self assert: elem notNil. |
|
20308 nodeName := elem nodeName. |
|
20309 self assert: ( nodeName = 'acronym' ). |
|
20310 |
|
20311 ! |
|
20312 |
|
20313 test_nodesettextcontent02 |
|
20314 " |
|
20315 The method setTextContent has no effect when the node is defined to be null. |
|
20316 |
|
20317 Using setTextContent on a new Document node, attempt to set the textContent of this |
|
20318 new Document node to textContent. Check if it was not set by checking the nodeName |
|
20319 attribute of a new Element of this Document node. |
|
20320 |
|
20321 Creator: IBM |
|
20322 Autor Neil Delima |
|
20323 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20324 " |
|
20325 | |
|
20326 doc "Document" |
|
20327 domImpl "DOMImplementation" |
|
20328 newDoc "Document" |
|
20329 nodeName "String" |
|
20330 elemChild "Element" |
|
20331 newElem "Element" |
|
20332 elemList "NodeList" |
|
20333 nullDocType "DocumentType" |
|
20334 appendedChild "Node" |
|
20335 documentElem "Element" |
|
20336 | |
|
20337 "implementationAttribute not supported: namespaceAware" |
|
20338 nullDocType := nil. |
|
20339 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20340 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
20341 newDoc := domImpl createDocumentNS: 'http://www.w3.org/DOM/Test' qualifiedName: 'dom3:elem' doctype: nullDocType. |
|
20342 newElem := newDoc createElement:'dom3:childElem' ns:'http://www.w3.org/DOM/Test'. |
|
20343 documentElem := newDoc documentElement. |
|
20344 appendedChild := documentElem appendChild:newElem. |
|
20345 newDoc textContent:'textContent'. |
|
20346 elemList := newDoc getElementsByTagName: 'childElem' ns: '*'. |
|
20347 elemChild := elemList item:0. |
|
20348 nodeName := elemChild nodeName. |
|
20349 self assert: ( nodeName = 'dom3:childElem' ). |
|
20350 |
|
20351 ! |
|
20352 |
|
20353 test_nodesettextcontent03 |
|
20354 " |
|
20355 |
|
20356 |
|
20357 Using setTextContent on this DocumentType node, attempt to set the textContent of this |
|
20358 DocumentType node to textContent. Retreive the textContent and verify if it is null. |
|
20359 |
|
20360 Creator: IBM |
|
20361 Autor Neil Delima |
|
20362 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20363 " |
|
20364 | |
|
20365 doc "Document" |
|
20366 docType "DocumentType" |
|
20367 textContent "String" |
|
20368 | |
|
20369 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20370 docType := doc doctype. |
|
20371 docType textContent:'textContent'. |
|
20372 textContent := docType textContent. |
|
20373 self assert: textContent isNil. |
|
20374 |
|
20375 ! |
|
20376 |
|
20377 test_nodesettextcontent04 |
|
20378 " |
|
20379 |
|
20380 |
|
20381 Using setTextContent on this DocumentType node, attempt to set the textContent of a |
|
20382 Notation node to textContent. Retreive the textContent and verify if it is null. |
|
20383 |
|
20384 Creator: IBM |
|
20385 Autor Neil Delima |
|
20386 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20387 " |
|
20388 | |
|
20389 doc "Document" |
|
20390 docType "DocumentType" |
|
20391 notationsMap "NamedNodeMap" |
|
20392 notation1 "Notation" |
|
20393 textContent "String" |
|
20394 | |
|
20395 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20396 docType := doc doctype. |
|
20397 notationsMap := docType notations. |
|
20398 notation1 := notationsMap getNamedItem:'notation1'. |
|
20399 notation1 textContent:'textContent'. |
|
20400 textContent := notation1 textContent. |
|
20401 self assert: textContent isNil. |
|
20402 |
|
20403 ! |
|
20404 |
|
20405 test_nodesettextcontent05 |
|
20406 " |
|
20407 |
|
20408 |
|
20409 Using setTextContent on a default Attr node, attempt to set its value to NA. Retreive |
|
20410 the textContent and verify if it is was set to NA. |
|
20411 |
|
20412 Creator: IBM |
|
20413 Autor Neil Delima |
|
20414 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20415 " |
|
20416 | |
|
20417 doc "Document" |
|
20418 elemList "NodeList" |
|
20419 elem "Element" |
|
20420 attr "Attr" |
|
20421 textContent "String" |
|
20422 | |
|
20423 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20424 elemList := doc getElementsByTagName: 'p'. |
|
20425 elem := elemList item:3. |
|
20426 attr := elem getAttributeNode:'dir'. |
|
20427 attr textContent:'NA'. |
|
20428 textContent := attr textContent. |
|
20429 self assert: ( textContent = 'NA' ). |
|
20430 |
|
20431 ! |
|
20432 |
|
20433 test_nodesettextcontent06 |
|
20434 " |
|
20435 |
|
20436 |
|
20437 Using setTextContent on a new Attr node with a null value, attempt to set its value to NA. Retreive |
|
20438 the textContent and verify if it is was set to NA. |
|
20439 |
|
20440 Creator: IBM |
|
20441 Autor Neil Delima |
|
20442 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20443 " |
|
20444 | |
|
20445 doc "Document" |
|
20446 elemList "NodeList" |
|
20447 elem "Element" |
|
20448 attr "Attr" |
|
20449 attrNode "Attr" |
|
20450 textContent "String" |
|
20451 | |
|
20452 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20453 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
20454 attr := doc createAttribute:'xml:lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
20455 attrNode := elem setAttributeNodeNS: attr. |
|
20456 attr textContent:'NA'. |
|
20457 textContent := attr textContent. |
|
20458 self assert: ( textContent = 'NA' ). |
|
20459 |
|
20460 ! |
|
20461 |
|
20462 test_nodesettextcontent07 |
|
20463 " |
|
20464 |
|
20465 |
|
20466 Using setTextContent on an existing Text node, attempt to set its value to Text. |
|
20467 Retreive the textContent and verify if it is was set to Text. |
|
20468 |
|
20469 Creator: IBM |
|
20470 Autor Neil Delima |
|
20471 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20472 " |
|
20473 | |
|
20474 doc "Document" |
|
20475 elemList "NodeList" |
|
20476 elem "Element" |
|
20477 txt "Text" |
|
20478 textContent "String" |
|
20479 | |
|
20480 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20481 elemList := doc getElementsByTagName: 'em'. |
|
20482 elem := elemList item:0. |
|
20483 txt := elem firstChild. |
|
20484 txt textContent:'Text'. |
|
20485 textContent := txt textContent. |
|
20486 self assert: ( textContent = 'Text' ). |
|
20487 |
|
20488 ! |
|
20489 |
|
20490 test_nodesettextcontent08 |
|
20491 " |
|
20492 |
|
20493 |
|
20494 Using setTextContent on a new Processing Instruction node, attempt to set its data to PID. |
|
20495 Retreive the textContent and verify if it is was set to PID. |
|
20496 |
|
20497 Creator: IBM |
|
20498 Autor Neil Delima |
|
20499 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20500 " |
|
20501 | |
|
20502 doc "Document" |
|
20503 elemList "NodeList" |
|
20504 elem "Element" |
|
20505 pi "ProcessingInstruction" |
|
20506 textContent "String" |
|
20507 appendedChild "Node" |
|
20508 | |
|
20509 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20510 elem := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
20511 pi := doc createProcessingInstruction:'PIT' data:'PID'. |
|
20512 appendedChild := elem appendChild:pi. |
|
20513 pi textContent:'PID'. |
|
20514 textContent := pi textContent. |
|
20515 self assert: ( textContent = 'PID' ). |
|
20516 |
|
20517 ! |
|
20518 |
|
20519 test_nodesettextcontent10 |
|
20520 " |
|
20521 The method setTextContent has no effect when the node is defined to be null. |
|
20522 |
|
20523 Using setTextContent on a new Element node, attempt to set its content to ELEMENT. |
|
20524 Retreive the textContent and verify if it is was set to ELEMENT. |
|
20525 |
|
20526 Creator: IBM |
|
20527 Autor Neil Delima |
|
20528 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20529 " |
|
20530 | |
|
20531 doc "Document" |
|
20532 elem "Element" |
|
20533 txt "Text" |
|
20534 comment "Comment" |
|
20535 entRef "EntityReference" |
|
20536 cdata "CDATASection" |
|
20537 pi "ProcessingInstruction" |
|
20538 textContent "String" |
|
20539 appendedChild "Node" |
|
20540 | |
|
20541 "implementationAttribute not supported: namespaceAware" |
|
20542 ^self. "Validation not supported" |
|
20543 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20544 elem := doc createElement:'dom3:elem' ns:'http://www.w3.org/DOM/Test'. |
|
20545 txt := doc createTextNode:'Text '. |
|
20546 comment := doc createComment:'Comment '. |
|
20547 entRef := doc createEntityReference:'ent1'. |
|
20548 pi := doc createProcessingInstruction:'PIT' data:'PIData '. |
|
20549 cdata := doc createCDATASection:'CData'. |
|
20550 appendedChild := elem appendChild:txt. |
|
20551 appendedChild := elem appendChild:comment. |
|
20552 appendedChild := elem appendChild:entRef. |
|
20553 appendedChild := elem appendChild:pi. |
|
20554 appendedChild := elem appendChild:cdata. |
|
20555 elem textContent:'ELEMENT'. |
|
20556 textContent := elem textContent. |
|
20557 self assert: ( textContent = 'ELEMENT' ). |
|
20558 |
|
20559 ! |
|
20560 |
|
20561 test_nodesettextcontent11 |
|
20562 " |
|
20563 |
|
20564 |
|
20565 Using setTextContent on a new DocumentFragment node Element child, attempt to set its content to |
|
20566 DOCUMENTFRAGMENT. Retreive the textContent and verify if it is was set to DOCUMENTFRAGMENT |
|
20567 |
|
20568 Creator: IBM |
|
20569 Autor Neil Delima |
|
20570 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20571 " |
|
20572 | |
|
20573 doc "Document" |
|
20574 docFrag "DocumentFragment" |
|
20575 elem "Element" |
|
20576 elemChild "Element" |
|
20577 txt "Text" |
|
20578 comment "Comment" |
|
20579 entRef "EntityReference" |
|
20580 cdata "CDATASection" |
|
20581 pi "ProcessingInstruction" |
|
20582 textContent "String" |
|
20583 appendedChild "Node" |
|
20584 | |
|
20585 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20586 docFrag := doc createDocumentFragment. |
|
20587 elem := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
20588 txt := doc createTextNode:'Text '. |
|
20589 comment := doc createComment:'Comment '. |
|
20590 entRef := doc createEntityReference:'alpha'. |
|
20591 pi := doc createProcessingInstruction:'PIT' data:'PIData '. |
|
20592 cdata := doc createCDATASection:'CData'. |
|
20593 appendedChild := elem appendChild:txt. |
|
20594 appendedChild := elem appendChild:comment. |
|
20595 appendedChild := elem appendChild:entRef. |
|
20596 appendedChild := elem appendChild:pi. |
|
20597 appendedChild := elem appendChild:cdata. |
|
20598 appendedChild := docFrag appendChild:elem. |
|
20599 elem textContent:'DOCUMENTFRAGMENT'. |
|
20600 elemChild := docFrag lastChild. |
|
20601 textContent := elemChild textContent. |
|
20602 self assert: ( textContent = 'DOCUMENTFRAGMENT' ). |
|
20603 |
|
20604 ! |
|
20605 |
|
20606 test_nodesettextcontent12 |
|
20607 " |
|
20608 |
|
20609 |
|
20610 Using setTextContent on a new EntityReference node, attempt to set its value. |
|
20611 Since EntityReference nodes are ReadOnly, check if a NO_MODIFICATION_ALLOWED_ERR |
|
20612 is raised. |
|
20613 |
|
20614 Creator: IBM |
|
20615 Autor Neil Delima |
|
20616 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20617 " |
|
20618 | |
|
20619 doc "Document" |
|
20620 elem "Element" |
|
20621 entRef "EntityReference" |
|
20622 textContent "String" |
|
20623 appendedChild "Node" |
|
20624 | |
|
20625 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20626 elem := doc documentElement. |
|
20627 entRef := doc createEntityReference:'beta'. |
|
20628 appendedChild := elem appendChild:entRef. |
|
20629 "assertDOMException..." |
|
20630 self should:[ |
|
20631 entRef textContent:'NA'. |
|
20632 ] raise: DOMException. |
|
20633 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20634 "end of assertDOMException..." |
|
20635 |
|
20636 ! |
|
20637 |
|
20638 test_nodesettextcontent13 |
|
20639 " |
|
20640 |
|
20641 |
|
20642 Using setTextContent on an Entity node, attempt to set its replacement text. |
|
20643 Since Entity nodes are ReadOnly, check if a NO_MODIFICATION_ALLOWED_ERR |
|
20644 is raised. |
|
20645 |
|
20646 Creator: IBM |
|
20647 Autor Neil Delima |
|
20648 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-textContent |
|
20649 " |
|
20650 | |
|
20651 doc "Document" |
|
20652 docType "DocumentType" |
|
20653 entity "Entity" |
|
20654 entitymap "NamedNodeMap" |
|
20655 textContent "String" |
|
20656 | |
|
20657 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20658 docType := doc doctype. |
|
20659 entitymap := docType entities. |
|
20660 entity := entitymap getNamedItem:'delta'. |
|
20661 "assertDOMException..." |
|
20662 self should:[ |
|
20663 entity textContent:'NA'. |
|
20664 ] raise: DOMException. |
|
20665 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
20666 "end of assertDOMException..." |
|
20667 |
|
20668 ! |
|
20669 |
|
20670 test_nodesetuserdata01 |
|
20671 " |
|
20672 |
|
20673 |
|
20674 Using setUserData with null values for the UserData and the handler parameters, check |
|
20675 if returned the current userData object of this Document node is null. |
|
20676 |
|
20677 Creator: IBM |
|
20678 Autor Neil Delima |
|
20679 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20680 " |
|
20681 | |
|
20682 doc "Document" |
|
20683 userData "DOMUserData" |
|
20684 prevUserData "DOMUserData" |
|
20685 nullHandler "UserDataHandler" |
|
20686 nullData "DOMUserData" |
|
20687 | |
|
20688 nullHandler := nil. |
|
20689 nullData := nil. |
|
20690 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20691 prevUserData := doc setUserData:nullData handler: nullHandler forKey:'something'. |
|
20692 self assert: prevUserData isNil. |
|
20693 |
|
20694 ! |
|
20695 |
|
20696 test_nodesetuserdata02 |
|
20697 " |
|
20698 |
|
20699 |
|
20700 Using setUserData with values for the UserData as this Document and the handler as null |
|
20701 parameters, check if returned the current userData object of this Document node is null. |
|
20702 |
|
20703 Creator: IBM |
|
20704 Autor Neil Delima |
|
20705 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20706 " |
|
20707 | |
|
20708 doc "Document" |
|
20709 userData "DOMUserData" |
|
20710 prevUserData "DOMUserData" |
|
20711 test "DOMUserData" |
|
20712 str "String" |
|
20713 nullHandler "UserDataHandler" |
|
20714 | |
|
20715 test := nil. |
|
20716 str := 'Junk'. |
|
20717 nullHandler := nil. |
|
20718 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20719 prevUserData := doc setUserData:test handler: nullHandler forKey:'something'. |
|
20720 self assert: prevUserData isNil. |
|
20721 |
|
20722 ! |
|
20723 |
|
20724 test_nodesetuserdata03 |
|
20725 " |
|
20726 Invoke setUserData on this Document to set this Documents UserData to a new |
|
20727 Element node. Do the same with a new Text node and using isNodeEqual verify |
|
20728 the returned Element UserData object. |
|
20729 |
|
20730 Creator: IBM |
|
20731 Autor Neil Delima |
|
20732 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20733 " |
|
20734 | |
|
20735 doc "Document" |
|
20736 userData "DOMUserData" |
|
20737 retUserData "DOMUserData" |
|
20738 returnedUserData "DOMUserData" |
|
20739 success "Boolean" |
|
20740 elem "Element" |
|
20741 txt "Text" |
|
20742 nullHandler "UserDataHandler" |
|
20743 | |
|
20744 nullHandler := nil. |
|
20745 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20746 elem := doc createElement:'xhtml:p' ns:'http://www.w3.org/1999/xhtml'. |
|
20747 txt := doc createTextNode:'TEXT'. |
|
20748 returnedUserData := doc setUserData:elem handler: nullHandler forKey:'Key1'. |
|
20749 retUserData := doc setUserData:txt handler: nullHandler forKey:'Key1'. |
|
20750 success := retUserData isEqualNode:elem. |
|
20751 self assert: success. |
|
20752 |
|
20753 ! |
|
20754 |
|
20755 test_nodesetuserdata04 |
|
20756 " |
|
20757 |
|
20758 |
|
20759 Invoke setUserData on a new Element to set its UserData to a new Text node |
|
20760 twice using different Keys. Using getUserData with each Key and isNodeEqual |
|
20761 verify if the returned nodes are Equal. |
|
20762 |
|
20763 Creator: IBM |
|
20764 Autor Neil Delima |
|
20765 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20766 " |
|
20767 | |
|
20768 doc "Document" |
|
20769 userData "DOMUserData" |
|
20770 returned1 "DOMUserData" |
|
20771 returned2 "DOMUserData" |
|
20772 retUserData "DOMUserData" |
|
20773 success "Boolean" |
|
20774 elem "Element" |
|
20775 txt "Text" |
|
20776 nullHandler "UserDataHandler" |
|
20777 | |
|
20778 nullHandler := nil. |
|
20779 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20780 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
20781 txt := doc createTextNode:'TEXT'. |
|
20782 retUserData := elem setUserData:txt handler: nullHandler forKey:'Key1'. |
|
20783 retUserData := elem setUserData:txt handler: nullHandler forKey:'Key2'. |
|
20784 returned1 := elem getUserDataForKey:'Key1'. |
|
20785 returned2 := elem getUserDataForKey:'Key2'. |
|
20786 success := returned1 isEqualNode:returned2. |
|
20787 self assert: success. |
|
20788 |
|
20789 ! |
|
20790 |
|
20791 test_nodesetuserdata05 |
|
20792 " |
|
20793 |
|
20794 |
|
20795 Invoke setUserData on a new Attr to set its UserData to two Document nodes |
|
20796 obtained by parsing the same xml document. Using getUserData and isNodeEqual |
|
20797 verify if the returned nodes are Equal. |
|
20798 |
|
20799 Creator: IBM |
|
20800 Autor Neil Delima |
|
20801 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20802 " |
|
20803 | |
|
20804 doc "Document" |
|
20805 doc2 "Document" |
|
20806 userData "DOMUserData" |
|
20807 returned1 "DOMUserData" |
|
20808 returned2 "DOMUserData" |
|
20809 retUserData "DOMUserData" |
|
20810 success "Boolean" |
|
20811 attr "Attr" |
|
20812 nullHandler "UserDataHandler" |
|
20813 | |
|
20814 nullHandler := nil. |
|
20815 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20816 doc2 := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20817 attr := doc createAttribute:'lang' ns:'http://www.w3.org/XML/1998/namespace'. |
|
20818 retUserData := attr setUserData:doc handler: nullHandler forKey:'Key1'. |
|
20819 retUserData := attr setUserData:doc2 handler: nullHandler forKey:'Key2'. |
|
20820 returned1 := attr getUserDataForKey:'Key1'. |
|
20821 returned2 := attr getUserDataForKey:'Key2'. |
|
20822 success := returned1 isEqualNode:returned2. |
|
20823 self assert: success. |
|
20824 |
|
20825 ! |
|
20826 |
|
20827 test_nodesetuserdata06 |
|
20828 " |
|
20829 |
|
20830 |
|
20831 Invoke setUserData on a new Comment to set its UserData to an Entity node |
|
20832 twice using the same key. Verify if the UserData object that was by the |
|
20833 second setUserData is the same as original Entity. |
|
20834 |
|
20835 Creator: IBM |
|
20836 Autor Neil Delima |
|
20837 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20838 " |
|
20839 | |
|
20840 doc "Document" |
|
20841 docType "DocumentType" |
|
20842 entities "NamedNodeMap" |
|
20843 entity "Entity" |
|
20844 comment "Comment" |
|
20845 userData "DOMUserData" |
|
20846 returned "DOMUserData" |
|
20847 retUserData "DOMUserData" |
|
20848 success "Boolean" |
|
20849 nullHandler "UserDataHandler" |
|
20850 | |
|
20851 nullHandler := nil. |
|
20852 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20853 docType := doc doctype. |
|
20854 entities := docType entities. |
|
20855 entity := entities getNamedItem:'delta'. |
|
20856 comment := doc createComment:'COMMENT_NODE'. |
|
20857 retUserData := comment setUserData:entity handler: nullHandler forKey:'Key1'. |
|
20858 returned := comment setUserData:entity handler: nullHandler forKey:'Key1'. |
|
20859 success := returned isEqualNode:entity. |
|
20860 self assert: success. |
|
20861 |
|
20862 ! |
|
20863 |
|
20864 test_nodesetuserdata07 |
|
20865 " |
|
20866 |
|
20867 |
|
20868 Invoke setUserData on a Notation to set its UserData to a Comment node |
|
20869 twice using the same key. Verify if the UserData object that was returned |
|
20870 by second setUserData is the Comment node set in the first setUserData call. |
|
20871 |
|
20872 Creator: IBM |
|
20873 Autor Neil Delima |
|
20874 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20875 " |
|
20876 | |
|
20877 doc "Document" |
|
20878 docType "DocumentType" |
|
20879 notations "NamedNodeMap" |
|
20880 notation "Notation" |
|
20881 comment "Comment" |
|
20882 userData "DOMUserData" |
|
20883 returned "DOMUserData" |
|
20884 success "Boolean" |
|
20885 retUserData "DOMUserData" |
|
20886 nullHandler "UserDataHandler" |
|
20887 | |
|
20888 nullHandler := nil. |
|
20889 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20890 docType := doc doctype. |
|
20891 notations := docType notations. |
|
20892 notation := notations getNamedItem:'notation1'. |
|
20893 comment := doc createComment:'COMMENT_NODE'. |
|
20894 retUserData := notation setUserData:comment handler: nullHandler forKey:'Key1'. |
|
20895 returned := notation setUserData:comment handler: nullHandler forKey:'Key1'. |
|
20896 success := returned isEqualNode:comment. |
|
20897 self assert: success. |
|
20898 |
|
20899 ! |
|
20900 |
|
20901 test_nodesetuserdata08 |
|
20902 " |
|
20903 Invoke setUserData on a CDATASection and EntityReference node to set their |
|
20904 UserData to this Document and DocumentElement node. Verify if the UserData |
|
20905 object that was set for both nodes is different. |
|
20906 |
|
20907 Creator: IBM |
|
20908 Autor Neil Delima |
|
20909 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20910 " |
|
20911 | |
|
20912 doc "Document" |
|
20913 docElem "Element" |
|
20914 entRef "EntityReference" |
|
20915 cData "CDATASection" |
|
20916 elemList "NodeList" |
|
20917 elemName "Element" |
|
20918 userData "DOMUserData" |
|
20919 returned1 "DOMUserData" |
|
20920 returned2 "DOMUserData" |
|
20921 success "Boolean" |
|
20922 retUserData "DOMUserData" |
|
20923 nullHandler "UserDataHandler" |
|
20924 | |
|
20925 nullHandler := nil. |
|
20926 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20927 docElem := doc documentElement. |
|
20928 entRef := doc createEntityReference:'delta'. |
|
20929 cData := doc createCDATASection:'CDATASection'. |
|
20930 retUserData := entRef setUserData:doc handler: nullHandler forKey:'Key1'. |
|
20931 retUserData := cData setUserData:docElem handler: nullHandler forKey:'Key2'. |
|
20932 returned1 := entRef getUserDataForKey:'Key1'. |
|
20933 returned2 := cData getUserDataForKey:'Key2'. |
|
20934 success := returned1 isEqualNode:returned2. |
|
20935 self deny: success. |
|
20936 |
|
20937 ! |
|
20938 |
|
20939 test_nodesetuserdata09 |
|
20940 " |
|
20941 |
|
20942 |
|
20943 Invoke setUserData on this documentElement node to set its UserData to |
|
20944 this Document node. Invoke getUserData on this Document node with the same |
|
20945 key of the UserData that was just set on the documentElement node and verify |
|
20946 if the returned node is null. |
|
20947 |
|
20948 Creator: IBM |
|
20949 Autor Neil Delima |
|
20950 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20951 " |
|
20952 | |
|
20953 doc "Document" |
|
20954 docElem "Element" |
|
20955 returned "DOMUserData" |
|
20956 nullHandler "UserDataHandler" |
|
20957 retUserData "DOMUserData" |
|
20958 | |
|
20959 nullHandler := nil. |
|
20960 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20961 docElem := doc documentElement. |
|
20962 retUserData := docElem setUserData:doc handler: nullHandler forKey:'Key1'. |
|
20963 returned := doc getUserDataForKey:'Key1'. |
|
20964 self assert: returned isNil. |
|
20965 |
|
20966 ! |
|
20967 |
|
20968 test_nodesetuserdata10 |
|
20969 " |
|
20970 Invoke setUserData on a CDATASection and EntityReference node to set their |
|
20971 UserData to this Document and DocumentElement node. Verify if the UserData |
|
20972 object that was set for both nodes is different. |
|
20973 |
|
20974 Creator: IBM |
|
20975 Autor Neil Delima |
|
20976 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-setUserData |
|
20977 " |
|
20978 | |
|
20979 doc "Document" |
|
20980 docElem "Element" |
|
20981 entRef "Node" |
|
20982 cData "CDATASection" |
|
20983 varList "NodeList" |
|
20984 varElem "Element" |
|
20985 userData "DOMUserData" |
|
20986 returned1 "DOMUserData" |
|
20987 returned2 "DOMUserData" |
|
20988 success "Boolean" |
|
20989 retUserData "DOMUserData" |
|
20990 nullHandler "UserDataHandler" |
|
20991 | |
|
20992 nullHandler := nil. |
|
20993 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
20994 docElem := doc documentElement. |
|
20995 varList := doc getElementsByTagName: 'var'. |
|
20996 varElem := varList item:2. |
|
20997 entRef := varElem firstChild. |
|
20998 cData := doc createCDATASection:'CDATASection'. |
|
20999 retUserData := entRef setUserData:doc handler: nullHandler forKey:'Key1'. |
|
21000 retUserData := cData setUserData:docElem handler: nullHandler forKey:'Key2'. |
|
21001 returned1 := entRef getUserDataForKey:'Key1'. |
|
21002 returned2 := cData getUserDataForKey:'Key2'. |
|
21003 success := returned1 isEqualNode:returned2. |
|
21004 self deny: success. |
|
21005 |
|
21006 ! |
|
21007 |
|
21008 test_normalizecharacters01 |
|
21009 " |
|
21010 Normalize document with normalize-characters set to false, check that |
|
21011 characters are not normalized. |
|
21012 |
|
21013 Creator: Curt Arnold |
|
21014 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
21015 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21016 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21017 " |
|
21018 | |
|
21019 doc "Document" |
|
21020 docElem "Element" |
|
21021 domConfig "DOMConfiguration" |
|
21022 errorMonitor "DOMErrorMonitor" |
|
21023 pList "NodeList" |
|
21024 pElem "Element" |
|
21025 text "Text" |
|
21026 textValue "String" |
|
21027 retval "Node" |
|
21028 | |
|
21029 "implementationAttribute not supported: namespaceAware" |
|
21030 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21031 domConfig := doc domConfig. |
|
21032 domConfig setParameter: 'normalize-characters' value: false. |
|
21033 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
21034 pList := doc getElementsByTagName: 'p'. |
|
21035 pElem := pList item:0. |
|
21036 text := doc createTextNode:'suçon'. |
|
21037 retval := pElem appendChild:text. |
|
21038 doc normalizeDocument. |
|
21039 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
21040 pList := doc getElementsByTagName: 'p'. |
|
21041 pElem := pList item:0. |
|
21042 text := pElem firstChild. |
|
21043 textValue := text nodeValue. |
|
21044 self assert: ( textValue = 'barsuçon' ). |
|
21045 |
|
21046 ! |
|
21047 |
|
21048 test_normalizecharacters02 |
|
21049 " |
|
21050 Normalize document with normalize-characters set to true, check that |
|
21051 characters are normalized. |
|
21052 |
|
21053 Creator: Curt Arnold |
|
21054 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
21055 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21056 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21057 " |
|
21058 | |
|
21059 doc "Document" |
|
21060 docElem "Element" |
|
21061 domConfig "DOMConfiguration" |
|
21062 errorMonitor "DOMErrorMonitor" |
|
21063 pList "NodeList" |
|
21064 pElem "Element" |
|
21065 text "Text" |
|
21066 textValue "String" |
|
21067 retval "Node" |
|
21068 canSet "Boolean" |
|
21069 | |
|
21070 "implementationAttribute not supported: namespaceAware" |
|
21071 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21072 domConfig := doc domConfig. |
|
21073 canSet := domConfig canSetParameter: 'normalize-characters' value: true. |
|
21074 "if" |
|
21075 (canSet) ifTrue: [ |
|
21076 ]. |
|
21077 |
|
21078 ! |
|
21079 |
|
21080 test_normalizecharacters03 |
|
21081 " |
|
21082 Normalize an element with normalize-characters set to false, check that |
|
21083 characters are not normalized. |
|
21084 |
|
21085 Creator: Curt Arnold |
|
21086 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
21087 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21088 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21089 " |
|
21090 | |
|
21091 doc "Document" |
|
21092 docElem "Element" |
|
21093 domConfig "DOMConfiguration" |
|
21094 errorMonitor "DOMErrorMonitor" |
|
21095 pList "NodeList" |
|
21096 pElem "Element" |
|
21097 text "Text" |
|
21098 textValue "String" |
|
21099 retval "Node" |
|
21100 | |
|
21101 "implementationAttribute not supported: namespaceAware" |
|
21102 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21103 domConfig := doc domConfig. |
|
21104 domConfig setParameter: 'normalize-characters' value: false. |
|
21105 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
21106 pList := doc getElementsByTagName: 'p'. |
|
21107 pElem := pList item:0. |
|
21108 text := doc createTextNode:'suçon'. |
|
21109 retval := pElem appendChild:text. |
|
21110 pElem normalize. |
|
21111 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
21112 pList := doc getElementsByTagName: 'p'. |
|
21113 pElem := pList item:0. |
|
21114 text := pElem firstChild. |
|
21115 textValue := text nodeValue. |
|
21116 self assert: ( textValue = 'barsuçon' ). |
|
21117 |
|
21118 ! |
|
21119 |
|
21120 test_normalizecharacters04 |
|
21121 " |
|
21122 Normalize an element with normalize-characters set to true, check that |
|
21123 characters are normalized. |
|
21124 |
|
21125 Creator: Curt Arnold |
|
21126 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
21127 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21128 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21129 " |
|
21130 | |
|
21131 doc "Document" |
|
21132 docElem "Element" |
|
21133 domConfig "DOMConfiguration" |
|
21134 errorMonitor "DOMErrorMonitor" |
|
21135 pList "NodeList" |
|
21136 pElem "Element" |
|
21137 text "Text" |
|
21138 textValue "String" |
|
21139 retval "Node" |
|
21140 canSet "Boolean" |
|
21141 | |
|
21142 "implementationAttribute not supported: namespaceAware" |
|
21143 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21144 domConfig := doc domConfig. |
|
21145 canSet := domConfig canSetParameter: 'normalize-characters' value: true. |
|
21146 "if" |
|
21147 (canSet) ifTrue: [ |
|
21148 ]. |
|
21149 |
|
21150 ! |
|
21151 |
|
21152 test_normalizecharacters05 |
|
21153 " |
|
21154 Normalize an document (using Node.normalize) with normalize-characters set to false, check that |
|
21155 characters are not normalized. |
|
21156 |
|
21157 Creator: Curt Arnold |
|
21158 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
21159 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21160 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21161 " |
|
21162 | |
|
21163 doc "Document" |
|
21164 docElem "Element" |
|
21165 domConfig "DOMConfiguration" |
|
21166 errorMonitor "DOMErrorMonitor" |
|
21167 pList "NodeList" |
|
21168 pElem "Element" |
|
21169 text "Text" |
|
21170 textValue "String" |
|
21171 retval "Node" |
|
21172 | |
|
21173 "implementationAttribute not supported: namespaceAware" |
|
21174 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21175 domConfig := doc domConfig. |
|
21176 domConfig setParameter: 'normalize-characters' value: false. |
|
21177 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
21178 pList := doc getElementsByTagName: 'p'. |
|
21179 pElem := pList item:0. |
|
21180 text := doc createTextNode:'suçon'. |
|
21181 retval := pElem appendChild:text. |
|
21182 doc normalize. |
|
21183 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
21184 pList := doc getElementsByTagName: 'p'. |
|
21185 pElem := pList item:0. |
|
21186 text := pElem firstChild. |
|
21187 textValue := text nodeValue. |
|
21188 self assert: ( textValue = 'barsuçon' ). |
|
21189 |
|
21190 ! |
|
21191 |
|
21192 test_normalizecharacters06 |
|
21193 " |
|
21194 Normalize a document (using Node.normalize) with normalize-characters set to true, check that |
|
21195 characters are normalized. |
|
21196 |
|
21197 Creator: Curt Arnold |
|
21198 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
21199 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21200 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21201 " |
|
21202 | |
|
21203 doc "Document" |
|
21204 docElem "Element" |
|
21205 domConfig "DOMConfiguration" |
|
21206 errorMonitor "DOMErrorMonitor" |
|
21207 pList "NodeList" |
|
21208 pElem "Element" |
|
21209 text "Text" |
|
21210 textValue "String" |
|
21211 retval "Node" |
|
21212 canSet "Boolean" |
|
21213 | |
|
21214 "implementationAttribute not supported: namespaceAware" |
|
21215 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21216 domConfig := doc domConfig. |
|
21217 canSet := domConfig canSetParameter: 'normalize-characters' value: true. |
|
21218 "if" |
|
21219 (canSet) ifTrue: [ |
|
21220 ]. |
|
21221 |
|
21222 ! |
|
21223 |
|
21224 test_normalizecharacters07 |
|
21225 " |
|
21226 Normalize a text node with normalize-characters set to false, check that |
|
21227 characters are not normalized. |
|
21228 |
|
21229 Creator: Curt Arnold |
|
21230 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
21231 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21232 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21233 " |
|
21234 | |
|
21235 doc "Document" |
|
21236 docElem "Element" |
|
21237 domConfig "DOMConfiguration" |
|
21238 errorMonitor "DOMErrorMonitor" |
|
21239 pList "NodeList" |
|
21240 pElem "Element" |
|
21241 text "Text" |
|
21242 textValue "String" |
|
21243 retval "Node" |
|
21244 | |
|
21245 "implementationAttribute not supported: namespaceAware" |
|
21246 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21247 domConfig := doc domConfig. |
|
21248 domConfig setParameter: 'normalize-characters' value: false. |
|
21249 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
21250 pList := doc getElementsByTagName: 'p'. |
|
21251 pElem := pList item:0. |
|
21252 text := doc createTextNode:'suçon'. |
|
21253 retval := pElem appendChild:text. |
|
21254 retval normalize. |
|
21255 errorMonitor assertLowerSeverityFor: self message:'normalizeError' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
21256 pList := doc getElementsByTagName: 'p'. |
|
21257 pElem := pList item:0. |
|
21258 text := pElem lastChild. |
|
21259 textValue := text nodeValue. |
|
21260 self assert: ( textValue = 'suçon' ). |
|
21261 |
|
21262 ! |
|
21263 |
|
21264 test_normalizecharacters08 |
|
21265 " |
|
21266 Normalize a text node with normalize-characters set to true, check that |
|
21267 characters are normalized. |
|
21268 |
|
21269 Creator: Curt Arnold |
|
21270 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
21271 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-normalize-characters |
|
21272 Subject http://www.w3.org/TR/2003/WD-charmod-20030822/ |
|
21273 " |
|
21274 | |
|
21275 doc "Document" |
|
21276 docElem "Element" |
|
21277 domConfig "DOMConfiguration" |
|
21278 errorMonitor "DOMErrorMonitor" |
|
21279 pList "NodeList" |
|
21280 pElem "Element" |
|
21281 text "Text" |
|
21282 textValue "String" |
|
21283 retval "Node" |
|
21284 canSet "Boolean" |
|
21285 | |
|
21286 "implementationAttribute not supported: namespaceAware" |
|
21287 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21288 domConfig := doc domConfig. |
|
21289 canSet := domConfig canSetParameter: 'normalize-characters' value: true. |
|
21290 "if" |
|
21291 (canSet) ifTrue: [ |
|
21292 ]. |
|
21293 |
|
21294 ! |
|
21295 |
|
21296 test_splitcdatasections01 |
|
21297 " |
|
21298 Add a CDATASection containing ]]> and call Node.normalize which should not |
|
21299 split or raise warning. |
|
21300 |
|
21301 Creator: Curt Arnold |
|
21302 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-normalize |
|
21303 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-split-cdata-sections |
|
21304 " |
|
21305 | |
|
21306 doc "Document" |
|
21307 elem "Element" |
|
21308 domConfig "DOMConfiguration" |
|
21309 elemList "NodeList" |
|
21310 newChild "CDATASection" |
|
21311 oldChild "Node" |
|
21312 retval "Node" |
|
21313 errorMonitor "DOMErrorMonitor" |
|
21314 errors "List" |
|
21315 | |
|
21316 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21317 elemList := doc getElementsByTagName: 'p'. |
|
21318 elem := elemList item:0. |
|
21319 oldChild := elem firstChild. |
|
21320 newChild := doc createCDATASection:'this is not ]]> good'. |
|
21321 elem replaceChild:oldChild with: newChild. |
|
21322 domConfig := doc domConfig. |
|
21323 domConfig setParameter: 'split-cdata-sections' value: false. |
|
21324 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
21325 doc normalize. |
|
21326 errorMonitor assertLowerSeverityFor: self message:'noErrors' severity: DOMErrorMonitor SEVERITY_ERROR. |
|
21327 |
|
21328 ! |
|
21329 |
|
21330 test_textiselementcontentwhitespace01 |
|
21331 " |
|
21332 Invoke isElementContentWhitespace on a newly created Text Node that contains only whitespace. |
|
21333 Should be false since there is no content model to determine if the node appears within element content. |
|
21334 |
|
21335 Creator: IBM |
|
21336 Autor Neil Delima |
|
21337 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-isElementContentWhitespace |
|
21338 " |
|
21339 | |
|
21340 doc "Document" |
|
21341 newText "Text" |
|
21342 hasWhitespace "Boolean" |
|
21343 | |
|
21344 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21345 newText := doc createTextNode:' '. |
|
21346 hasWhitespace := newText isElementContentWhitespace. |
|
21347 self deny: hasWhitespace. |
|
21348 |
|
21349 ! |
|
21350 |
|
21351 test_textiselementcontentwhitespace02 |
|
21352 " |
|
21353 Get the text node child of the p element in barfoo. isElementContentWhitespace should |
|
21354 be false since the node is neither whitespace or in element content. |
|
21355 |
|
21356 Creator: IBM |
|
21357 Autor Neil Delima |
|
21358 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-isElementContentWhitespace |
|
21359 " |
|
21360 | |
|
21361 doc "Document" |
|
21362 pList "NodeList" |
|
21363 pElem "Element" |
|
21364 textNode "Text" |
|
21365 isElemContentWhitespace "Boolean" |
|
21366 | |
|
21367 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21368 pList := doc getElementsByTagName: 'p'. |
|
21369 pElem := pList item:0. |
|
21370 textNode := pElem firstChild. |
|
21371 isElemContentWhitespace := textNode isElementContentWhitespace. |
|
21372 self deny: isElemContentWhitespace. |
|
21373 |
|
21374 ! |
|
21375 |
|
21376 test_textiselementcontentwhitespace03 |
|
21377 " |
|
21378 Get the newline between the body and p element. Since node is both in element content |
|
21379 and whitespace, isElementContentWhitespace should return true. |
|
21380 |
|
21381 Creator: IBM |
|
21382 Autor Neil Delima |
|
21383 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-isElementContentWhitespace |
|
21384 " |
|
21385 | |
|
21386 doc "Document" |
|
21387 pList "NodeList" |
|
21388 pElem "Element" |
|
21389 textNode "Text" |
|
21390 isElemContentWhitespace "Boolean" |
|
21391 | |
|
21392 ^self. "Validation not supported" |
|
21393 "implementationAttribute not supported: ignoringElementContentWhitespace" |
|
21394 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21395 pList := doc getElementsByTagName: 'p'. |
|
21396 pElem := pList item:0. |
|
21397 textNode := pElem previousSibling. |
|
21398 isElemContentWhitespace := textNode isElementContentWhitespace. |
|
21399 self assert: isElemContentWhitespace. |
|
21400 |
|
21401 ! |
|
21402 |
|
21403 test_textiselementcontentwhitespace04 |
|
21404 " |
|
21405 Replace the text node child of the p element in barfoo with whitespace and normalize with validation. |
|
21406 isElementContentWhitespace should be false since the node is not in element content. |
|
21407 |
|
21408 Creator: Curt Arnold |
|
21409 Autor Curt Arnold |
|
21410 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-isElementContentWhitespace |
|
21411 " |
|
21412 | |
|
21413 doc "Document" |
|
21414 pList "NodeList" |
|
21415 pElem "Element" |
|
21416 textNode "Text" |
|
21417 blankNode "Text" |
|
21418 returnedNode "Node" |
|
21419 isElemContentWhitespace "Boolean" |
|
21420 domConfig "DOMConfiguration" |
|
21421 canSetValidation "Boolean" |
|
21422 replacedNode "Node" |
|
21423 | |
|
21424 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21425 domConfig := doc domConfig. |
|
21426 canSetValidation := domConfig canSetParameter: 'validate' value: true. |
|
21427 "if" |
|
21428 (canSetValidation) ifTrue: [ |
|
21429 ]. |
|
21430 |
|
21431 ! |
|
21432 |
|
21433 test_textiselementcontentwhitespace05 |
|
21434 " |
|
21435 Replace the whitespace before the p element in barfoo with non-whitespace and normalize with validation. |
|
21436 isElementContentWhitespace should be false since the node is not whitespace. |
|
21437 |
|
21438 Creator: Curt Arnold |
|
21439 Autor Curt Arnold |
|
21440 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-isElementContentWhitespace |
|
21441 " |
|
21442 | |
|
21443 doc "Document" |
|
21444 bodyList "NodeList" |
|
21445 bodyElem "Element" |
|
21446 textNode "Text" |
|
21447 nonBlankNode "Text" |
|
21448 returnedNode "Node" |
|
21449 isElemContentWhitespace "Boolean" |
|
21450 domConfig "DOMConfiguration" |
|
21451 canSetValidation "Boolean" |
|
21452 refChild "Node" |
|
21453 errorMonitor "DOMErrorMonitor" |
|
21454 | |
|
21455 "implementationAttribute not supported: namespaceAware" |
|
21456 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21457 domConfig := doc domConfig. |
|
21458 canSetValidation := domConfig canSetParameter: 'validate' value: true. |
|
21459 "if" |
|
21460 (canSetValidation) ifTrue: [ |
|
21461 ]. |
|
21462 |
|
21463 ! |
|
21464 |
|
21465 test_textiselementcontentwhitespace06 |
|
21466 " |
|
21467 Insert whitespace before the p element in barfoo and normalize with validation. |
|
21468 isElementContentWhitespace should be true since the node is whitespace and in element content. |
|
21469 |
|
21470 Creator: Curt Arnold |
|
21471 Autor Curt Arnold |
|
21472 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-isElementContentWhitespace |
|
21473 " |
|
21474 | |
|
21475 doc "Document" |
|
21476 bodyList "NodeList" |
|
21477 bodyElem "Element" |
|
21478 refChild "Node" |
|
21479 textNode "Text" |
|
21480 blankNode "Text" |
|
21481 returnedNode "Node" |
|
21482 isElemContentWhitespace "Boolean" |
|
21483 domConfig "DOMConfiguration" |
|
21484 canSetValidation "Boolean" |
|
21485 replacedNode "Node" |
|
21486 errorMonitor "DOMErrorMonitor" |
|
21487 | |
|
21488 "implementationAttribute not supported: namespaceAware" |
|
21489 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21490 domConfig := doc domConfig. |
|
21491 canSetValidation := domConfig canSetParameter: 'validate' value: true. |
|
21492 "if" |
|
21493 (canSetValidation) ifTrue: [ |
|
21494 ]. |
|
21495 |
|
21496 ! |
|
21497 |
|
21498 test_textreplacewholetext01 |
|
21499 " |
|
21500 Invoke replaceWholeText on an existing Text Node to replace its value with a |
|
21501 new value containing white space characters. Verify the replaceWholeText by |
|
21502 verifying the values returned by wholeText |
|
21503 of the returned Text node. |
|
21504 |
|
21505 Creator: IBM |
|
21506 Autor Neil Delima |
|
21507 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21508 " |
|
21509 | |
|
21510 doc "Document" |
|
21511 itemList "NodeList" |
|
21512 elementName "Element" |
|
21513 textNode "Text" |
|
21514 replacedText "Text" |
|
21515 wholeText "String" |
|
21516 | |
|
21517 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21518 itemList := doc getElementsByTagName: 'strong'. |
|
21519 elementName := itemList item:0. |
|
21520 textNode := elementName firstChild. |
|
21521 replacedText := textNode replaceWholeText:'New Content'. |
|
21522 wholeText := replacedText wholeText. |
|
21523 self assert: ( wholeText = 'New Content' ). |
|
21524 |
|
21525 ! |
|
21526 |
|
21527 test_textreplacewholetext02 |
|
21528 " |
|
21529 Invoke replaceWholeText on an existing Text Node to replace its value with an |
|
21530 empty string value. Verify the repalceWholeText method by verifying if the value |
|
21531 returned is null. |
|
21532 |
|
21533 Creator: IBM |
|
21534 Autor Neil Delima |
|
21535 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21536 " |
|
21537 | |
|
21538 doc "Document" |
|
21539 itemList "NodeList" |
|
21540 elementName "Element" |
|
21541 textNode "Text" |
|
21542 replacedText "Text" |
|
21543 | |
|
21544 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21545 itemList := doc getElementsByTagName: 'strong'. |
|
21546 elementName := itemList item:0. |
|
21547 textNode := elementName firstChild. |
|
21548 replacedText := textNode replaceWholeText:''. |
|
21549 self assert: replacedText isNil. |
|
21550 |
|
21551 ! |
|
21552 |
|
21553 test_textreplacewholetext03 |
|
21554 " |
|
21555 Invoke replaceWholeText on an new Text Node to replace its value with a |
|
21556 new value. Verify the repalceWholeText by verifying the values returned by |
|
21557 wholeText of the returned Text node. |
|
21558 |
|
21559 Creator: IBM |
|
21560 Autor Neil Delima |
|
21561 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21562 " |
|
21563 | |
|
21564 doc "Document" |
|
21565 textNode "Text" |
|
21566 replacedText "Text" |
|
21567 wholeText "String" |
|
21568 | |
|
21569 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21570 textNode := doc createTextNode:'New Text'. |
|
21571 replacedText := textNode replaceWholeText:' a b c b '. |
|
21572 wholeText := replacedText wholeText. |
|
21573 self assert: ( wholeText = ' a b c b ' ). |
|
21574 |
|
21575 ! |
|
21576 |
|
21577 test_textreplacewholetext04 |
|
21578 " |
|
21579 Invoke replaceWholeText on an new Text Node to replace its value with an |
|
21580 empty value. |
|
21581 |
|
21582 Creator: IBM |
|
21583 Autor Neil Delima |
|
21584 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21585 " |
|
21586 | |
|
21587 doc "Document" |
|
21588 textNode "Text" |
|
21589 replacedText "Text" |
|
21590 wholeText "String" |
|
21591 | |
|
21592 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21593 textNode := doc createTextNode:'New Text'. |
|
21594 replacedText := textNode replaceWholeText:''. |
|
21595 self assert: replacedText isNil. |
|
21596 |
|
21597 ! |
|
21598 |
|
21599 test_textreplacewholetext05 |
|
21600 " |
|
21601 Invoke replaceWholeText on an existing text node with newly created text and CDATASection |
|
21602 nodes appended as children of its parent element node. Verify repalceWholeText by |
|
21603 verifying the values returned by wholeText. |
|
21604 |
|
21605 Creator: IBM |
|
21606 Autor Neil Delima |
|
21607 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21608 " |
|
21609 | |
|
21610 doc "Document" |
|
21611 itemList "NodeList" |
|
21612 elementName "Element" |
|
21613 textNode "Text" |
|
21614 cdataNode "CDATASection" |
|
21615 replacedText "Text" |
|
21616 wholeText "String" |
|
21617 appendedChild "Node" |
|
21618 | |
|
21619 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21620 itemList := doc getElementsByTagName: 'strong'. |
|
21621 elementName := itemList item:0. |
|
21622 textNode := doc createTextNode:'New Text'. |
|
21623 cdataNode := doc createCDATASection:'New CDATA'. |
|
21624 appendedChild := elementName appendChild:textNode. |
|
21625 appendedChild := elementName appendChild:cdataNode. |
|
21626 textNode := elementName firstChild. |
|
21627 replacedText := textNode replaceWholeText:'New Text and Cdata'. |
|
21628 wholeText := replacedText wholeText. |
|
21629 self assert: ( wholeText = 'New Text and Cdata' ). |
|
21630 |
|
21631 ! |
|
21632 |
|
21633 test_textreplacewholetext06 |
|
21634 " |
|
21635 The method replaceWholeText substitutes the a specified text for the text of |
|
21636 the current node and all logically-adjacent text nodes. This method raises |
|
21637 a NO_MODIFICATION_ALLOWED_ERR if one of the Text nodes being replaced is readonly. |
|
21638 |
|
21639 Invoke replaceWholeText on an existing text node with newly created text and Entityreference |
|
21640 nodes (whose replacement text is a character entity reference) appended as children of its parent element node. |
|
21641 Where the nodes to be removed are read-only descendants of an EntityReference, the EntityReference |
|
21642 must be removed instead of the read-only nodes. Only if any EntityReference to be removed has |
|
21643 descendants that are not EntityReference, Text, or CDATASection nodes, the replaceWholeText |
|
21644 method must fail, raising a NO_MODIFICATION_ALLOWED_ERR. Verify that the method does not raise |
|
21645 an exception and verify the content of the returned text node. |
|
21646 |
|
21647 Creator: IBM |
|
21648 Autor Neil Delima |
|
21649 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21650 " |
|
21651 | |
|
21652 doc "Document" |
|
21653 itemList "NodeList" |
|
21654 elementStrong "Element" |
|
21655 textNode "Text" |
|
21656 erefNode "EntityReference" |
|
21657 replacedText "Text" |
|
21658 appendedChild "Node" |
|
21659 nodeValue "String" |
|
21660 | |
|
21661 "implementationAttribute not supported: namespaceAware" |
|
21662 ^self. "Validation not supported" |
|
21663 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21664 itemList := doc getElementsByTagName: 'strong'. |
|
21665 elementStrong := itemList item:0. |
|
21666 textNode := doc createTextNode:'New Text'. |
|
21667 erefNode := doc createEntityReference:'beta'. |
|
21668 appendedChild := elementStrong appendChild:textNode. |
|
21669 appendedChild := elementStrong appendChild:erefNode. |
|
21670 textNode := elementStrong firstChild. |
|
21671 replacedText := textNode replaceWholeText:'New Text and Cdata'. |
|
21672 nodeValue := textNode nodeValue. |
|
21673 self assert: ( nodeValue = 'New Text and Cdata' ). |
|
21674 |
|
21675 ! |
|
21676 |
|
21677 test_textreplacewholetext07 |
|
21678 " |
|
21679 Append an entity reference and a text node after to the content of the |
|
21680 first strong element. Then call replaceWholeText on initial content |
|
21681 of that element. Since the entity reference does not contain any |
|
21682 logically-adjacent text content, only the initial text element should |
|
21683 be replaced. |
|
21684 |
|
21685 Creator: IBM |
|
21686 Autor Neil Delima |
|
21687 Autor Curt Arnold |
|
21688 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21689 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=425 |
|
21690 " |
|
21691 | |
|
21692 doc "Document" |
|
21693 itemList "NodeList" |
|
21694 elementName "Element" |
|
21695 textNode "Text" |
|
21696 erefNode "EntityReference" |
|
21697 replacedText "Text" |
|
21698 appendedChild "Node" |
|
21699 node "Node" |
|
21700 nodeValue "String" |
|
21701 nodeType "SmallInteger" |
|
21702 | |
|
21703 "implementationAttribute not supported: namespaceAware" |
|
21704 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21705 itemList := doc getElementsByTagName: 'strong'. |
|
21706 elementName := itemList item:0. |
|
21707 erefNode := doc createEntityReference:'ent4'. |
|
21708 textNode := doc createTextNode:'New Text'. |
|
21709 appendedChild := elementName appendChild:erefNode. |
|
21710 appendedChild := elementName appendChild:textNode. |
|
21711 textNode := elementName firstChild. |
|
21712 replacedText := textNode replaceWholeText:'New Text and Cdata'. |
|
21713 textNode := elementName firstChild. |
|
21714 self assert: replacedText == textNode. |
|
21715 nodeValue := textNode nodeValue. |
|
21716 self assert: ( nodeValue = 'New Text and Cdata' ). |
|
21717 node := textNode nextSibling. |
|
21718 self assert: node notNil. |
|
21719 nodeType := node nodeType. |
|
21720 self assert: ( nodeType = 5 ). |
|
21721 |
|
21722 ! |
|
21723 |
|
21724 test_textreplacewholetext08 |
|
21725 " |
|
21726 Appends an entity reference containing text and an element to an existing |
|
21727 text node, then calls Text.replaceWholeText on the existing text node. |
|
21728 A NO_MODIFICATION_ALLOWED_ERR should be thrown. |
|
21729 |
|
21730 Creator: Curt Arnold |
|
21731 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText |
|
21732 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=425 |
|
21733 Subject http://www.w3.org/Bugs/Public/show_bug.cgi?id=540 |
|
21734 " |
|
21735 | |
|
21736 doc "Document" |
|
21737 itemList "NodeList" |
|
21738 p "Element" |
|
21739 entRef "EntityReference" |
|
21740 node "Node" |
|
21741 | |
|
21742 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
21743 itemList := doc getElementsByTagName: 'p'. |
|
21744 p := itemList item:0. |
|
21745 entRef := doc createEntityReference:'ent2'. |
|
21746 node := p appendChild:entRef. |
|
21747 node := p firstChild. |
|
21748 "assertDOMException..." |
|
21749 self should:[ |
|
21750 node := node replaceWholeText:'yo'. |
|
21751 ] raise: DOMException. |
|
21752 self assert: (lastException code == DOMException NO_MODIFICATION_ALLOWED_ERR). |
|
21753 "end of assertDOMException..." |
|
21754 |
|
21755 ! |
|
21756 |
|
21757 test_textwholetext01 |
|
21758 " |
|
21759 Invoke wholetext on an existing Text Node that contains whitespace and verify if |
|
21760 the value returned is correct. |
|
21761 |
|
21762 Creator: IBM |
|
21763 Autor Neil Delima |
|
21764 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-wholeText |
|
21765 " |
|
21766 | |
|
21767 doc "Document" |
|
21768 itemList "NodeList" |
|
21769 elementName "Element" |
|
21770 textNode "Text" |
|
21771 nameWholeText "String" |
|
21772 | |
|
21773 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21774 itemList := doc getElementsByTagName: 'strong'. |
|
21775 elementName := itemList item:0. |
|
21776 textNode := elementName firstChild. |
|
21777 nameWholeText := textNode wholeText. |
|
21778 self assert: ( nameWholeText = 'Margaret Martin' ). |
|
21779 |
|
21780 ! |
|
21781 |
|
21782 test_textwholetext02 |
|
21783 " |
|
21784 Invoke wholetext on an existing Text Node that contains whitespace and and verify if |
|
21785 the value returned is correct. |
|
21786 |
|
21787 Creator: IBM |
|
21788 Autor Neil Delima |
|
21789 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-wholeText |
|
21790 " |
|
21791 | |
|
21792 doc "Document" |
|
21793 itemList "NodeList" |
|
21794 elementName "Element" |
|
21795 textNode "Text" |
|
21796 newTextNode "Text" |
|
21797 wholeText "String" |
|
21798 appendedChild "Node" |
|
21799 | |
|
21800 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21801 itemList := doc getElementsByTagName: 'strong'. |
|
21802 elementName := itemList item:0. |
|
21803 newTextNode := doc createTextNode:'New Text'. |
|
21804 appendedChild := elementName appendChild:newTextNode. |
|
21805 textNode := elementName firstChild. |
|
21806 wholeText := textNode wholeText. |
|
21807 self assert: ( wholeText = 'Margaret MartinNew Text' ). |
|
21808 |
|
21809 ! |
|
21810 |
|
21811 test_textwholetext03 |
|
21812 " |
|
21813 Invoke wholetext on two newly created text nodes and verify if the value returned |
|
21814 is correct. |
|
21815 |
|
21816 Creator: IBM |
|
21817 Autor Neil Delima |
|
21818 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-wholeText |
|
21819 " |
|
21820 | |
|
21821 doc "Document" |
|
21822 elem "Element" |
|
21823 text1 "Text" |
|
21824 text2 "Text" |
|
21825 appendedChild "Node" |
|
21826 combinedText "String" |
|
21827 | |
|
21828 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21829 elem := doc createElement:'p' ns:'http://www.w3.org/1999/xhtml'. |
|
21830 text1 := doc createTextNode:'Text I'. |
|
21831 text2 := doc createTextNode:' Text II'. |
|
21832 appendedChild := elem appendChild:text1. |
|
21833 appendedChild := elem appendChild:text2. |
|
21834 combinedText := text1 wholeText. |
|
21835 self assert: ( combinedText = 'Text I Text II' ). |
|
21836 |
|
21837 ! |
|
21838 |
|
21839 test_typeinfogettypename03 |
|
21840 " |
|
21841 The typeName attribute states the name of a type declared for the associated element or |
|
21842 attribute, or null if unknown. |
|
21843 |
|
21844 Invoke getSchemaTypeInfo method on an attribute having [type definition] property. Expose |
|
21845 {name} and {target namespace} properties of the [type definition] property. |
|
21846 Verify that the typeName of id's schemaTypeInfo are correct. |
|
21847 |
|
21848 Creator: IBM |
|
21849 Autor Jenny Hsu |
|
21850 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
21851 " |
|
21852 | |
|
21853 doc "Document" |
|
21854 elemList "NodeList" |
|
21855 attrid "Attr" |
|
21856 acElem "Element" |
|
21857 attrTypeInfo "TypeInfo" |
|
21858 typeName "String" |
|
21859 | |
|
21860 ^self. "Schema validation not supported" |
|
21861 ^self. "Validation not supported" |
|
21862 "implementationAttribute not supported: namespaceAware" |
|
21863 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21864 elemList := doc getElementsByTagName: 'acronym'. |
|
21865 acElem := elemList item:2. |
|
21866 attrid := acElem getAttributeNode:'id'. |
|
21867 attrTypeInfo := attrid schemaTypeInfo. |
|
21868 typeName := attrTypeInfo typeName. |
|
21869 self assert: ( typeName = 'ID' ). |
|
21870 |
|
21871 ! |
|
21872 |
|
21873 test_typeinfogettypename04 |
|
21874 " |
|
21875 The typeName attribute states the name of a type declared for the associated element or |
|
21876 attribute, or null if unknown. |
|
21877 |
|
21878 Invoke getSchemaTypeInfo method on an attribute having [member type definition]property. Expose |
|
21879 {name} and {target namespace} properties of the [member type definition] property. |
|
21880 Verify that the typeName of an em element's schemaTypeInfo is correct. |
|
21881 |
|
21882 Creator: IBM |
|
21883 Autor Jenny Hsu |
|
21884 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
21885 " |
|
21886 | |
|
21887 doc "Document" |
|
21888 docElem "Element" |
|
21889 elemList "NodeList" |
|
21890 emElem "Element" |
|
21891 elemTypeInfo "TypeInfo" |
|
21892 typeName "String" |
|
21893 | |
|
21894 ^self. "Schema validation not supported" |
|
21895 ^self. "Validation not supported" |
|
21896 "implementationAttribute not supported: namespaceAware" |
|
21897 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21898 elemList := doc getElementsByTagName: 'em'. |
|
21899 emElem := elemList item:0. |
|
21900 elemTypeInfo := emElem schemaTypeInfo. |
|
21901 typeName := elemTypeInfo typeName. |
|
21902 self assert: ( typeName = 'emType' ). |
|
21903 |
|
21904 ! |
|
21905 |
|
21906 test_typeinfogettypenamespace01 |
|
21907 " |
|
21908 The typeNamespace attribute states the namespace of a type declared for the associated element or |
|
21909 attribute, or null if unknown. |
|
21910 |
|
21911 Invoke getSchemaTypeInfo method on an attribute having [type definition] property. Expose |
|
21912 {name} and {target namespace} properties of the [type definition] property. |
|
21913 Verify that the typeNamespace of the attrib1 and attrib3's schemaTypeInfo are correct. |
|
21914 |
|
21915 Creator: IBM |
|
21916 Autor Jenny Hsu |
|
21917 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeNamespace |
|
21918 " |
|
21919 | |
|
21920 doc "Document" |
|
21921 elemList "NodeList" |
|
21922 acElem "Element" |
|
21923 titleAttr "Attr" |
|
21924 attrTypeInfo "TypeInfo" |
|
21925 typeNamespace "String" |
|
21926 | |
|
21927 ^self. "Schema validation not supported" |
|
21928 ^self. "Validation not supported" |
|
21929 "implementationAttribute not supported: namespaceAware" |
|
21930 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21931 elemList := doc getElementsByTagName: 'acronym'. |
|
21932 acElem := elemList item:0. |
|
21933 titleAttr := acElem getAttributeNode:'title'. |
|
21934 attrTypeInfo := titleAttr schemaTypeInfo. |
|
21935 typeNamespace := attrTypeInfo typeNamespace. |
|
21936 self assert: ( typeNamespace = 'http://www.w3.org/2001/XMLSchema' ). |
|
21937 |
|
21938 ! |
|
21939 |
|
21940 test_typeinfogettypenamespace03 |
|
21941 " |
|
21942 The typeNamespace attribute states the namespace of a type declared for the associated element or |
|
21943 attribute, or null if unknown. |
|
21944 |
|
21945 Invoke getSchemaTypeInfo method on an attribute having [type definition] property. Expose |
|
21946 {name} and {target namespace} properties of the [type definition] property. |
|
21947 Verify that the typeName of class's schemaTypeInfo is correct. |
|
21948 |
|
21949 Creator: IBM |
|
21950 Autor Jenny Hsu |
|
21951 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
21952 " |
|
21953 | |
|
21954 doc "Document" |
|
21955 elemList "NodeList" |
|
21956 classAttr "Attr" |
|
21957 attrTypeInfo "TypeInfo" |
|
21958 typeNamespace "String" |
|
21959 acElem "Element" |
|
21960 | |
|
21961 ^self. "Schema validation not supported" |
|
21962 ^self. "Validation not supported" |
|
21963 "implementationAttribute not supported: namespaceAware" |
|
21964 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21965 elemList := doc getElementsByTagName: 'acronym'. |
|
21966 acElem := elemList item:1. |
|
21967 classAttr := acElem getAttributeNode:'class'. |
|
21968 attrTypeInfo := classAttr schemaTypeInfo. |
|
21969 typeNamespace := attrTypeInfo typeNamespace. |
|
21970 self assert: ( typeNamespace = 'http://www.w3.org/1999/xhtml' ). |
|
21971 |
|
21972 ! |
|
21973 |
|
21974 test_typeinfogettypenamespace04 |
|
21975 " |
|
21976 The typeName attribute states the name of a type declared for the associated element or |
|
21977 attribute, or null if unknown. |
|
21978 |
|
21979 Invoke getSchemaTypeInfo method on an attribute having [member type definition]property. Expose |
|
21980 {name} and {target namespace} properties of the [member type definition] property. |
|
21981 Verify that the typeNamespace of eldblUnionA's schemaTypeInfo is null??? (sv) |
|
21982 |
|
21983 Creator: IBM |
|
21984 Autor Jenny Hsu |
|
21985 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-typeName |
|
21986 " |
|
21987 | |
|
21988 doc "Document" |
|
21989 elemList "NodeList" |
|
21990 emElem "Element" |
|
21991 elemTypeInfo "TypeInfo" |
|
21992 typeNamespace "String" |
|
21993 | |
|
21994 ^self. "Schema validation not supported" |
|
21995 ^self. "Validation not supported" |
|
21996 "implementationAttribute not supported: namespaceAware" |
|
21997 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
21998 elemList := doc getElementsByTagName: 'em'. |
|
21999 emElem := elemList item:0. |
|
22000 elemTypeInfo := emElem schemaTypeInfo. |
|
22001 typeNamespace := elemTypeInfo typeNamespace. |
|
22002 self assert: ( typeNamespace = 'http://www.w3.org/1999/xhtml' ). |
|
22003 |
|
22004 ! |
|
22005 |
|
22006 test_typeinfoisderivedfrom01 |
|
22007 " |
|
22008 DTD types always return false for isDerivedFrom. |
|
22009 |
|
22010 Creator: Curt Arnold |
|
22011 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22012 " |
|
22013 | |
|
22014 doc "Document" |
|
22015 elemList "NodeList" |
|
22016 acronymElem "Element" |
|
22017 attr "Attr" |
|
22018 elem "Element" |
|
22019 elemName "String" |
|
22020 typeInfo "TypeInfo" |
|
22021 isDerived "Boolean" |
|
22022 | |
|
22023 ^self. "Validation not supported" |
|
22024 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22025 elemList := doc getElementsByTagName: 'acronym'. |
|
22026 acronymElem := elemList item:0. |
|
22027 attr := acronymElem getAttributeNode:'title'. |
|
22028 typeInfo := attr schemaTypeInfo. |
|
22029 self assert: typeInfo notNil. |
|
22030 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/TR/REC-xml' name:'CDATA' method:0. |
|
22031 self deny: isDerived. |
|
22032 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/TR/REC-xml' name:'CDATA' method:15. |
|
22033 self deny: isDerived. |
|
22034 |
|
22035 ! |
|
22036 |
|
22037 test_typeinfoisderivedfrom02 |
|
22038 " |
|
22039 Check how xsd:string is derived from itself. |
|
22040 |
|
22041 Creator: Curt Arnold |
|
22042 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22043 " |
|
22044 | |
|
22045 doc "Document" |
|
22046 elemList "NodeList" |
|
22047 acronymElem "Element" |
|
22048 attr "Attr" |
|
22049 elem "Element" |
|
22050 elemName "String" |
|
22051 typeInfo "TypeInfo" |
|
22052 isDerived "Boolean" |
|
22053 | |
|
22054 ^self. "Schema validation not supported" |
|
22055 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22056 elemList := doc getElementsByTagName: 'acronym'. |
|
22057 acronymElem := elemList item:0. |
|
22058 attr := acronymElem getAttributeNode:'title'. |
|
22059 typeInfo := attr schemaTypeInfo. |
|
22060 self assert: typeInfo notNil. |
|
22061 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:1. |
|
22062 self assert: isDerived. |
|
22063 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:14. |
|
22064 self deny: isDerived. |
|
22065 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:0. |
|
22066 self assert: isDerived. |
|
22067 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:15. |
|
22068 self assert: isDerived. |
|
22069 |
|
22070 ! |
|
22071 |
|
22072 test_typeinfoisderivedfrom03 |
|
22073 " |
|
22074 Check that isDerivedFrom does considers xsd:string to be derived from anySimpleType. |
|
22075 |
|
22076 Creator: Curt Arnold |
|
22077 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22078 " |
|
22079 | |
|
22080 doc "Document" |
|
22081 elemList "NodeList" |
|
22082 acronymElem "Element" |
|
22083 attr "Attr" |
|
22084 elem "Element" |
|
22085 elemName "String" |
|
22086 typeInfo "TypeInfo" |
|
22087 isDerived "Boolean" |
|
22088 typeName "String" |
|
22089 | |
|
22090 ^self. "Schema validation not supported" |
|
22091 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22092 elemList := doc getElementsByTagName: 'acronym'. |
|
22093 acronymElem := elemList item:0. |
|
22094 attr := acronymElem getAttributeNode:'title'. |
|
22095 typeInfo := attr schemaTypeInfo. |
|
22096 self assert: typeInfo notNil. |
|
22097 typeName := typeInfo typeName. |
|
22098 self assert: ( typeName = 'string' ). |
|
22099 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:15. |
|
22100 self assert: isDerived. |
|
22101 |
|
22102 ! |
|
22103 |
|
22104 test_typeinfoisderivedfrom04 |
|
22105 " |
|
22106 Check if xsd:string is derived from xsd:anyType by any method. |
|
22107 |
|
22108 Creator: Curt Arnold |
|
22109 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22110 " |
|
22111 | |
|
22112 doc "Document" |
|
22113 elemList "NodeList" |
|
22114 acronymElem "Element" |
|
22115 attr "Attr" |
|
22116 elem "Element" |
|
22117 elemName "String" |
|
22118 typeInfo "TypeInfo" |
|
22119 isDerived "Boolean" |
|
22120 typeName "String" |
|
22121 | |
|
22122 ^self. "Schema validation not supported" |
|
22123 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22124 elemList := doc getElementsByTagName: 'acronym'. |
|
22125 acronymElem := elemList item:0. |
|
22126 attr := acronymElem getAttributeNode:'title'. |
|
22127 typeInfo := attr schemaTypeInfo. |
|
22128 self assert: typeInfo notNil. |
|
22129 typeName := typeInfo typeName. |
|
22130 self assert: ( typeName = 'string' ). |
|
22131 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:15. |
|
22132 self assert: isDerived. |
|
22133 |
|
22134 ! |
|
22135 |
|
22136 test_typeinfoisderivedfrom05 |
|
22137 " |
|
22138 Check if xsd:string is derived from xsd:anyType by restriction. |
|
22139 |
|
22140 Creator: Curt Arnold |
|
22141 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22142 " |
|
22143 | |
|
22144 doc "Document" |
|
22145 elemList "NodeList" |
|
22146 acronymElem "Element" |
|
22147 attr "Attr" |
|
22148 elem "Element" |
|
22149 elemName "String" |
|
22150 typeInfo "TypeInfo" |
|
22151 isDerived "Boolean" |
|
22152 typeName "String" |
|
22153 | |
|
22154 ^self. "Schema validation not supported" |
|
22155 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22156 elemList := doc getElementsByTagName: 'acronym'. |
|
22157 acronymElem := elemList item:0. |
|
22158 attr := acronymElem getAttributeNode:'title'. |
|
22159 typeInfo := attr schemaTypeInfo. |
|
22160 self assert: typeInfo notNil. |
|
22161 typeName := typeInfo typeName. |
|
22162 self assert: ( typeName = 'string' ). |
|
22163 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:1. |
|
22164 self assert: isDerived. |
|
22165 |
|
22166 ! |
|
22167 |
|
22168 test_typeinfoisderivedfrom06 |
|
22169 " |
|
22170 Check if xsd:string is derived from xsd:anyType by any method except restriction. |
|
22171 |
|
22172 Creator: Curt Arnold |
|
22173 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22174 " |
|
22175 | |
|
22176 doc "Document" |
|
22177 elemList "NodeList" |
|
22178 acronymElem "Element" |
|
22179 attr "Attr" |
|
22180 elem "Element" |
|
22181 elemName "String" |
|
22182 typeInfo "TypeInfo" |
|
22183 isDerived "Boolean" |
|
22184 typeName "String" |
|
22185 | |
|
22186 ^self. "Schema validation not supported" |
|
22187 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22188 elemList := doc getElementsByTagName: 'acronym'. |
|
22189 acronymElem := elemList item:0. |
|
22190 attr := acronymElem getAttributeNode:'title'. |
|
22191 typeInfo := attr schemaTypeInfo. |
|
22192 self assert: typeInfo notNil. |
|
22193 typeName := typeInfo typeName. |
|
22194 self assert: ( typeName = 'string' ). |
|
22195 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:14. |
|
22196 self deny: isDerived. |
|
22197 |
|
22198 ! |
|
22199 |
|
22200 test_typeinfoisderivedfrom07 |
|
22201 " |
|
22202 Check if xsd:string is derived from xsd:anyType using 0 as derivation method. |
|
22203 |
|
22204 Creator: Curt Arnold |
|
22205 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22206 " |
|
22207 | |
|
22208 doc "Document" |
|
22209 elemList "NodeList" |
|
22210 acronymElem "Element" |
|
22211 attr "Attr" |
|
22212 elem "Element" |
|
22213 elemName "String" |
|
22214 typeInfo "TypeInfo" |
|
22215 isDerived "Boolean" |
|
22216 typeName "String" |
|
22217 | |
|
22218 ^self. "Schema validation not supported" |
|
22219 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22220 elemList := doc getElementsByTagName: 'acronym'. |
|
22221 acronymElem := elemList item:0. |
|
22222 attr := acronymElem getAttributeNode:'title'. |
|
22223 typeInfo := attr schemaTypeInfo. |
|
22224 self assert: typeInfo notNil. |
|
22225 typeName := typeInfo typeName. |
|
22226 self assert: ( typeName = 'string' ). |
|
22227 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:0. |
|
22228 self assert: isDerived. |
|
22229 |
|
22230 ! |
|
22231 |
|
22232 test_typeinfoisderivedfrom08 |
|
22233 " |
|
22234 Check if classType is derived from xsd:string by any method. |
|
22235 |
|
22236 Creator: Curt Arnold |
|
22237 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22238 " |
|
22239 | |
|
22240 doc "Document" |
|
22241 elemList "NodeList" |
|
22242 acronymElem "Element" |
|
22243 attr "Attr" |
|
22244 elem "Element" |
|
22245 elemName "String" |
|
22246 typeInfo "TypeInfo" |
|
22247 isDerived "Boolean" |
|
22248 typeName "String" |
|
22249 | |
|
22250 ^self. "Schema validation not supported" |
|
22251 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22252 elemList := doc getElementsByTagName: 'acronym'. |
|
22253 acronymElem := elemList item:2. |
|
22254 attr := acronymElem getAttributeNode:'class'. |
|
22255 typeInfo := attr schemaTypeInfo. |
|
22256 self assert: typeInfo notNil. |
|
22257 typeName := typeInfo typeName. |
|
22258 self assert: ( typeName = 'classType' ). |
|
22259 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:15. |
|
22260 self assert: isDerived. |
|
22261 |
|
22262 ! |
|
22263 |
|
22264 test_typeinfoisderivedfrom09 |
|
22265 " |
|
22266 Check if classType is derived from xsd:anySimpleType by any method. |
|
22267 |
|
22268 Creator: Curt Arnold |
|
22269 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22270 " |
|
22271 | |
|
22272 doc "Document" |
|
22273 elemList "NodeList" |
|
22274 acronymElem "Element" |
|
22275 attr "Attr" |
|
22276 elem "Element" |
|
22277 elemName "String" |
|
22278 typeInfo "TypeInfo" |
|
22279 isDerived "Boolean" |
|
22280 typeName "String" |
|
22281 | |
|
22282 ^self. "Schema validation not supported" |
|
22283 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22284 elemList := doc getElementsByTagName: 'acronym'. |
|
22285 acronymElem := elemList item:2. |
|
22286 attr := acronymElem getAttributeNode:'class'. |
|
22287 typeInfo := attr schemaTypeInfo. |
|
22288 self assert: typeInfo notNil. |
|
22289 typeName := typeInfo typeName. |
|
22290 self assert: ( typeName = 'classType' ). |
|
22291 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:15. |
|
22292 self assert: isDerived. |
|
22293 |
|
22294 ! |
|
22295 |
|
22296 test_typeinfoisderivedfrom10 |
|
22297 " |
|
22298 Check if classType is derived from anyType by any method. |
|
22299 |
|
22300 Creator: Curt Arnold |
|
22301 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22302 " |
|
22303 | |
|
22304 doc "Document" |
|
22305 elemList "NodeList" |
|
22306 acronymElem "Element" |
|
22307 attr "Attr" |
|
22308 elem "Element" |
|
22309 elemName "String" |
|
22310 typeInfo "TypeInfo" |
|
22311 isDerived "Boolean" |
|
22312 typeName "String" |
|
22313 | |
|
22314 ^self. "Schema validation not supported" |
|
22315 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22316 elemList := doc getElementsByTagName: 'acronym'. |
|
22317 acronymElem := elemList item:2. |
|
22318 attr := acronymElem getAttributeNode:'class'. |
|
22319 typeInfo := attr schemaTypeInfo. |
|
22320 self assert: typeInfo notNil. |
|
22321 typeName := typeInfo typeName. |
|
22322 self assert: ( typeName = 'classType' ). |
|
22323 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:15. |
|
22324 self assert: isDerived. |
|
22325 |
|
22326 ! |
|
22327 |
|
22328 test_typeinfoisderivedfrom11 |
|
22329 " |
|
22330 Check if classType is derived from xsd:anyType by restriction. |
|
22331 |
|
22332 Creator: Curt Arnold |
|
22333 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22334 " |
|
22335 | |
|
22336 doc "Document" |
|
22337 elemList "NodeList" |
|
22338 acronymElem "Element" |
|
22339 attr "Attr" |
|
22340 elem "Element" |
|
22341 elemName "String" |
|
22342 typeInfo "TypeInfo" |
|
22343 isDerived "Boolean" |
|
22344 typeName "String" |
|
22345 | |
|
22346 ^self. "Schema validation not supported" |
|
22347 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22348 elemList := doc getElementsByTagName: 'acronym'. |
|
22349 acronymElem := elemList item:2. |
|
22350 attr := acronymElem getAttributeNode:'class'. |
|
22351 typeInfo := attr schemaTypeInfo. |
|
22352 self assert: typeInfo notNil. |
|
22353 typeName := typeInfo typeName. |
|
22354 self assert: ( typeName = 'classType' ). |
|
22355 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:1. |
|
22356 self assert: isDerived. |
|
22357 |
|
22358 ! |
|
22359 |
|
22360 test_typeinfoisderivedfrom12 |
|
22361 " |
|
22362 Check classType is derived from anyType specifying derivationMethod as 0. |
|
22363 |
|
22364 Creator: Curt Arnold |
|
22365 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22366 " |
|
22367 | |
|
22368 doc "Document" |
|
22369 elemList "NodeList" |
|
22370 acronymElem "Element" |
|
22371 attr "Attr" |
|
22372 elem "Element" |
|
22373 elemName "String" |
|
22374 typeInfo "TypeInfo" |
|
22375 isDerived "Boolean" |
|
22376 typeName "String" |
|
22377 | |
|
22378 ^self. "Schema validation not supported" |
|
22379 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22380 elemList := doc getElementsByTagName: 'acronym'. |
|
22381 acronymElem := elemList item:2. |
|
22382 attr := acronymElem getAttributeNode:'class'. |
|
22383 typeInfo := attr schemaTypeInfo. |
|
22384 self assert: typeInfo notNil. |
|
22385 typeName := typeInfo typeName. |
|
22386 self assert: ( typeName = 'classType' ). |
|
22387 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:0. |
|
22388 self assert: isDerived. |
|
22389 |
|
22390 ! |
|
22391 |
|
22392 test_typeinfoisderivedfrom13 |
|
22393 " |
|
22394 Check if classType is derived from xsd:anyType by any method other than restriction. |
|
22395 |
|
22396 Creator: Curt Arnold |
|
22397 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22398 " |
|
22399 | |
|
22400 doc "Document" |
|
22401 elemList "NodeList" |
|
22402 acronymElem "Element" |
|
22403 attr "Attr" |
|
22404 elem "Element" |
|
22405 elemName "String" |
|
22406 typeInfo "TypeInfo" |
|
22407 isDerived "Boolean" |
|
22408 typeName "String" |
|
22409 | |
|
22410 ^self. "Schema validation not supported" |
|
22411 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22412 elemList := doc getElementsByTagName: 'acronym'. |
|
22413 acronymElem := elemList item:2. |
|
22414 attr := acronymElem getAttributeNode:'class'. |
|
22415 typeInfo := attr schemaTypeInfo. |
|
22416 self assert: typeInfo notNil. |
|
22417 typeName := typeInfo typeName. |
|
22418 self assert: ( typeName = 'classType' ). |
|
22419 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:14. |
|
22420 self deny: isDerived. |
|
22421 |
|
22422 ! |
|
22423 |
|
22424 test_typeinfoisderivedfrom14 |
|
22425 " |
|
22426 Check how classType is derived from itself. |
|
22427 |
|
22428 Creator: Curt Arnold |
|
22429 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22430 " |
|
22431 | |
|
22432 doc "Document" |
|
22433 elemList "NodeList" |
|
22434 acronymElem "Element" |
|
22435 attr "Attr" |
|
22436 elem "Element" |
|
22437 elemName "String" |
|
22438 typeInfo "TypeInfo" |
|
22439 isDerived "Boolean" |
|
22440 typeName "String" |
|
22441 | |
|
22442 ^self. "Schema validation not supported" |
|
22443 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22444 elemList := doc getElementsByTagName: 'acronym'. |
|
22445 acronymElem := elemList item:2. |
|
22446 attr := acronymElem getAttributeNode:'class'. |
|
22447 typeInfo := attr schemaTypeInfo. |
|
22448 self assert: typeInfo notNil. |
|
22449 typeName := typeInfo typeName. |
|
22450 self assert: ( typeName = 'classType' ). |
|
22451 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'classType' method:1. |
|
22452 self assert: isDerived. |
|
22453 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'classType' method:14. |
|
22454 self deny: isDerived. |
|
22455 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'classType' method:15. |
|
22456 self assert: isDerived. |
|
22457 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'classType' method:0. |
|
22458 self assert: isDerived. |
|
22459 |
|
22460 ! |
|
22461 |
|
22462 test_typeinfoisderivedfrom15 |
|
22463 " |
|
22464 Check emType is derived from emp0001_3Type by any method. |
|
22465 |
|
22466 Creator: Curt Arnold |
|
22467 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22468 " |
|
22469 | |
|
22470 doc "Document" |
|
22471 elemList "NodeList" |
|
22472 elem "Element" |
|
22473 typeInfo "TypeInfo" |
|
22474 isDerived "Boolean" |
|
22475 typeName "String" |
|
22476 | |
|
22477 ^self. "Schema validation not supported" |
|
22478 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22479 elemList := doc getElementsByTagName: 'em'. |
|
22480 elem := elemList item:0. |
|
22481 typeInfo := elem schemaTypeInfo. |
|
22482 self assert: typeInfo notNil. |
|
22483 typeName := typeInfo typeName. |
|
22484 self assert: ( typeName = 'emType' ). |
|
22485 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emp0001_3Type' method:15. |
|
22486 self assert: isDerived. |
|
22487 |
|
22488 ! |
|
22489 |
|
22490 test_typeinfoisderivedfrom16 |
|
22491 " |
|
22492 Check emType is derived from emp0001_3Type by union. |
|
22493 |
|
22494 Creator: Curt Arnold |
|
22495 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22496 " |
|
22497 | |
|
22498 doc "Document" |
|
22499 elemList "NodeList" |
|
22500 elem "Element" |
|
22501 typeInfo "TypeInfo" |
|
22502 isDerived "Boolean" |
|
22503 typeName "String" |
|
22504 | |
|
22505 ^self. "Schema validation not supported" |
|
22506 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22507 elemList := doc getElementsByTagName: 'em'. |
|
22508 elem := elemList item:0. |
|
22509 typeInfo := elem schemaTypeInfo. |
|
22510 self assert: typeInfo notNil. |
|
22511 typeName := typeInfo typeName. |
|
22512 self assert: ( typeName = 'emType' ). |
|
22513 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emp0001_3Type' method:4. |
|
22514 self assert: isDerived. |
|
22515 |
|
22516 ! |
|
22517 |
|
22518 test_typeinfoisderivedfrom17 |
|
22519 " |
|
22520 Check if emType is derived from emp0001_3Type by any method other than union. |
|
22521 |
|
22522 Creator: Curt Arnold |
|
22523 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22524 " |
|
22525 | |
|
22526 doc "Document" |
|
22527 elemList "NodeList" |
|
22528 elem "Element" |
|
22529 typeInfo "TypeInfo" |
|
22530 isDerived "Boolean" |
|
22531 typeName "String" |
|
22532 | |
|
22533 ^self. "Schema validation not supported" |
|
22534 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22535 elemList := doc getElementsByTagName: 'em'. |
|
22536 elem := elemList item:0. |
|
22537 typeInfo := elem schemaTypeInfo. |
|
22538 self assert: typeInfo notNil. |
|
22539 typeName := typeInfo typeName. |
|
22540 self assert: ( typeName = 'emType' ). |
|
22541 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emp0001_3Type' method:11. |
|
22542 self deny: isDerived. |
|
22543 |
|
22544 ! |
|
22545 |
|
22546 test_typeinfoisderivedfrom18 |
|
22547 " |
|
22548 Check if emType is derived from xsd:ID by restriction. |
|
22549 |
|
22550 Creator: Curt Arnold |
|
22551 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22552 " |
|
22553 | |
|
22554 doc "Document" |
|
22555 elemList "NodeList" |
|
22556 elem "Element" |
|
22557 typeInfo "TypeInfo" |
|
22558 isDerived "Boolean" |
|
22559 typeName "String" |
|
22560 | |
|
22561 ^self. "Schema validation not supported" |
|
22562 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22563 elemList := doc getElementsByTagName: 'em'. |
|
22564 elem := elemList item:0. |
|
22565 typeInfo := elem schemaTypeInfo. |
|
22566 self assert: typeInfo notNil. |
|
22567 typeName := typeInfo typeName. |
|
22568 self assert: ( typeName = 'emType' ). |
|
22569 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'ID' method:1. |
|
22570 self deny: isDerived. |
|
22571 |
|
22572 ! |
|
22573 |
|
22574 test_typeinfoisderivedfrom19 |
|
22575 " |
|
22576 Check emType is derived from anySimpleType by restriction. |
|
22577 |
|
22578 Creator: Curt Arnold |
|
22579 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22580 " |
|
22581 | |
|
22582 doc "Document" |
|
22583 elemList "NodeList" |
|
22584 elem "Element" |
|
22585 typeInfo "TypeInfo" |
|
22586 isDerived "Boolean" |
|
22587 typeName "String" |
|
22588 | |
|
22589 ^self. "Schema validation not supported" |
|
22590 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22591 elemList := doc getElementsByTagName: 'em'. |
|
22592 elem := elemList item:0. |
|
22593 typeInfo := elem schemaTypeInfo. |
|
22594 self assert: typeInfo notNil. |
|
22595 typeName := typeInfo typeName. |
|
22596 self assert: ( typeName = 'emType' ). |
|
22597 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:1. |
|
22598 self assert: isDerived. |
|
22599 |
|
22600 ! |
|
22601 |
|
22602 test_typeinfoisderivedfrom20 |
|
22603 " |
|
22604 Check if emType is derived from anyType by restriction. |
|
22605 |
|
22606 Creator: Curt Arnold |
|
22607 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22608 " |
|
22609 | |
|
22610 doc "Document" |
|
22611 elemList "NodeList" |
|
22612 elem "Element" |
|
22613 typeInfo "TypeInfo" |
|
22614 isDerived "Boolean" |
|
22615 | |
|
22616 ^self. "Schema validation not supported" |
|
22617 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22618 elemList := doc getElementsByTagName: 'em'. |
|
22619 elem := elemList item:0. |
|
22620 typeInfo := elem schemaTypeInfo. |
|
22621 self assert: typeInfo notNil. |
|
22622 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:1. |
|
22623 self assert: isDerived. |
|
22624 |
|
22625 ! |
|
22626 |
|
22627 test_typeinfoisderivedfrom21 |
|
22628 " |
|
22629 Check if emType is derived from itself. |
|
22630 |
|
22631 Creator: Curt Arnold |
|
22632 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22633 " |
|
22634 | |
|
22635 doc "Document" |
|
22636 elemList "NodeList" |
|
22637 elem "Element" |
|
22638 typeInfo "TypeInfo" |
|
22639 isDerived "Boolean" |
|
22640 typeName "String" |
|
22641 | |
|
22642 ^self. "Schema validation not supported" |
|
22643 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22644 elemList := doc getElementsByTagName: 'em'. |
|
22645 elem := elemList item:0. |
|
22646 typeInfo := elem schemaTypeInfo. |
|
22647 self assert: typeInfo notNil. |
|
22648 typeName := typeInfo typeName. |
|
22649 self assert: ( typeName = 'emType' ). |
|
22650 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emType' method:1. |
|
22651 self assert: isDerived. |
|
22652 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emType' method:14. |
|
22653 self deny: isDerived. |
|
22654 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emType' method:0. |
|
22655 self assert: isDerived. |
|
22656 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emType' method:15. |
|
22657 self assert: isDerived. |
|
22658 |
|
22659 ! |
|
22660 |
|
22661 test_typeinfoisderivedfrom22 |
|
22662 " |
|
22663 Check strongType is derived from xsd:string by any method. |
|
22664 |
|
22665 Creator: Curt Arnold |
|
22666 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22667 " |
|
22668 | |
|
22669 doc "Document" |
|
22670 elemList "NodeList" |
|
22671 elem "Element" |
|
22672 typeInfo "TypeInfo" |
|
22673 isDerived "Boolean" |
|
22674 typeName "String" |
|
22675 | |
|
22676 ^self. "Schema validation not supported" |
|
22677 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22678 elemList := doc getElementsByTagName: 'strong'. |
|
22679 elem := elemList item:0. |
|
22680 typeInfo := elem schemaTypeInfo. |
|
22681 self assert: typeInfo notNil. |
|
22682 typeName := typeInfo typeName. |
|
22683 self assert: ( typeName = 'strongType' ). |
|
22684 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:15. |
|
22685 self assert: isDerived. |
|
22686 |
|
22687 ! |
|
22688 |
|
22689 test_typeinfoisderivedfrom23 |
|
22690 " |
|
22691 Check if strongType is derived from xsd:string by list. |
|
22692 |
|
22693 Creator: Curt Arnold |
|
22694 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22695 " |
|
22696 | |
|
22697 doc "Document" |
|
22698 elemList "NodeList" |
|
22699 elem "Element" |
|
22700 typeInfo "TypeInfo" |
|
22701 isDerived "Boolean" |
|
22702 typeName "String" |
|
22703 | |
|
22704 ^self. "Schema validation not supported" |
|
22705 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22706 elemList := doc getElementsByTagName: 'strong'. |
|
22707 elem := elemList item:0. |
|
22708 typeInfo := elem schemaTypeInfo. |
|
22709 self assert: typeInfo notNil. |
|
22710 typeName := typeInfo typeName. |
|
22711 self assert: ( typeName = 'strongType' ). |
|
22712 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:8. |
|
22713 self assert: isDerived. |
|
22714 |
|
22715 ! |
|
22716 |
|
22717 test_typeinfoisderivedfrom24 |
|
22718 " |
|
22719 Check if strongType is derived from xsd:string by any method other than list. |
|
22720 |
|
22721 Creator: Curt Arnold |
|
22722 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22723 " |
|
22724 | |
|
22725 doc "Document" |
|
22726 elemList "NodeList" |
|
22727 elem "Element" |
|
22728 typeInfo "TypeInfo" |
|
22729 isDerived "Boolean" |
|
22730 typeName "String" |
|
22731 | |
|
22732 ^self. "Schema validation not supported" |
|
22733 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22734 elemList := doc getElementsByTagName: 'strong'. |
|
22735 elem := elemList item:0. |
|
22736 typeInfo := elem schemaTypeInfo. |
|
22737 self assert: typeInfo notNil. |
|
22738 typeName := typeInfo typeName. |
|
22739 self assert: ( typeName = 'strongType' ). |
|
22740 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:7. |
|
22741 self deny: isDerived. |
|
22742 |
|
22743 ! |
|
22744 |
|
22745 test_typeinfoisderivedfrom25 |
|
22746 " |
|
22747 Check if strongType is derived from anySimpleType by restriction. |
|
22748 |
|
22749 Creator: Curt Arnold |
|
22750 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22751 " |
|
22752 | |
|
22753 doc "Document" |
|
22754 elemList "NodeList" |
|
22755 elem "Element" |
|
22756 typeInfo "TypeInfo" |
|
22757 isDerived "Boolean" |
|
22758 typeName "String" |
|
22759 | |
|
22760 ^self. "Schema validation not supported" |
|
22761 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22762 elemList := doc getElementsByTagName: 'strong'. |
|
22763 elem := elemList item:0. |
|
22764 typeInfo := elem schemaTypeInfo. |
|
22765 self assert: typeInfo notNil. |
|
22766 typeName := typeInfo typeName. |
|
22767 self assert: ( typeName = 'strongType' ). |
|
22768 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:1. |
|
22769 self assert: isDerived. |
|
22770 |
|
22771 ! |
|
22772 |
|
22773 test_typeinfoisderivedfrom26 |
|
22774 " |
|
22775 Check if strongType is derived from anyType by restriction. |
|
22776 |
|
22777 Creator: Curt Arnold |
|
22778 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22779 " |
|
22780 | |
|
22781 doc "Document" |
|
22782 elemList "NodeList" |
|
22783 elem "Element" |
|
22784 typeInfo "TypeInfo" |
|
22785 isDerived "Boolean" |
|
22786 typeName "String" |
|
22787 | |
|
22788 ^self. "Schema validation not supported" |
|
22789 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22790 elemList := doc getElementsByTagName: 'strong'. |
|
22791 elem := elemList item:0. |
|
22792 typeInfo := elem schemaTypeInfo. |
|
22793 self assert: typeInfo notNil. |
|
22794 typeName := typeInfo typeName. |
|
22795 self assert: ( typeName = 'strongType' ). |
|
22796 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:1. |
|
22797 self assert: isDerived. |
|
22798 |
|
22799 ! |
|
22800 |
|
22801 test_typeinfoisderivedfrom27 |
|
22802 " |
|
22803 Check if strongType is derived from anyType by union or extension. |
|
22804 |
|
22805 Creator: Curt Arnold |
|
22806 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22807 " |
|
22808 | |
|
22809 doc "Document" |
|
22810 elemList "NodeList" |
|
22811 elem "Element" |
|
22812 typeInfo "TypeInfo" |
|
22813 isDerived "Boolean" |
|
22814 typeName "String" |
|
22815 | |
|
22816 ^self. "Schema validation not supported" |
|
22817 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22818 elemList := doc getElementsByTagName: 'strong'. |
|
22819 elem := elemList item:0. |
|
22820 typeInfo := elem schemaTypeInfo. |
|
22821 self assert: typeInfo notNil. |
|
22822 typeName := typeInfo typeName. |
|
22823 self assert: ( typeName = 'strongType' ). |
|
22824 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:6. |
|
22825 self deny: isDerived. |
|
22826 |
|
22827 ! |
|
22828 |
|
22829 test_typeinfoisderivedfrom28 |
|
22830 " |
|
22831 Check how strongType is derived from itself. |
|
22832 |
|
22833 Creator: Curt Arnold |
|
22834 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22835 " |
|
22836 | |
|
22837 doc "Document" |
|
22838 elemList "NodeList" |
|
22839 elem "Element" |
|
22840 typeInfo "TypeInfo" |
|
22841 isDerived "Boolean" |
|
22842 typeName "String" |
|
22843 | |
|
22844 ^self. "Schema validation not supported" |
|
22845 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22846 elemList := doc getElementsByTagName: 'strong'. |
|
22847 elem := elemList item:0. |
|
22848 typeInfo := elem schemaTypeInfo. |
|
22849 self assert: typeInfo notNil. |
|
22850 typeName := typeInfo typeName. |
|
22851 self assert: ( typeName = 'strongType' ). |
|
22852 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'strongType' method:1. |
|
22853 self assert: isDerived. |
|
22854 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'strongType' method:14. |
|
22855 self deny: isDerived. |
|
22856 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'strongType' method:15. |
|
22857 self assert: isDerived. |
|
22858 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'strongType' method:0. |
|
22859 self assert: isDerived. |
|
22860 |
|
22861 ! |
|
22862 |
|
22863 test_typeinfoisderivedfrom29 |
|
22864 " |
|
22865 Check if anonymous type for p element is derived from pType. |
|
22866 |
|
22867 Creator: Curt Arnold |
|
22868 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22869 " |
|
22870 | |
|
22871 doc "Document" |
|
22872 elemList "NodeList" |
|
22873 elem "Element" |
|
22874 typeInfo "TypeInfo" |
|
22875 isDerived "Boolean" |
|
22876 | |
|
22877 ^self. "Schema validation not supported" |
|
22878 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22879 elemList := doc getElementsByTagName: 'p'. |
|
22880 elem := elemList item:0. |
|
22881 typeInfo := elem schemaTypeInfo. |
|
22882 self assert: typeInfo notNil. |
|
22883 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'pType' method:15. |
|
22884 self assert: isDerived. |
|
22885 |
|
22886 ! |
|
22887 |
|
22888 test_typeinfoisderivedfrom30 |
|
22889 " |
|
22890 Check if anonymous type for p element is derived from pType by restriction. |
|
22891 |
|
22892 Creator: Curt Arnold |
|
22893 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22894 " |
|
22895 | |
|
22896 doc "Document" |
|
22897 elemList "NodeList" |
|
22898 elem "Element" |
|
22899 typeInfo "TypeInfo" |
|
22900 isDerived "Boolean" |
|
22901 | |
|
22902 ^self. "Schema validation not supported" |
|
22903 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22904 elemList := doc getElementsByTagName: 'p'. |
|
22905 elem := elemList item:0. |
|
22906 typeInfo := elem schemaTypeInfo. |
|
22907 self assert: typeInfo notNil. |
|
22908 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'pType' method:1. |
|
22909 self assert: isDerived. |
|
22910 |
|
22911 ! |
|
22912 |
|
22913 test_typeinfoisderivedfrom31 |
|
22914 " |
|
22915 Check anonymous type for p element is derived from pType by any method other than restriction. |
|
22916 |
|
22917 Creator: Curt Arnold |
|
22918 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22919 " |
|
22920 | |
|
22921 doc "Document" |
|
22922 elemList "NodeList" |
|
22923 elem "Element" |
|
22924 typeInfo "TypeInfo" |
|
22925 isDerived "Boolean" |
|
22926 | |
|
22927 ^self. "Schema validation not supported" |
|
22928 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22929 elemList := doc getElementsByTagName: 'p'. |
|
22930 elem := elemList item:0. |
|
22931 typeInfo := elem schemaTypeInfo. |
|
22932 self assert: typeInfo notNil. |
|
22933 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'pType' method:14. |
|
22934 self deny: isDerived. |
|
22935 |
|
22936 ! |
|
22937 |
|
22938 test_typeinfoisderivedfrom32 |
|
22939 " |
|
22940 Check if anonymous type of p element is derived from part1. |
|
22941 |
|
22942 Creator: Curt Arnold |
|
22943 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22944 " |
|
22945 | |
|
22946 doc "Document" |
|
22947 elemList "NodeList" |
|
22948 elem "Element" |
|
22949 typeInfo "TypeInfo" |
|
22950 isDerived "Boolean" |
|
22951 | |
|
22952 ^self. "Schema validation not supported" |
|
22953 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22954 elemList := doc getElementsByTagName: 'p'. |
|
22955 elem := elemList item:0. |
|
22956 typeInfo := elem schemaTypeInfo. |
|
22957 self assert: typeInfo notNil. |
|
22958 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'part1' method:15. |
|
22959 self assert: isDerived. |
|
22960 |
|
22961 ! |
|
22962 |
|
22963 test_typeinfoisderivedfrom33 |
|
22964 " |
|
22965 Check is anonymous type of p element is derived by extension from part1. |
|
22966 |
|
22967 Creator: Curt Arnold |
|
22968 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22969 " |
|
22970 | |
|
22971 doc "Document" |
|
22972 elemList "NodeList" |
|
22973 elem "Element" |
|
22974 typeInfo "TypeInfo" |
|
22975 isDerived "Boolean" |
|
22976 | |
|
22977 ^self. "Schema validation not supported" |
|
22978 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
22979 elemList := doc getElementsByTagName: 'p'. |
|
22980 elem := elemList item:0. |
|
22981 typeInfo := elem schemaTypeInfo. |
|
22982 self assert: typeInfo notNil. |
|
22983 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'part1' method:2. |
|
22984 self assert: isDerived. |
|
22985 |
|
22986 ! |
|
22987 |
|
22988 test_typeinfoisderivedfrom34 |
|
22989 " |
|
22990 Check if anonymous type of p element is derived from part1 by any method other than extension. |
|
22991 |
|
22992 Creator: Curt Arnold |
|
22993 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
22994 " |
|
22995 | |
|
22996 doc "Document" |
|
22997 elemList "NodeList" |
|
22998 elem "Element" |
|
22999 typeInfo "TypeInfo" |
|
23000 isDerived "Boolean" |
|
23001 | |
|
23002 ^self. "Schema validation not supported" |
|
23003 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23004 elemList := doc getElementsByTagName: 'p'. |
|
23005 elem := elemList item:0. |
|
23006 typeInfo := elem schemaTypeInfo. |
|
23007 self assert: typeInfo notNil. |
|
23008 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'part1' method:13. |
|
23009 self deny: isDerived. |
|
23010 |
|
23011 ! |
|
23012 |
|
23013 test_typeinfoisderivedfrom35 |
|
23014 " |
|
23015 Check if anonymous type of p element is derived from xsd:simpleType. |
|
23016 |
|
23017 Creator: Curt Arnold |
|
23018 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23019 " |
|
23020 | |
|
23021 doc "Document" |
|
23022 elemList "NodeList" |
|
23023 elem "Element" |
|
23024 typeInfo "TypeInfo" |
|
23025 isDerived "Boolean" |
|
23026 | |
|
23027 ^self. "Schema validation not supported" |
|
23028 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23029 elemList := doc getElementsByTagName: 'p'. |
|
23030 elem := elemList item:0. |
|
23031 typeInfo := elem schemaTypeInfo. |
|
23032 self assert: typeInfo notNil. |
|
23033 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:15. |
|
23034 self deny: isDerived. |
|
23035 |
|
23036 ! |
|
23037 |
|
23038 test_typeinfoisderivedfrom36 |
|
23039 " |
|
23040 Check if anonymous type of p element is derived from xsd:anyType. |
|
23041 |
|
23042 Creator: Curt Arnold |
|
23043 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23044 " |
|
23045 | |
|
23046 doc "Document" |
|
23047 elemList "NodeList" |
|
23048 elem "Element" |
|
23049 typeInfo "TypeInfo" |
|
23050 isDerived "Boolean" |
|
23051 | |
|
23052 ^self. "Schema validation not supported" |
|
23053 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23054 elemList := doc getElementsByTagName: 'p'. |
|
23055 elem := elemList item:0. |
|
23056 typeInfo := elem schemaTypeInfo. |
|
23057 self assert: typeInfo notNil. |
|
23058 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:15. |
|
23059 self assert: isDerived. |
|
23060 |
|
23061 ! |
|
23062 |
|
23063 test_typeinfoisderivedfrom37 |
|
23064 " |
|
23065 Check if anonymous type of p element is derived from xsd:anyType by restriction. |
|
23066 |
|
23067 Creator: Curt Arnold |
|
23068 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23069 " |
|
23070 | |
|
23071 doc "Document" |
|
23072 elemList "NodeList" |
|
23073 elem "Element" |
|
23074 typeInfo "TypeInfo" |
|
23075 isDerived "Boolean" |
|
23076 | |
|
23077 ^self. "Schema validation not supported" |
|
23078 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23079 elemList := doc getElementsByTagName: 'p'. |
|
23080 elem := elemList item:0. |
|
23081 typeInfo := elem schemaTypeInfo. |
|
23082 self assert: typeInfo notNil. |
|
23083 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:1. |
|
23084 self deny: isDerived. |
|
23085 |
|
23086 ! |
|
23087 |
|
23088 test_typeinfoisderivedfrom38 |
|
23089 " |
|
23090 Check if anonymous type of p element is derived from xsd:anyType by any method other |
|
23091 than extension. |
|
23092 |
|
23093 Creator: Curt Arnold |
|
23094 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23095 " |
|
23096 | |
|
23097 doc "Document" |
|
23098 elemList "NodeList" |
|
23099 elem "Element" |
|
23100 typeInfo "TypeInfo" |
|
23101 isDerived "Boolean" |
|
23102 | |
|
23103 ^self. "Schema validation not supported" |
|
23104 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23105 elemList := doc getElementsByTagName: 'p'. |
|
23106 elem := elemList item:0. |
|
23107 typeInfo := elem schemaTypeInfo. |
|
23108 self assert: typeInfo notNil. |
|
23109 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:13. |
|
23110 self deny: isDerived. |
|
23111 |
|
23112 ! |
|
23113 |
|
23114 test_typeinfoisderivedfrom39 |
|
23115 " |
|
23116 Check if anonymous type of p element derives from itself. |
|
23117 |
|
23118 Creator: Curt Arnold |
|
23119 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23120 " |
|
23121 | |
|
23122 doc "Document" |
|
23123 elemList "NodeList" |
|
23124 elem "Element" |
|
23125 typeInfo "TypeInfo" |
|
23126 isDerived "Boolean" |
|
23127 typeName "String" |
|
23128 typeNS "String" |
|
23129 | |
|
23130 ^self. "Schema validation not supported" |
|
23131 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23132 elemList := doc getElementsByTagName: 'p'. |
|
23133 elem := elemList item:0. |
|
23134 typeInfo := elem schemaTypeInfo. |
|
23135 self assert: typeInfo notNil. |
|
23136 typeName := typeInfo typeName. |
|
23137 typeNS := typeInfo typeNamespace. |
|
23138 isDerived := typeInfo isDerivedFromNS:typeNS name:typeName method:15. |
|
23139 self deny: isDerived. |
|
23140 |
|
23141 ! |
|
23142 |
|
23143 test_typeinfoisderivedfrom40 |
|
23144 " |
|
23145 Check if emType is derived from xsd:ID by union. |
|
23146 |
|
23147 Creator: Curt Arnold |
|
23148 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23149 " |
|
23150 | |
|
23151 doc "Document" |
|
23152 elemList "NodeList" |
|
23153 elem "Element" |
|
23154 typeInfo "TypeInfo" |
|
23155 isDerived "Boolean" |
|
23156 typeName "String" |
|
23157 | |
|
23158 ^self. "Schema validation not supported" |
|
23159 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23160 elemList := doc getElementsByTagName: 'em'. |
|
23161 elem := elemList item:0. |
|
23162 typeInfo := elem schemaTypeInfo. |
|
23163 self assert: typeInfo notNil. |
|
23164 typeName := typeInfo typeName. |
|
23165 self assert: ( typeName = 'emType' ). |
|
23166 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'ID' method:4. |
|
23167 self assert: isDerived. |
|
23168 |
|
23169 ! |
|
23170 |
|
23171 test_typeinfoisderivedfrom41 |
|
23172 " |
|
23173 Check if emType is derived from xsd:ID by any method other than union or restriction. |
|
23174 |
|
23175 Creator: Curt Arnold |
|
23176 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23177 " |
|
23178 | |
|
23179 doc "Document" |
|
23180 elemList "NodeList" |
|
23181 elem "Element" |
|
23182 typeInfo "TypeInfo" |
|
23183 isDerived "Boolean" |
|
23184 typeName "String" |
|
23185 | |
|
23186 ^self. "Schema validation not supported" |
|
23187 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23188 elemList := doc getElementsByTagName: 'em'. |
|
23189 elem := elemList item:0. |
|
23190 typeInfo := elem schemaTypeInfo. |
|
23191 self assert: typeInfo notNil. |
|
23192 typeName := typeInfo typeName. |
|
23193 self assert: ( typeName = 'emType' ). |
|
23194 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'ID' method:10. |
|
23195 self deny: isDerived. |
|
23196 |
|
23197 ! |
|
23198 |
|
23199 test_typeinfoisderivedfrom42 |
|
23200 " |
|
23201 Check if strongType is derived from anySimpleType by list. |
|
23202 |
|
23203 Creator: Curt Arnold |
|
23204 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23205 " |
|
23206 | |
|
23207 doc "Document" |
|
23208 elemList "NodeList" |
|
23209 elem "Element" |
|
23210 typeInfo "TypeInfo" |
|
23211 isDerived "Boolean" |
|
23212 typeName "String" |
|
23213 | |
|
23214 ^self. "Schema validation not supported" |
|
23215 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23216 elemList := doc getElementsByTagName: 'strong'. |
|
23217 elem := elemList item:0. |
|
23218 typeInfo := elem schemaTypeInfo. |
|
23219 self assert: typeInfo notNil. |
|
23220 typeName := typeInfo typeName. |
|
23221 self assert: ( typeName = 'strongType' ). |
|
23222 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:8. |
|
23223 self assert: isDerived. |
|
23224 |
|
23225 ! |
|
23226 |
|
23227 test_typeinfoisderivedfrom43 |
|
23228 " |
|
23229 Check if anonymous type of acronym element derived from anyType by restriction. |
|
23230 |
|
23231 Creator: Curt Arnold |
|
23232 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23233 " |
|
23234 | |
|
23235 doc "Document" |
|
23236 elemList "NodeList" |
|
23237 acronymElem "Element" |
|
23238 attr "Attr" |
|
23239 elem "Element" |
|
23240 elemName "String" |
|
23241 typeInfo "TypeInfo" |
|
23242 isDerived "Boolean" |
|
23243 | |
|
23244 ^self. "Schema validation not supported" |
|
23245 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23246 elemList := doc getElementsByTagName: 'acronym'. |
|
23247 acronymElem := elemList item:2. |
|
23248 typeInfo := acronymElem schemaTypeInfo. |
|
23249 self assert: typeInfo notNil. |
|
23250 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:1. |
|
23251 self deny: isDerived. |
|
23252 |
|
23253 ! |
|
23254 |
|
23255 test_typeinfoisderivedfrom44 |
|
23256 " |
|
23257 Check if anonymous type of acronym element derived from anyType by any method other than extension. |
|
23258 |
|
23259 Creator: Curt Arnold |
|
23260 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23261 " |
|
23262 | |
|
23263 doc "Document" |
|
23264 elemList "NodeList" |
|
23265 acronymElem "Element" |
|
23266 attr "Attr" |
|
23267 elem "Element" |
|
23268 elemName "String" |
|
23269 typeInfo "TypeInfo" |
|
23270 isDerived "Boolean" |
|
23271 | |
|
23272 ^self. "Schema validation not supported" |
|
23273 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23274 elemList := doc getElementsByTagName: 'acronym'. |
|
23275 acronymElem := elemList item:2. |
|
23276 typeInfo := acronymElem schemaTypeInfo. |
|
23277 self assert: typeInfo notNil. |
|
23278 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:13. |
|
23279 self deny: isDerived. |
|
23280 |
|
23281 ! |
|
23282 |
|
23283 test_typeinfoisderivedfrom45 |
|
23284 " |
|
23285 Check if anonymous type of acronym element derived from anySimpleType by extension. |
|
23286 |
|
23287 Creator: Curt Arnold |
|
23288 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23289 " |
|
23290 | |
|
23291 doc "Document" |
|
23292 elemList "NodeList" |
|
23293 acronymElem "Element" |
|
23294 attr "Attr" |
|
23295 elem "Element" |
|
23296 elemName "String" |
|
23297 typeInfo "TypeInfo" |
|
23298 isDerived "Boolean" |
|
23299 | |
|
23300 ^self. "Schema validation not supported" |
|
23301 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23302 elemList := doc getElementsByTagName: 'acronym'. |
|
23303 acronymElem := elemList item:2. |
|
23304 typeInfo := acronymElem schemaTypeInfo. |
|
23305 self assert: typeInfo notNil. |
|
23306 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:2. |
|
23307 self assert: isDerived. |
|
23308 |
|
23309 ! |
|
23310 |
|
23311 test_typeinfoisderivedfrom46 |
|
23312 " |
|
23313 Check if anonymous type of acronym element derived from anySimpleType by any method other than extension. |
|
23314 |
|
23315 Creator: Curt Arnold |
|
23316 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23317 " |
|
23318 | |
|
23319 doc "Document" |
|
23320 elemList "NodeList" |
|
23321 acronymElem "Element" |
|
23322 attr "Attr" |
|
23323 elem "Element" |
|
23324 elemName "String" |
|
23325 typeInfo "TypeInfo" |
|
23326 isDerived "Boolean" |
|
23327 | |
|
23328 ^self. "Schema validation not supported" |
|
23329 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23330 elemList := doc getElementsByTagName: 'acronym'. |
|
23331 acronymElem := elemList item:2. |
|
23332 typeInfo := acronymElem schemaTypeInfo. |
|
23333 self assert: typeInfo notNil. |
|
23334 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:13. |
|
23335 self deny: isDerived. |
|
23336 |
|
23337 ! |
|
23338 |
|
23339 test_typeinfoisderivedfrom47 |
|
23340 " |
|
23341 Check if anonymous type of acronym element derived from xsd:string by extension. |
|
23342 |
|
23343 Creator: Curt Arnold |
|
23344 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23345 " |
|
23346 | |
|
23347 doc "Document" |
|
23348 elemList "NodeList" |
|
23349 acronymElem "Element" |
|
23350 attr "Attr" |
|
23351 elem "Element" |
|
23352 elemName "String" |
|
23353 typeInfo "TypeInfo" |
|
23354 isDerived "Boolean" |
|
23355 | |
|
23356 ^self. "Schema validation not supported" |
|
23357 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23358 elemList := doc getElementsByTagName: 'acronym'. |
|
23359 acronymElem := elemList item:2. |
|
23360 typeInfo := acronymElem schemaTypeInfo. |
|
23361 self assert: typeInfo notNil. |
|
23362 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:2. |
|
23363 self assert: isDerived. |
|
23364 |
|
23365 ! |
|
23366 |
|
23367 test_typeinfoisderivedfrom48 |
|
23368 " |
|
23369 Check if anonymous type of acronym element derived from xsd:string by any method other than extension. |
|
23370 |
|
23371 Creator: Curt Arnold |
|
23372 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23373 " |
|
23374 | |
|
23375 doc "Document" |
|
23376 elemList "NodeList" |
|
23377 acronymElem "Element" |
|
23378 attr "Attr" |
|
23379 elem "Element" |
|
23380 elemName "String" |
|
23381 typeInfo "TypeInfo" |
|
23382 isDerived "Boolean" |
|
23383 | |
|
23384 ^self. "Schema validation not supported" |
|
23385 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23386 elemList := doc getElementsByTagName: 'acronym'. |
|
23387 acronymElem := elemList item:2. |
|
23388 typeInfo := acronymElem schemaTypeInfo. |
|
23389 self assert: typeInfo notNil. |
|
23390 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:13. |
|
23391 self deny: isDerived. |
|
23392 |
|
23393 ! |
|
23394 |
|
23395 test_typeinfoisderivedfrom49 |
|
23396 " |
|
23397 Check if a type derived by extension from a list of a item type returns true |
|
23398 when asked if it derives by list from the item type. |
|
23399 |
|
23400 Creator: Curt Arnold |
|
23401 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23402 " |
|
23403 | |
|
23404 doc "Document" |
|
23405 elemList "NodeList" |
|
23406 elem "Element" |
|
23407 typeInfo "TypeInfo" |
|
23408 isDerived "Boolean" |
|
23409 | |
|
23410 ^self. "Schema validation not supported" |
|
23411 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23412 elemList := doc getElementsByTagName: 'acronym'. |
|
23413 elem := elemList item:0. |
|
23414 typeInfo := elem schemaTypeInfo. |
|
23415 self assert: typeInfo notNil. |
|
23416 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'double' method:8. |
|
23417 self assert: isDerived. |
|
23418 |
|
23419 ! |
|
23420 |
|
23421 test_typeinfoisderivedfrom50 |
|
23422 " |
|
23423 Check if a type derived by extension from a list of a item type returns true |
|
23424 when asked if it derives by any method from the item type. |
|
23425 |
|
23426 Creator: Curt Arnold |
|
23427 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23428 " |
|
23429 | |
|
23430 doc "Document" |
|
23431 elemList "NodeList" |
|
23432 elem "Element" |
|
23433 typeInfo "TypeInfo" |
|
23434 isDerived "Boolean" |
|
23435 | |
|
23436 ^self. "Schema validation not supported" |
|
23437 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23438 elemList := doc getElementsByTagName: 'acronym'. |
|
23439 elem := elemList item:0. |
|
23440 typeInfo := elem schemaTypeInfo. |
|
23441 self assert: typeInfo notNil. |
|
23442 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'double' method:0. |
|
23443 self assert: isDerived. |
|
23444 |
|
23445 ! |
|
23446 |
|
23447 test_typeinfoisderivedfrom51 |
|
23448 " |
|
23449 Check if a type derived by extension from a list of a item type returns false |
|
23450 when asked if it derives by any method other than list from the item type. |
|
23451 |
|
23452 Creator: Curt Arnold |
|
23453 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23454 " |
|
23455 | |
|
23456 doc "Document" |
|
23457 elemList "NodeList" |
|
23458 elem "Element" |
|
23459 typeInfo "TypeInfo" |
|
23460 isDerived "Boolean" |
|
23461 | |
|
23462 ^self. "Schema validation not supported" |
|
23463 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23464 elemList := doc getElementsByTagName: 'acronym'. |
|
23465 elem := elemList item:0. |
|
23466 typeInfo := elem schemaTypeInfo. |
|
23467 self assert: typeInfo notNil. |
|
23468 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'double' method:7. |
|
23469 self deny: isDerived. |
|
23470 |
|
23471 ! |
|
23472 |
|
23473 test_typeinfoisderivedfrom52 |
|
23474 " |
|
23475 Check if a type derived by extension from a list of a item type returns false |
|
23476 when asked if it derives by restriction from anySimpleType type. |
|
23477 |
|
23478 Creator: Curt Arnold |
|
23479 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23480 " |
|
23481 | |
|
23482 doc "Document" |
|
23483 elemList "NodeList" |
|
23484 elem "Element" |
|
23485 typeInfo "TypeInfo" |
|
23486 isDerived "Boolean" |
|
23487 | |
|
23488 ^self. "Schema validation not supported" |
|
23489 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23490 elemList := doc getElementsByTagName: 'acronym'. |
|
23491 elem := elemList item:0. |
|
23492 typeInfo := elem schemaTypeInfo. |
|
23493 self assert: typeInfo notNil. |
|
23494 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:1. |
|
23495 self deny: isDerived. |
|
23496 |
|
23497 ! |
|
23498 |
|
23499 test_typeinfoisderivedfrom53 |
|
23500 " |
|
23501 Check if a type derived by extension from a list of a item type returns true |
|
23502 when asked if it derives by extension from anySimpleType. |
|
23503 |
|
23504 Creator: Curt Arnold |
|
23505 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23506 " |
|
23507 | |
|
23508 doc "Document" |
|
23509 elemList "NodeList" |
|
23510 elem "Element" |
|
23511 typeInfo "TypeInfo" |
|
23512 isDerived "Boolean" |
|
23513 | |
|
23514 ^self. "Schema validation not supported" |
|
23515 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23516 elemList := doc getElementsByTagName: 'acronym'. |
|
23517 elem := elemList item:0. |
|
23518 typeInfo := elem schemaTypeInfo. |
|
23519 self assert: typeInfo notNil. |
|
23520 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:2. |
|
23521 self assert: isDerived. |
|
23522 |
|
23523 ! |
|
23524 |
|
23525 test_typeinfoisderivedfrom54 |
|
23526 " |
|
23527 Check if a type derived by extension from a list of a item type returns true |
|
23528 when asked if it derives by list from anySimpleType. |
|
23529 |
|
23530 Creator: Curt Arnold |
|
23531 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23532 " |
|
23533 | |
|
23534 doc "Document" |
|
23535 elemList "NodeList" |
|
23536 elem "Element" |
|
23537 typeInfo "TypeInfo" |
|
23538 isDerived "Boolean" |
|
23539 | |
|
23540 ^self. "Schema validation not supported" |
|
23541 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23542 elemList := doc getElementsByTagName: 'acronym'. |
|
23543 elem := elemList item:0. |
|
23544 typeInfo := elem schemaTypeInfo. |
|
23545 self assert: typeInfo notNil. |
|
23546 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anySimpleType' method:8. |
|
23547 self assert: isDerived. |
|
23548 |
|
23549 ! |
|
23550 |
|
23551 test_typeinfoisderivedfrom55 |
|
23552 " |
|
23553 Check if a type derived by extension from a list of a item type returns true |
|
23554 when asked if it derives by extension from anyType type. |
|
23555 |
|
23556 Creator: Curt Arnold |
|
23557 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23558 " |
|
23559 | |
|
23560 doc "Document" |
|
23561 elemList "NodeList" |
|
23562 elem "Element" |
|
23563 typeInfo "TypeInfo" |
|
23564 isDerived "Boolean" |
|
23565 | |
|
23566 ^self. "Schema validation not supported" |
|
23567 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23568 elemList := doc getElementsByTagName: 'acronym'. |
|
23569 elem := elemList item:0. |
|
23570 typeInfo := elem schemaTypeInfo. |
|
23571 self assert: typeInfo notNil. |
|
23572 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:2. |
|
23573 self assert: isDerived. |
|
23574 |
|
23575 ! |
|
23576 |
|
23577 test_typeinfoisderivedfrom56 |
|
23578 " |
|
23579 Check if a type derived by extension from a list of a item type returns true |
|
23580 when asked if it derives by extension from anyType. |
|
23581 |
|
23582 Creator: Curt Arnold |
|
23583 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23584 " |
|
23585 | |
|
23586 doc "Document" |
|
23587 elemList "NodeList" |
|
23588 elem "Element" |
|
23589 typeInfo "TypeInfo" |
|
23590 isDerived "Boolean" |
|
23591 | |
|
23592 ^self. "Schema validation not supported" |
|
23593 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23594 elemList := doc getElementsByTagName: 'acronym'. |
|
23595 elem := elemList item:0. |
|
23596 typeInfo := elem schemaTypeInfo. |
|
23597 self assert: typeInfo notNil. |
|
23598 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:2. |
|
23599 self assert: isDerived. |
|
23600 |
|
23601 ! |
|
23602 |
|
23603 test_typeinfoisderivedfrom57 |
|
23604 " |
|
23605 Check if a type derived by extension from a list of a item type returns true |
|
23606 when asked if it derives by list from anyType. |
|
23607 |
|
23608 Creator: Curt Arnold |
|
23609 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23610 " |
|
23611 | |
|
23612 doc "Document" |
|
23613 elemList "NodeList" |
|
23614 elem "Element" |
|
23615 typeInfo "TypeInfo" |
|
23616 isDerived "Boolean" |
|
23617 | |
|
23618 ^self. "Schema validation not supported" |
|
23619 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23620 elemList := doc getElementsByTagName: 'acronym'. |
|
23621 elem := elemList item:0. |
|
23622 typeInfo := elem schemaTypeInfo. |
|
23623 self assert: typeInfo notNil. |
|
23624 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'anyType' method:8. |
|
23625 self assert: isDerived. |
|
23626 |
|
23627 ! |
|
23628 |
|
23629 test_typeinfoisderivedfrom58 |
|
23630 " |
|
23631 Check if a type derived by extension from a union returns true |
|
23632 when asked if it derives by union from a member type of the union. |
|
23633 |
|
23634 Creator: Curt Arnold |
|
23635 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23636 " |
|
23637 | |
|
23638 doc "Document" |
|
23639 elemList "NodeList" |
|
23640 codeElem "Element" |
|
23641 attr "Attr" |
|
23642 typeInfo "TypeInfo" |
|
23643 isDerived "Boolean" |
|
23644 | |
|
23645 ^self. "Schema validation not supported" |
|
23646 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23647 elemList := doc getElementsByTagName: 'code'. |
|
23648 codeElem := elemList item:0. |
|
23649 typeInfo := codeElem schemaTypeInfo. |
|
23650 self assert: typeInfo notNil. |
|
23651 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'unbounded' method:4. |
|
23652 self assert: isDerived. |
|
23653 |
|
23654 ! |
|
23655 |
|
23656 test_typeinfoisderivedfrom59 |
|
23657 " |
|
23658 Check if a type derived by extension from a union returns true |
|
23659 when asked if it derives by union from a restricted base of |
|
23660 a member of type union. |
|
23661 |
|
23662 Creator: Curt Arnold |
|
23663 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23664 " |
|
23665 | |
|
23666 doc "Document" |
|
23667 elemList "NodeList" |
|
23668 codeElem "Element" |
|
23669 attr "Attr" |
|
23670 elem "Element" |
|
23671 elemName "String" |
|
23672 typeInfo "TypeInfo" |
|
23673 isDerived "Boolean" |
|
23674 | |
|
23675 ^self. "Schema validation not supported" |
|
23676 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23677 elemList := doc getElementsByTagName: 'code'. |
|
23678 codeElem := elemList item:0. |
|
23679 typeInfo := codeElem schemaTypeInfo. |
|
23680 self assert: typeInfo notNil. |
|
23681 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'integer' method:4. |
|
23682 self assert: isDerived. |
|
23683 |
|
23684 ! |
|
23685 |
|
23686 test_typeinfoisderivedfrom60 |
|
23687 " |
|
23688 Check if xs:IDREFS is derived by list from xs:IDREF. |
|
23689 |
|
23690 Creator: Curt Arnold |
|
23691 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23692 " |
|
23693 | |
|
23694 doc "Document" |
|
23695 elemList "NodeList" |
|
23696 elem "Element" |
|
23697 attr "Attr" |
|
23698 typeInfo "TypeInfo" |
|
23699 isDerived "Boolean" |
|
23700 | |
|
23701 ^self. "Schema validation not supported" |
|
23702 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23703 elemList := doc getElementsByTagName: 'strong'. |
|
23704 elem := elemList item:0. |
|
23705 typeInfo := elem schemaTypeInfo. |
|
23706 self assert: typeInfo notNil. |
|
23707 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'IDREF' method:8. |
|
23708 self assert: isDerived. |
|
23709 |
|
23710 ! |
|
23711 |
|
23712 test_typeinfoisderivedfrom61 |
|
23713 " |
|
23714 Check if xs:byte is derived by restriction from xs:short |
|
23715 Creator: Curt Arnold |
|
23716 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23717 " |
|
23718 | |
|
23719 doc "Document" |
|
23720 elemList "NodeList" |
|
23721 elem "Element" |
|
23722 typeInfo "TypeInfo" |
|
23723 isDerived "Boolean" |
|
23724 | |
|
23725 ^self. "Schema validation not supported" |
|
23726 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23727 elemList := doc getElementsByTagName: 'em'. |
|
23728 elem := elemList item:0. |
|
23729 typeInfo := elem schemaTypeInfo. |
|
23730 self assert: typeInfo notNil. |
|
23731 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'short' method:1. |
|
23732 self assert: isDerived. |
|
23733 |
|
23734 ! |
|
23735 |
|
23736 test_typeinfoisderivedfrom62 |
|
23737 " |
|
23738 Check if xs:byte is derived by restriction from xs:decimal |
|
23739 Creator: Curt Arnold |
|
23740 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23741 " |
|
23742 | |
|
23743 doc "Document" |
|
23744 elemList "NodeList" |
|
23745 elem "Element" |
|
23746 typeInfo "TypeInfo" |
|
23747 isDerived "Boolean" |
|
23748 | |
|
23749 ^self. "Schema validation not supported" |
|
23750 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'typeinfo'). |
|
23751 elemList := doc getElementsByTagName: 'em'. |
|
23752 elem := elemList item:0. |
|
23753 typeInfo := elem schemaTypeInfo. |
|
23754 self assert: typeInfo notNil. |
|
23755 isDerived := typeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'decimal' method:1. |
|
23756 self assert: isDerived. |
|
23757 |
|
23758 ! |
|
23759 |
|
23760 test_typeinfoisderivedfrom63 |
|
23761 " |
|
23762 The isDerivedFrom method checks if this TypeInfo derives from the specified ancestor type. |
|
23763 If the document's schema is a DTD or no schema is associated with the document, this method |
|
23764 will always return false. |
|
23765 |
|
23766 Get schemaTypeInfo on an element that belongs to a document with an XML DTD. Invoke method |
|
23767 isDerivedFrom and verify that returned the typeNamespace is null. |
|
23768 |
|
23769 Creator: IBM |
|
23770 Autor Jenny Hsu |
|
23771 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23772 " |
|
23773 | |
|
23774 doc "Document" |
|
23775 elemList "NodeList" |
|
23776 acronymElem "Element" |
|
23777 retValue "Boolean" |
|
23778 typeNamespace "String" |
|
23779 nullName "String" |
|
23780 elemTypeInfo "TypeInfo" |
|
23781 | |
|
23782 ^self. "Validation not supported" |
|
23783 nullName := nil. |
|
23784 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23785 elemList := doc getElementsByTagName: 'acronym'. |
|
23786 acronymElem := elemList item:0. |
|
23787 elemTypeInfo := acronymElem schemaTypeInfo. |
|
23788 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/TR/REC-xml' name:nullName method:0. |
|
23789 self deny: retValue. |
|
23790 |
|
23791 ! |
|
23792 |
|
23793 test_typeinfoisderivedfrom64 |
|
23794 " |
|
23795 Check that the simpleType of an attributes derives by restriction from itself |
|
23796 and from its base type. |
|
23797 |
|
23798 Creator: IBM |
|
23799 Autor Jenny Hsu |
|
23800 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23801 " |
|
23802 | |
|
23803 doc "Document" |
|
23804 docElem "Element" |
|
23805 elemList "NodeList" |
|
23806 acElem "Element" |
|
23807 classAttr "Attr" |
|
23808 attrTypeInfo "TypeInfo" |
|
23809 typeName "String" |
|
23810 retValue "Boolean" |
|
23811 | |
|
23812 ^self. "Schema validation not supported" |
|
23813 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23814 elemList := doc getElementsByTagName: 'acronym'. |
|
23815 acElem := elemList item:1. |
|
23816 classAttr := acElem getAttributeNode:'class'. |
|
23817 attrTypeInfo := classAttr schemaTypeInfo. |
|
23818 retValue := attrTypeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'classType' method:1. |
|
23819 self assert: retValue. |
|
23820 retValue := attrTypeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:1. |
|
23821 self assert: retValue. |
|
23822 |
|
23823 ! |
|
23824 |
|
23825 test_typeinfoisderivedfrom65 |
|
23826 " |
|
23827 The isDerivedFrom method checks if this TypeInfo derives from the specified ancestor type. |
|
23828 |
|
23829 Get schemaTypeInfo on a simple type attribute that belongs to a document with an XML schema. |
|
23830 Invoke method isDerivedFrom with derivation method list and verify that the value returned is true. |
|
23831 |
|
23832 Creator: IBM |
|
23833 Autor Jenny Hsu |
|
23834 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23835 " |
|
23836 | |
|
23837 doc "Document" |
|
23838 docElem "Element" |
|
23839 elemTypeInfo "Element" |
|
23840 elemList "NodeList" |
|
23841 strongElem "Element" |
|
23842 attrTypeInfo "TypeInfo" |
|
23843 typeName "String" |
|
23844 retValue "Boolean" |
|
23845 | |
|
23846 ^self. "Schema validation not supported" |
|
23847 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23848 elemList := doc getElementsByTagName: 'strong'. |
|
23849 strongElem := elemList item:0. |
|
23850 elemTypeInfo := strongElem schemaTypeInfo. |
|
23851 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:8. |
|
23852 self assert: retValue. |
|
23853 |
|
23854 ! |
|
23855 |
|
23856 test_typeinfoisderivedfrom66 |
|
23857 " |
|
23858 The isDerivedFrom method checks if this TypeInfo derives from the specified ancestor type. |
|
23859 |
|
23860 Get schemaTypeInfo on an element of type Union that belongs to a document with an XML schema. |
|
23861 Invoke method isDerivedFrom with derivation method union and verify that the value returned is true. |
|
23862 Verify that emType is derived from emp0004_5Type by union. |
|
23863 |
|
23864 |
|
23865 Creator: IBM |
|
23866 Autor Jenny Hsu |
|
23867 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23868 " |
|
23869 | |
|
23870 doc "Document" |
|
23871 unionElem "Element" |
|
23872 elemTypeInfo "TypeInfo" |
|
23873 typeName "String" |
|
23874 elemList "NodeList" |
|
23875 retValue "Boolean" |
|
23876 | |
|
23877 ^self. "Schema validation not supported" |
|
23878 ^self. "Validation not supported" |
|
23879 "implementationAttribute not supported: namespaceAware" |
|
23880 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23881 elemList := doc getElementsByTagName: 'em'. |
|
23882 unionElem := elemList item:0. |
|
23883 elemTypeInfo := unionElem schemaTypeInfo. |
|
23884 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emp0004_5Type' method:0. |
|
23885 self assert: retValue. |
|
23886 |
|
23887 ! |
|
23888 |
|
23889 test_typeinfoisderivedfrom67 |
|
23890 " |
|
23891 Checks that isDerivedFrom(...,METHOD_UNION) returns true when there |
|
23892 are multiple union derivation steps between the target and |
|
23893 ancestor type. |
|
23894 |
|
23895 Creator: Curt Arnold |
|
23896 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23897 " |
|
23898 | |
|
23899 doc "Document" |
|
23900 elem "Element" |
|
23901 elemTypeInfo "TypeInfo" |
|
23902 typeName "String" |
|
23903 elemList "NodeList" |
|
23904 retValue "Boolean" |
|
23905 | |
|
23906 ^self. "Schema validation not supported" |
|
23907 ^self. "Validation not supported" |
|
23908 "implementationAttribute not supported: namespaceAware" |
|
23909 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23910 elemList := doc getElementsByTagName: 'sup'. |
|
23911 elem := elemList item:0. |
|
23912 elemTypeInfo := elem schemaTypeInfo. |
|
23913 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emp0004_5Type' method:4. |
|
23914 self assert: retValue. |
|
23915 |
|
23916 ! |
|
23917 |
|
23918 test_typeinfoisderivedfrom68 |
|
23919 " |
|
23920 Checks that isDerivedFrom(...,0) returns true when there |
|
23921 is more than one union derivation steps between the target and |
|
23922 ancestor type. |
|
23923 |
|
23924 Creator: Curt Arnold |
|
23925 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23926 " |
|
23927 | |
|
23928 doc "Document" |
|
23929 elem "Element" |
|
23930 elemTypeInfo "TypeInfo" |
|
23931 typeName "String" |
|
23932 elemList "NodeList" |
|
23933 retValue "Boolean" |
|
23934 | |
|
23935 ^self. "Schema validation not supported" |
|
23936 ^self. "Validation not supported" |
|
23937 "implementationAttribute not supported: namespaceAware" |
|
23938 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23939 elemList := doc getElementsByTagName: 'sup'. |
|
23940 elem := elemList item:0. |
|
23941 elemTypeInfo := elem schemaTypeInfo. |
|
23942 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emp0004_5Type' method:0. |
|
23943 self assert: retValue. |
|
23944 |
|
23945 ! |
|
23946 |
|
23947 test_typeinfoisderivedfrom69 |
|
23948 " |
|
23949 Checks that isDerivedFrom(...,DERIVATION_UNION|DERIVATION_LIST) returns false when there |
|
23950 is both a union and list derivation steps between the target and |
|
23951 ancestor type. |
|
23952 |
|
23953 Creator: Curt Arnold |
|
23954 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23955 " |
|
23956 | |
|
23957 doc "Document" |
|
23958 elem "Element" |
|
23959 elemTypeInfo "TypeInfo" |
|
23960 typeName "String" |
|
23961 elemList "NodeList" |
|
23962 retValue "Boolean" |
|
23963 | |
|
23964 ^self. "Schema validation not supported" |
|
23965 ^self. "Validation not supported" |
|
23966 "implementationAttribute not supported: namespaceAware" |
|
23967 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23968 elemList := doc getElementsByTagName: 'sup'. |
|
23969 elem := elemList item:0. |
|
23970 elemTypeInfo := elem schemaTypeInfo. |
|
23971 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'integer' method:12. |
|
23972 self deny: retValue. |
|
23973 |
|
23974 ! |
|
23975 |
|
23976 test_typeinfoisderivedfrom70 |
|
23977 " |
|
23978 Checks that isDerivedFrom(...,0) returns true when there |
|
23979 is both a union and list derivation steps between the target and |
|
23980 ancestor type. |
|
23981 |
|
23982 Creator: Curt Arnold |
|
23983 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
23984 " |
|
23985 | |
|
23986 doc "Document" |
|
23987 elem "Element" |
|
23988 elemTypeInfo "TypeInfo" |
|
23989 typeName "String" |
|
23990 elemList "NodeList" |
|
23991 retValue "Boolean" |
|
23992 | |
|
23993 ^self. "Schema validation not supported" |
|
23994 ^self. "Validation not supported" |
|
23995 "implementationAttribute not supported: namespaceAware" |
|
23996 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
23997 elemList := doc getElementsByTagName: 'sup'. |
|
23998 elem := elemList item:0. |
|
23999 elemTypeInfo := elem schemaTypeInfo. |
|
24000 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/2001/XMLSchema' name:'string' method:0. |
|
24001 self assert: retValue. |
|
24002 |
|
24003 ! |
|
24004 |
|
24005 test_typeinfoisderivedfrom71 |
|
24006 " |
|
24007 Checks that isDerivedFrom(...,0) returns true when target type is a list |
|
24008 of an union of the ancestor type. |
|
24009 |
|
24010 Creator: Curt Arnold |
|
24011 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
24012 " |
|
24013 | |
|
24014 doc "Document" |
|
24015 elem "Element" |
|
24016 elemTypeInfo "TypeInfo" |
|
24017 typeName "String" |
|
24018 elemList "NodeList" |
|
24019 retValue "Boolean" |
|
24020 | |
|
24021 ^self. "Schema validation not supported" |
|
24022 ^self. "Validation not supported" |
|
24023 "implementationAttribute not supported: namespaceAware" |
|
24024 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
24025 elemList := doc getElementsByTagName: 'code'. |
|
24026 elem := elemList item:0. |
|
24027 elemTypeInfo := elem schemaTypeInfo. |
|
24028 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'field' method:0. |
|
24029 self assert: retValue. |
|
24030 |
|
24031 ! |
|
24032 |
|
24033 test_typeinfoisderivedfrom72 |
|
24034 " |
|
24035 Checks that isDerivedFrom(...,DERIVATION_LIST|DERIVATION_UNION) returns false when target type is a list |
|
24036 of an union. |
|
24037 ancestor type. |
|
24038 |
|
24039 Creator: Curt Arnold |
|
24040 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
24041 " |
|
24042 | |
|
24043 doc "Document" |
|
24044 elem "Element" |
|
24045 elemTypeInfo "TypeInfo" |
|
24046 typeName "String" |
|
24047 elemList "NodeList" |
|
24048 retValue "Boolean" |
|
24049 | |
|
24050 ^self. "Schema validation not supported" |
|
24051 ^self. "Validation not supported" |
|
24052 "implementationAttribute not supported: namespaceAware" |
|
24053 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
24054 elemList := doc getElementsByTagName: 'code'. |
|
24055 elem := elemList item:0. |
|
24056 elemTypeInfo := elem schemaTypeInfo. |
|
24057 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'field' method:12. |
|
24058 self deny: retValue. |
|
24059 |
|
24060 ! |
|
24061 |
|
24062 test_typeinfoisderivedfrom73 |
|
24063 " |
|
24064 Checks that isDerivedFrom(...,0) returns true where the target type is a union |
|
24065 where the ancestor type is a member of the union and is a union itself. |
|
24066 |
|
24067 Creator: Curt Arnold |
|
24068 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#TypeInfo-isDerivedFrom |
|
24069 " |
|
24070 | |
|
24071 doc "Document" |
|
24072 elem "Element" |
|
24073 elemTypeInfo "TypeInfo" |
|
24074 typeName "String" |
|
24075 elemList "NodeList" |
|
24076 retValue "Boolean" |
|
24077 | |
|
24078 ^self. "Schema validation not supported" |
|
24079 ^self. "Validation not supported" |
|
24080 "implementationAttribute not supported: namespaceAware" |
|
24081 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'hc_staff'). |
|
24082 elemList := doc getElementsByTagName: 'sup'. |
|
24083 elem := elemList item:0. |
|
24084 elemTypeInfo := elem schemaTypeInfo. |
|
24085 retValue := elemTypeInfo isDerivedFromNS:'http://www.w3.org/1999/xhtml' name:'emType' method:0. |
|
24086 self assert: retValue. |
|
24087 |
|
24088 ! |
|
24089 |
|
24090 test_userdatahandler01 |
|
24091 " |
|
24092 Call setUserData on a node providing a UserDataHandler and rename the node. |
|
24093 |
|
24094 Creator: Curt Arnold |
|
24095 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-handleUserDataEvent |
|
24096 " |
|
24097 | |
|
24098 doc "Document" |
|
24099 node "Node" |
|
24100 pList "NodeList" |
|
24101 userDataMonitor "UserDataMonitor" |
|
24102 oldUserData "DOMUserData" |
|
24103 elementNS "String" |
|
24104 newNode "Node" |
|
24105 notifications "List" |
|
24106 notification "UserDataNotification" |
|
24107 operation "short" |
|
24108 key "String" |
|
24109 data "String" |
|
24110 src "Node" |
|
24111 dst "Node" |
|
24112 greetingCount "SmallInteger" |
|
24113 salutationCount "SmallInteger" |
|
24114 hello "String" |
|
24115 mister "String" |
|
24116 | |
|
24117 greetingCount := 0. |
|
24118 salutationCount := 0. |
|
24119 hello := 'Hello'. |
|
24120 mister := 'Mr.'. |
|
24121 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
24122 pList := doc getElementsByTagName: 'p'. |
|
24123 node := pList item:0. |
|
24124 oldUserData := node setUserData:hello handler: userDataMonitor forKey:'greeting'. |
|
24125 oldUserData := node setUserData:mister handler: userDataMonitor forKey:'salutation'. |
|
24126 elementNS := node namespaceURI. |
|
24127 newNode := doc renameNode:node namespaceUri:elementNS qualifiedName:'div'. |
|
24128 self assert:false description:'Method "allNotifications" is not supported yet'. |
|
24129 self assert: notifications size = 2. |
|
24130 notifications do: [notification| |
|
24131 self assert:false description:'Method "operation" is not supported yet'. |
|
24132 self assert: ( operation = 4 ). |
|
24133 self assert:false description:'Method "key" is not supported yet'. |
|
24134 data := notification data. |
|
24135 "if" |
|
24136 ( key = 'greeting' ) ifTrue: [ |
|
24137 ]. |
|
24138 self assert:false description:'Method "src" is not supported yet'. |
|
24139 self assert: src == node. |
|
24140 self assert:false description:'Method "dst" is not supported yet'. |
|
24141 "if" |
|
24142 ( dst isNil ) ifTrue: [ |
|
24143 ]. |
|
24144 ]. |
|
24145 self assert: ( greetingCount = 1 ). |
|
24146 self assert: ( salutationCount = 1 ). |
|
24147 |
|
24148 ! |
|
24149 |
|
24150 test_userdatahandler02 |
|
24151 " |
|
24152 Call setUserData on a node providing a UserDataHandler and clone the node. |
|
24153 |
|
24154 Creator: Curt Arnold |
|
24155 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-handleUserDataEvent |
|
24156 " |
|
24157 | |
|
24158 doc "Document" |
|
24159 node "Node" |
|
24160 pList "NodeList" |
|
24161 userDataMonitor "UserDataMonitor" |
|
24162 oldUserData "DOMUserData" |
|
24163 elementNS "String" |
|
24164 newNode "Node" |
|
24165 notifications "List" |
|
24166 notification "UserDataNotification" |
|
24167 operation "short" |
|
24168 key "String" |
|
24169 data "String" |
|
24170 src "Node" |
|
24171 dst "Node" |
|
24172 greetingCount "SmallInteger" |
|
24173 salutationCount "SmallInteger" |
|
24174 hello "String" |
|
24175 mister "String" |
|
24176 | |
|
24177 greetingCount := 0. |
|
24178 salutationCount := 0. |
|
24179 hello := 'Hello'. |
|
24180 mister := 'Mr.'. |
|
24181 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
24182 pList := doc getElementsByTagName: 'p'. |
|
24183 node := pList item:0. |
|
24184 oldUserData := node setUserData:hello handler: userDataMonitor forKey:'greeting'. |
|
24185 oldUserData := node setUserData:mister handler: userDataMonitor forKey:'salutation'. |
|
24186 elementNS := node namespaceURI. |
|
24187 newNode := node cloneNode:true. |
|
24188 self assert:false description:'Method "allNotifications" is not supported yet'. |
|
24189 self assert: notifications size = 2. |
|
24190 notifications do: [notification| |
|
24191 self assert:false description:'Method "operation" is not supported yet'. |
|
24192 self assert: ( operation = 1 ). |
|
24193 self assert:false description:'Method "key" is not supported yet'. |
|
24194 data := notification data. |
|
24195 "if" |
|
24196 ( key = 'greeting' ) ifTrue: [ |
|
24197 ]. |
|
24198 self assert:false description:'Method "src" is not supported yet'. |
|
24199 self assert: src == node. |
|
24200 self assert:false description:'Method "dst" is not supported yet'. |
|
24201 self assert: dst == newNode. |
|
24202 ]. |
|
24203 self assert: ( greetingCount = 1 ). |
|
24204 self assert: ( salutationCount = 1 ). |
|
24205 |
|
24206 ! |
|
24207 |
|
24208 test_userdatahandler03 |
|
24209 " |
|
24210 Call setUserData on a node providing a UserDataHandler and import the node. |
|
24211 |
|
24212 Creator: Curt Arnold |
|
24213 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-handleUserDataEvent |
|
24214 " |
|
24215 | |
|
24216 doc "Document" |
|
24217 node "Node" |
|
24218 pList "NodeList" |
|
24219 userDataMonitor "UserDataMonitor" |
|
24220 oldUserData "DOMUserData" |
|
24221 elementNS "String" |
|
24222 newNode "Node" |
|
24223 notifications "List" |
|
24224 notification "UserDataNotification" |
|
24225 operation "short" |
|
24226 key "String" |
|
24227 data "String" |
|
24228 src "Node" |
|
24229 dst "Node" |
|
24230 greetingCount "SmallInteger" |
|
24231 salutationCount "SmallInteger" |
|
24232 hello "String" |
|
24233 mister "String" |
|
24234 newDoc "Document" |
|
24235 rootName "String" |
|
24236 rootNS "String" |
|
24237 domImpl "DOMImplementation" |
|
24238 docType "DocumentType" |
|
24239 docElem "Element" |
|
24240 | |
|
24241 greetingCount := 0. |
|
24242 salutationCount := 0. |
|
24243 hello := 'Hello'. |
|
24244 mister := 'Mr.'. |
|
24245 docType := nil. |
|
24246 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
24247 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
24248 docElem := doc documentElement. |
|
24249 rootNS := docElem namespaceURI. |
|
24250 rootName := docElem tagName. |
|
24251 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: docType. |
|
24252 pList := doc getElementsByTagName: 'p'. |
|
24253 node := pList item:0. |
|
24254 oldUserData := node setUserData:hello handler: userDataMonitor forKey:'greeting'. |
|
24255 oldUserData := node setUserData:mister handler: userDataMonitor forKey:'salutation'. |
|
24256 elementNS := node namespaceURI. |
|
24257 newNode := doc importNode:node deep:true. |
|
24258 self assert:false description:'Method "allNotifications" is not supported yet'. |
|
24259 self assert: notifications size = 2. |
|
24260 notifications do: [notification| |
|
24261 self assert:false description:'Method "operation" is not supported yet'. |
|
24262 self assert: ( operation = 2 ). |
|
24263 self assert:false description:'Method "key" is not supported yet'. |
|
24264 data := notification data. |
|
24265 "if" |
|
24266 ( key = 'greeting' ) ifTrue: [ |
|
24267 ]. |
|
24268 self assert:false description:'Method "src" is not supported yet'. |
|
24269 self assert: src == node. |
|
24270 self assert:false description:'Method "dst" is not supported yet'. |
|
24271 self assert: dst == newNode. |
|
24272 ]. |
|
24273 self assert: ( greetingCount = 1 ). |
|
24274 self assert: ( salutationCount = 1 ). |
|
24275 |
|
24276 ! |
|
24277 |
|
24278 test_userdatahandler04 |
|
24279 " |
|
24280 Call setUserData on a node providing a UserDataHandler and adopt the node. |
|
24281 |
|
24282 Creator: Curt Arnold |
|
24283 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-handleUserDataEvent |
|
24284 " |
|
24285 | |
|
24286 doc "Document" |
|
24287 node "Node" |
|
24288 pList "NodeList" |
|
24289 userDataMonitor "UserDataMonitor" |
|
24290 oldUserData "DOMUserData" |
|
24291 elementNS "String" |
|
24292 newNode "Node" |
|
24293 notifications "List" |
|
24294 notification "UserDataNotification" |
|
24295 operation "short" |
|
24296 key "String" |
|
24297 data "String" |
|
24298 src "Node" |
|
24299 dst "Node" |
|
24300 greetingCount "SmallInteger" |
|
24301 salutationCount "SmallInteger" |
|
24302 hello "String" |
|
24303 mister "String" |
|
24304 newDoc "Document" |
|
24305 rootName "String" |
|
24306 rootNS "String" |
|
24307 domImpl "DOMImplementation" |
|
24308 docType "DocumentType" |
|
24309 docElem "Element" |
|
24310 | |
|
24311 greetingCount := 0. |
|
24312 salutationCount := 0. |
|
24313 hello := 'Hello'. |
|
24314 mister := 'Mr.'. |
|
24315 docType := nil. |
|
24316 doc := Parser forDOM3 processDocumentInFilename:(self xmlFilenameFor:'barfoo'). |
|
24317 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
24318 docElem := doc documentElement. |
|
24319 rootNS := docElem namespaceURI. |
|
24320 rootName := docElem tagName. |
|
24321 newDoc := domImpl createDocumentNS: rootNS qualifiedName: rootName doctype: docType. |
|
24322 pList := doc getElementsByTagName: 'p'. |
|
24323 node := pList item:0. |
|
24324 oldUserData := node setUserData:hello handler: userDataMonitor forKey:'greeting'. |
|
24325 oldUserData := node setUserData:mister handler: userDataMonitor forKey:'salutation'. |
|
24326 elementNS := node namespaceURI. |
|
24327 newNode := doc adoptNode: node. |
|
24328 self assert:false description:'Method "allNotifications" is not supported yet'. |
|
24329 self assert: notifications size = 2. |
|
24330 notifications do: [notification| |
|
24331 self assert:false description:'Method "operation" is not supported yet'. |
|
24332 self assert: ( operation = 5 ). |
|
24333 self assert:false description:'Method "key" is not supported yet'. |
|
24334 data := notification data. |
|
24335 "if" |
|
24336 ( key = 'greeting' ) ifTrue: [ |
|
24337 ]. |
|
24338 self assert:false description:'Method "src" is not supported yet'. |
|
24339 self assert: src == node. |
|
24340 self assert:false description:'Method "dst" is not supported yet'. |
|
24341 self assert: dst isNil. |
|
24342 ]. |
|
24343 self assert: ( greetingCount = 1 ). |
|
24344 self assert: ( salutationCount = 1 ). |
|
24345 |
|
24346 ! |
|
24347 |
|
24348 test_wellformed01 |
|
24349 " |
|
24350 Create a document with an XML 1.1 valid but XML 1.0 invalid element and |
|
24351 normalize document with well-formed set to true. |
|
24352 |
|
24353 Creator: Curt Arnold |
|
24354 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
24355 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-well-formed |
|
24356 " |
|
24357 | |
|
24358 domImpl "DOMImplementation" |
|
24359 nullString "String" |
|
24360 nullDoctype "DocumentType" |
|
24361 doc "Document" |
|
24362 elem "Element" |
|
24363 retval "Node" |
|
24364 domConfig "DOMConfiguration" |
|
24365 errorMonitor "DOMErrorMonitor" |
|
24366 errors "List" |
|
24367 error "DOMError" |
|
24368 severity "SmallInteger" |
|
24369 type "String" |
|
24370 locator "DOMLocator" |
|
24371 relatedNode "Node" |
|
24372 | |
|
24373 nullString := nil. |
|
24374 nullDoctype := nil. |
|
24375 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
24376 doc := domImpl createDocumentNS: nullString qualifiedName: nullString doctype: nullDoctype. |
|
24377 "assertDOMException..." |
|
24378 self should:[ |
|
24379 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed01'. |
|
24380 ] raise: DOMException. |
|
24381 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
24382 "end of assertDOMException..." |
|
24383 "try" |
|
24384 [ |
|
24385 ] on: DOMException do: [:ex| ]. |
|
24386 "end of try" |
|
24387 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed01'. |
|
24388 retval := doc appendChild:elem. |
|
24389 domConfig := doc domConfig. |
|
24390 domConfig setParameter: 'well-formed' value: true. |
|
24391 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
24392 doc normalizeDocument. |
|
24393 errors := errorMonitor errors. |
|
24394 errors do: [error| |
|
24395 severity := error severity. |
|
24396 self assert: ( severity = 2 ). |
|
24397 type := error type. |
|
24398 self assert: ( type = 'wf-invalid-character-in-node-name' ). |
|
24399 locator := error location. |
|
24400 relatedNode := locator relatedNode. |
|
24401 self assert: relatedNode == elem. |
|
24402 ]. |
|
24403 self assert: errors size = 1. |
|
24404 |
|
24405 ! |
|
24406 |
|
24407 test_wellformed02 |
|
24408 " |
|
24409 Create a document with an XML 1.1 valid but XML 1.0 invalid element and |
|
24410 normalize document with well-formed set to false. |
|
24411 |
|
24412 Creator: Curt Arnold |
|
24413 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
24414 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-well-formed |
|
24415 " |
|
24416 | |
|
24417 domImpl "DOMImplementation" |
|
24418 nullString "String" |
|
24419 nullDoctype "DocumentType" |
|
24420 doc "Document" |
|
24421 elem "Element" |
|
24422 retval "Node" |
|
24423 domConfig "DOMConfiguration" |
|
24424 errorMonitor "DOMErrorMonitor" |
|
24425 errors "List" |
|
24426 canSet "Boolean" |
|
24427 | |
|
24428 nullString := nil. |
|
24429 nullDoctype := nil. |
|
24430 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
24431 doc := domImpl createDocumentNS: nullString qualifiedName: nullString doctype: nullDoctype. |
|
24432 "assertDOMException..." |
|
24433 self should:[ |
|
24434 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed02'. |
|
24435 ] raise: DOMException. |
|
24436 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
24437 "end of assertDOMException..." |
|
24438 "try" |
|
24439 [ |
|
24440 ] on: DOMException do: [:ex| ]. |
|
24441 "end of try" |
|
24442 elem := doc createElement:'LegalNameࢎ' ns:'http://www.example.org/domts/wellformed02'. |
|
24443 retval := doc appendChild:elem. |
|
24444 domConfig := doc domConfig. |
|
24445 canSet := domConfig canSetParameter: 'well-formed' value: false. |
|
24446 "if" |
|
24447 (canSet) ifTrue: [ |
|
24448 ]. |
|
24449 |
|
24450 ! |
|
24451 |
|
24452 test_wellformed03 |
|
24453 " |
|
24454 Create a document with an XML 1.1 valid but XML 1.0 invalid attribute and |
|
24455 normalize document with well-formed set to true. |
|
24456 |
|
24457 Creator: Curt Arnold |
|
24458 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
24459 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-well-formed |
|
24460 " |
|
24461 | |
|
24462 domImpl "DOMImplementation" |
|
24463 nullDoctype "DocumentType" |
|
24464 doc "Document" |
|
24465 docElem "Element" |
|
24466 attr "Attr" |
|
24467 retval "Node" |
|
24468 domConfig "DOMConfiguration" |
|
24469 errorMonitor "DOMErrorMonitor" |
|
24470 errors "List" |
|
24471 error "DOMError" |
|
24472 severity "SmallInteger" |
|
24473 type "String" |
|
24474 locator "DOMLocator" |
|
24475 relatedNode "Node" |
|
24476 | |
|
24477 nullDoctype := nil. |
|
24478 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
24479 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDoctype. |
|
24480 docElem := doc documentElement. |
|
24481 "assertDOMException..." |
|
24482 self should:[ |
|
24483 attr := doc createAttribute:'LegalNameࢎ'. |
|
24484 ] raise: DOMException. |
|
24485 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
24486 "end of assertDOMException..." |
|
24487 "try" |
|
24488 [ |
|
24489 ] on: DOMException do: [:ex| ]. |
|
24490 "end of try" |
|
24491 docElem setAttribute:'LegalNameࢎ' value:'foo'. |
|
24492 attr := docElem getAttributeNode:'LegalNameࢎ'. |
|
24493 domConfig := doc domConfig. |
|
24494 domConfig setParameter: 'well-formed' value: true. |
|
24495 domConfig setParameter: 'error-handler' value: errorMonitor. |
|
24496 doc normalizeDocument. |
|
24497 errors := errorMonitor errors. |
|
24498 errors do: [error| |
|
24499 severity := error severity. |
|
24500 self assert: ( severity = 2 ). |
|
24501 type := error type. |
|
24502 self assert: ( type = 'wf-invalid-character-in-node-name' ). |
|
24503 locator := error location. |
|
24504 relatedNode := locator relatedNode. |
|
24505 self assert: relatedNode == attr. |
|
24506 ]. |
|
24507 self assert: errors size = 1. |
|
24508 |
|
24509 ! |
|
24510 |
|
24511 test_wellformed04 |
|
24512 " |
|
24513 Create a document with an XML 1.1 valid but XML 1.0 invalid attribute and |
|
24514 normalize document with well-formed set to false. |
|
24515 |
|
24516 Creator: Curt Arnold |
|
24517 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Document3-normalizeDocument |
|
24518 Subject http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-well-formed |
|
24519 " |
|
24520 | |
|
24521 domImpl "DOMImplementation" |
|
24522 nullDoctype "DocumentType" |
|
24523 doc "Document" |
|
24524 docElem "Element" |
|
24525 attr "Attr" |
|
24526 retval "Node" |
|
24527 domConfig "DOMConfiguration" |
|
24528 errorMonitor "DOMErrorMonitor" |
|
24529 errors "List" |
|
24530 error "DOMError" |
|
24531 canSet "Boolean" |
|
24532 nullNS "String" |
|
24533 | |
|
24534 nullDoctype := nil. |
|
24535 nullNS := nil. |
|
24536 domImpl := DOMImplementationRegistry getDOMImplementation:'XML 3.0'. |
|
24537 doc := domImpl createDocumentNS: 'http://www.w3.org/1999/xhtml' qualifiedName: 'html' doctype: nullDoctype. |
|
24538 docElem := doc documentElement. |
|
24539 "assertDOMException..." |
|
24540 self should:[ |
|
24541 attr := doc createAttribute:'LegalNameࢎ' ns:nullNS. |
|
24542 ] raise: DOMException. |
|
24543 self assert: (lastException code == DOMException INVALID_CHARACTER_ERR). |
|
24544 "end of assertDOMException..." |
|
24545 "try" |
|
24546 [ |
|
24547 ] on: DOMException do: [:ex| ]. |
|
24548 "end of try" |
|
24549 docElem setAttribute: 'LegalNameࢎ' ns: nullNS value: 'foo'. |
|
24550 domConfig := doc domConfig. |
|
24551 canSet := domConfig canSetParameter: 'well-formed' value: false. |
|
24552 "if" |
|
24553 (canSet) ifTrue: [ |
|
24554 self assert: error isNil. |
|
24555 ]. |
|
24556 |
|
24557 ! ! |
|
24558 |
|
24559 !W3CDOM3CoreTests class methodsFor:'documentation'! |
|
24560 |
|
24561 version |
|
24562 ^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/XMLv2__W3CDOM3CoreTests.st,v 1.6 2007-01-03 19:45:04 stillj1 Exp $' |
|
24563 ! ! |