author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 02 Jul 2018 08:46:01 +0200 | |
changeset 305 | bad21c4f64bf |
parent 296 | ea3dbc023c80 |
permissions | -rw-r--r-- |
0 | 1 |
"{ Package: 'stx:goodies/xmlsuite/xquery' }" |
2 |
||
3 |
"{ NameSpace: XQuery }" |
|
4 |
||
5 |
UpdateCommand subclass:#ReplaceCommand |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'XQuery-Update Facility' |
|
10 |
! |
|
11 |
||
12 |
||
13 |
!ReplaceCommand class methodsFor:'priorities'! |
|
14 |
||
15 |
priority |
|
16 |
"Superclass says that I am responsible to implement this method" |
|
17 |
||
18 |
^30 |
|
19 |
! ! |
|
20 |
||
21 |
!ReplaceCommand methodsFor:'checks'! |
|
22 |
||
23 |
checkSourceSequence:arg |
|
24 |
"Superclass says that I am responsible to implement this method" |
|
25 |
||
26 |
self |
|
27 |
assert: |
|
28 |
(arg allSatisfy:[:item| item type = self targetSequence first type]) |
|
29 |
description:('replacing different node types'). |
|
30 |
||
31 |
"Created: / 14-11-2007 / 10:06:41 / janfrog" |
|
32 |
"Modified: / 14-11-2007 / 15:20:01 / janfrog" |
|
33 |
! |
|
34 |
||
35 |
checkTargetSequence:anXQuerySequence |
|
36 |
self |
|
37 |
assert: (anXQuerySequence containsSingleNode) |
|
38 |
description:'Target sequence must contain one node (see section 2.3.3.1)'. |
|
39 |
self |
|
40 |
assert: (anXQuerySequence first item isDocumentNode not) |
|
41 |
description:'Target sequence node must have a parent (see section 2.3.3.1)'. |
|
42 |
||
43 |
"Modified: / 14-11-2007 / 11:58:32 / janfrog" |
|
44 |
! ! |
|
45 |
||
46 |
!ReplaceCommand methodsFor:'executing'! |
|
47 |
||
48 |
execute |
|
49 |
"Superclass says that I am responsible to implement this method" |
|
50 |
||
51 |
||
52 |
self replaceNode: self targetSequence first with: self sourceSequence |
|
53 |
||
54 |
"Created: / 14-11-2007 / 10:06:41 / janfrog" |
|
55 |
"Modified: / 14-11-2007 / 16:09:43 / janfrog" |
|
284 | 56 |
"Modified: / 12-03-2012 / 15:07:29 / Adam Senk <senkadam@gmail.com>" |
0 | 57 |
! ! |
58 |
||
274 | 59 |
!ReplaceCommand methodsFor:'replacing'! |
60 |
||
61 |
replaceNode:targetNode with:sourceNodes |
|
284 | 62 |
|importedSourceNodes| |
274 | 63 |
|
284 | 64 |
importedSourceNodes := sourceNodes |
65 |
collect:[:sourceNode | sourceNode itemKind isConstructedNode ifTrue:[ |
|
66 |
targetNode documentAdaptor importForeignNode:sourceNode |
|
274 | 67 |
adaptor:sourceNode documentAdaptor |
284 | 68 |
] |
69 |
ifFalse:[sourceNode.]. |
|
70 |
||
274 | 71 |
]. |
284 | 72 |
targetNode documentAdaptor updReplaceNode:targetNode |
73 |
with:importedSourceNodes |
|
274 | 74 |
|
75 |
"Created: / 14-11-2007 / 10:24:04 / janfrog" |
|
76 |
"Modified: / 05-12-2007 / 14:26:29 / janfrog" |
|
284 | 77 |
"Modified: / 01-05-2012 / 16:56:25 / Adam Senk <senkadam@gmail.com>" |
274 | 78 |
! ! |
0 | 79 |
|
80 |
!ReplaceCommand class methodsFor:'documentation'! |
|
81 |
||
232
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
82 |
version_SVN |
9d8fd28b99b0
branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
83 |
^ '$Id$' |
0 | 84 |
! ! |