author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 25 Jan 2016 16:35:43 +0000 | |
changeset 298 | 9696f76605bd |
parent 296 | ea3dbc023c80 |
permissions | -rw-r--r-- |
0 | 1 |
"{ Package: 'stx:goodies/xmlsuite/xquery' }" |
2 |
||
3 |
"{ NameSpace: XQuery }" |
|
4 |
||
5 |
InsertCommand subclass:#InsertAfterCommand |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'XQuery-Update Facility' |
|
10 |
! |
|
11 |
||
12 |
||
13 |
!InsertAfterCommand class methodsFor:'priorities'! |
|
14 |
||
15 |
priority |
|
16 |
"Superclass says that I am responsible to implement this method" |
|
17 |
||
18 |
^20 |
|
19 |
! ! |
|
20 |
||
21 |
!InsertAfterCommand methodsFor:'checks'! |
|
22 |
||
23 |
checkSourceSequence:anXQuerySequence |
|
24 |
||
25 |
| foundNonAttribute | |
|
26 |
foundNonAttribute := false. |
|
27 |
anXQuerySequence do: |
|
28 |
[:seqItem| |
|
29 |
self |
|
232
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
30 |
assert: (((seqItem type isSubtypeOf: (TypeFactory getType: 'attribute')) and:[foundNonAttribute])) not |
0 | 31 |
description:'An attribute found after non-attribute (see section 2.3.1.)'. |
232
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
32 |
foundNonAttribute := (seqItem type == (TypeFactory getType: 'attribute')) not] |
0 | 33 |
|
34 |
"Modified: / 05-12-2007 / 21:01:27 / janfrog" |
|
232
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
35 |
"Modified: / 09-05-2009 / 12:08:47 / Jan Kurs <kursj1@fel.cvut.cz>" |
0 | 36 |
! |
37 |
||
38 |
checkTargetSequence: anXQuerySequence |
|
39 |
||
40 |
self |
|
41 |
assert: (anXQuerySequence containsSingleElement and:[anXQuerySequence first item hasParent ]) |
|
42 |
description: 'target must be a single element or document node with parent (see section 2.3.1.)'. |
|
43 |
||
44 |
"Modified: / 21-11-2007 / 09:43:55 / janfrog" |
|
45 |
! ! |
|
46 |
||
47 |
!InsertAfterCommand methodsFor:'executing'! |
|
48 |
||
49 |
execute |
|
50 |
"Superclass says that I am responsible to implement this method" |
|
51 |
||
52 |
self sourceSequence |
|
53 |
do:[:node|self insert: node after: self targetSequence first] |
|
54 |
! ! |
|
55 |
||
56 |
!InsertAfterCommand methodsFor:'inserting'! |
|
57 |
||
58 |
insert:sourceNode after:targetNode |
|
284 | 59 |
"|importedSourceNodeId|" |
0 | 60 |
|
284 | 61 |
"importedSourceNodeId := targetNode documentAdaptor |
62 |
importForeignNode:sourceNode. " |
|
272 | 63 |
|
284 | 64 |
(sourceNode isElementNode) ifFalse:[ |
65 |
targetNode documentAdaptor updInsertAttribute:sourceNode |
|
66 |
after:targetNode |
|
272 | 67 |
] ifTrue:[ |
284 | 68 |
targetNode documentAdaptor updInsert:sourceNode |
69 |
after:targetNode |
|
0 | 70 |
] |
71 |
||
72 |
"Modified: / 05-12-2007 / 14:26:29 / janfrog" |
|
232
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
73 |
"Modified: / 09-05-2009 / 12:09:07 / Jan Kurs <kursj1@fel.cvut.cz>" |
284 | 74 |
"Modified: / 25-04-2012 / 23:11:35 / Adam Senk <senkadam@gmail.com>" |
0 | 75 |
! ! |
76 |
||
77 |
!InsertAfterCommand class methodsFor:'documentation'! |
|
78 |
||
232
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
79 |
version_SVN |
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
80 |
^ '$Id$' |
0 | 81 |
! ! |