Subject: [Simple] draft-urpalainen-simple-xml-patch-ops-01: ability to replace an element with descendants

From: "Anat Angel" <[email-masked]>
Date: Thu, 3 Nov 2005 11:29:18 +0200

Hi

I have the following questions regarding the draft:

1. How can replacement of an element and all its descendents be
preformed?

For example: Is it legal to do the following in order to replace all the
contents of tuple 'xyz':

        <p:replace sel="*/tuple[@id='xyz']"><tuple id="xyz">

           <status>

            <basic>open</basic>

           </status>

          </tuple>

          </p:replace>

and expect that all the 'old' descendants of 'tuple xyz' be removed and
that just the 'new' descendants (that appear in the example) will
appear?

2. From the draft it seems that

        <p:replace sel="*/tuple[@id='xyz']"><tuple id="xyz2">

is allowed, and that in this case all the descendants of 'tuple xyz'
will stay as before. When is this necessary?

[Note: 

The ability to replace an entity with descendants is important for
composers: For example:

A sends PUBLISH with tuple1 (status "open").

B sends PUBLISH with tuple1 (status "closed" and lots of other
descendants).

Composer sends full notification to all watchers with tuple1 with state
closed (assuming the "last is more accurate" approach).

Now A sends MODIFY with <replace> to tuple1 from "open" to "gone". 

In this case the composer needs to update the watchers that tuple1
changed all its information from what B sent before to what A sent
("gone" and no other descendants).

Of course, the composer can send <remove> and than <add> but this is BW
consuming.

]

Regards,

Anat

_______________________________________________
Simple mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/simple

---

From: Jari Urpalainen <[email-masked]>
Date: Thu, 03 Nov 2005 13:46:55 +0200

>        <p:replace sel="*/tuple[@id='xyz']"><tuple id="xyz">
replaces <tuple id="xyz"> totally.

>that just the 'new' descendants (that appear in the example) will
so old descendants disapper.

>will stay as before. When is this necessary?
So perhaps not clearly enough expressed in the spec, but element 
replacement means replacing everything that appears in the new refreshed 
element: attributes, text nodes, ns declarations and all descendant nodes.

>Of course, the composer can send <remove> and than <add> but this is BW
text node updates are possible as well, as text() function is also 
allowed, i.e. you can update only  text node content with <replace 
sel="*/tuple/status/basic/text()">open</replace>. However, it is up to 
the publisher or notifier to choose the granularity level of patches (in 
other words, what's reasonable).
thanks,
Jari