xquery/XQuery__ReplaceElementContentCommand.st
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--
Tagged Smalltalk/X 8.0.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/xmlsuite/xquery' }"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: XQuery }"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
UpdateCommand subclass:#ReplaceElementContentCommand
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:''
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'XQuery-Update Facility'
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
!ReplaceElementContentCommand class methodsFor:'priorities'!
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
priority
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
    "Superclass says that I am responsible to implement this method"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
    ^40
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
! !
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
!ReplaceElementContentCommand methodsFor:'checks'!
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
checkSourceSequence:anXQuerySequence 
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    self
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
        assert: anXQuerySequence containsSingleTextOrAtomicValue
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
        description: 'target must be a single text node (see section 2.3.3.2.)'.
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
    "Modified: / 21-11-2007 / 12:23:15 / janfrog"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
!
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
checkTargetSequence:anXQuerySequence
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
    self 
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
        assert: (anXQuerySequence containsSingleNode)
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
        description:'Target sequence must contain one node (see section 2.3.3.2)'.
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    "Modified: / 14-11-2007 / 11:31:24 / janfrog"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
! !
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
!ReplaceElementContentCommand methodsFor:'executing'!
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
execute
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
    "Superclass says that I am responsible to implement this method"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
    self replaceValueOf: self targetSequence first  with: self sourceSequence first.
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    "Created: / 14-11-2007 / 10:55:16 / janfrog"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
    "Modified: / 14-11-2007 / 14:00:40 / janfrog"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
! !
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
!ReplaceElementContentCommand methodsFor:'replacing'!
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
replaceValueOf:referenceNode with:newValueNode 
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    |importedNewValueNodeId|
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    importedNewValueNodeId := referenceNode documentAdaptor 
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
                importForeignNode:newValueNode asXQueryConstructedNode nodeId
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
                adaptor:newValueNode asXQueryConstructedNode documentAdaptor.
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    referenceNode documentAdaptor updReplaceValueOf:referenceNode item nodeId
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
        with:importedNewValueNodeId
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
    "Modified: / 05-12-2007 / 14:26:29 / janfrog"
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
! !
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
!ReplaceElementContentCommand class methodsFor:'documentation'!
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
232
9d8fd28b99b0 branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    68
version_SVN
9d8fd28b99b0 branch datatypes reintegrated
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    69
    ^ '$Id$'
0
5057afe1ec87 Initial import from CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
! !