This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 4312 - [UPD] Double deletion of a replaced node
Summary: [UPD] Double deletion of a replaced node
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Update Facility (show other bugs)
Version: Working drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Andrew Eisenberg
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-08 23:57 UTC by Don Chamberlin
Modified: 2007-02-13 18:53 UTC (History)
0 users

See Also:


Attachments

Description Don Chamberlin 2007-02-08 23:57:36 UTC
In Section 3.1.8, upd:replaceNode, we see the following rules:

Rule 3 says that the target node (i.e., the node that was replaced) is "marked for deletion". 

Rule 4 says that the parent of the target node is updated so that the target node is no longer among its children or attributes.

But in the semantics of upd:applyUpdates, after all the primitive operations have been applied, we get around to processing the nodes that are "marked for deletion", and for each of these nodes, we update its parent so that the "marked" node is no longer among its children or attributes.

The problem here is that, in the case of a node that is replaced, the node gets removed from its parent twice: once by Rule 4 of upd:replaceNode, and once by Rule 2e of upd:applyUpdates.

I think the way to fix this redundancy is to change Rule 3 of Section 3.1.8 (upd:replaceNode) as follows:

3. Effect on $target: The parent property of $target is set to empty.

In this way, the job of detaching $target from its parent is done entirely by upd:replaceNode, and we no longer mark the replaced node for later deletion. The redundant operation on the parent of the deleted node disappears.

It is interesting to note that, when update primitives are applied in Section 3.2.2 (upd:applyUpdates), replaceNode primitives (Rule 2c) are applied before replaceElementContent primitives (Rule 2d). It is possible that both of these primitives might apply to the same node. In this case, Rule 2c will detach the node from its parent (but the node and its nodeid will still exist, without any parent), and then Rule 2d will replace the content of the node (this is a harmless thing to do but the modified node can no longer be reached from its parent.)

I request that the working group consider this proposal to modify Rule 3 of Section 3.1.8 as described above.

Regards, 
--Don Chamberlin
Comment 1 Don Chamberlin 2007-02-13 18:53:16 UTC
Don,
Thanks for your comment, which was reviewed by the working group on 2/13/07. The working group observes that your comment makes no sense because upd:replaceNode Rule 4c does not delete the replaced node from the children property of its parent as claimed. Therefore the proposed change is not necessary. However, the working group also observes that a change should be made to upd:replaceNode Rule 4a, allowing the replaced attribute node to remain in the "attributes" property of its parent node until applyUpdates time. If you agree with this conclusion and promise not to enter any more bogus bug reports, please mark this bug as Closed.
Regards,
Don Chamberlin (for the Query Working Group)