Subject: [Simple] PUT of xml fragment into rls-services document

From: Martin Hynar <[email-masked]>
Date: Wed, 25 Apr 2007 15:20:20 +0200

Hello,

I am facing one interesting problem which I cannot decide how to solve.
See the situation

1. I store rls-services document with XCAP PUT request. The content is
following

<?xml version="1.0" encoding="UTF-8"?> 
<rls-services xmlns="urn:ietf:params:xml:ns:rls-services"
xmlns:rl="urn:ietf:params:xml:ns:resource-lists"> 
<service uri="sip:[email-masked]"> 
<list name="friends"> 
<rl:entry uri="sip:[email-masked]" /> 
<rl:entry uri="sip:[email-masked]" /> 
<rl:entry uri="sip:[email-masked]" /> 
</list> 
<packages> 
<package>presence</package> 
</packages> 
</service> 
</rls-services>

2. Now I want to insert new <entry> on 3rd position using following
requets

PUT /rls-services/.../index/~~/rls-services/service[@uri="sip:[email-masked]"]/list/rl:entry[3]?xmlns(rl=urn:ietf:params:xml:ns:resource-lists)

<!--some comment --> 
<rl:entry uri="sip:[email-masked]" /> 

3. What shall be the resulting document?
  - Is the content of 2nd PUT correct? Is it possible to have 2
parseable items (comment and regular element) on the same level? 
  - Is comment addressable with XCAP document/node selector?

I will be happy for all suggestions. Thanks in advance, Martin Hynar

+-------------------------------------+ 
  Martin Hynar 
  Software Specialist

  TietoEnator 
  Czech Software Center 
  Phone: +420 597 459 713 
  Mobile: +420 724 432 817 
  E-mail: [email-masked]

  Vystavni 292/13 
  CZ-709 16 Ostrava

www.tietoenator.com

Please note: The information contained in this message may be legally
privileged and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, you are hereby notified
that any unauthorized use, distribution or copying of this communication
is strictly prohibited. If you have received this communication in
error, please notify us immediately by replying to the message and
deleting it from your computer. Thank You.
_______________________________________________
Simple mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/simple

---

From: Jari Urpalainen <[email-masked]>
Date: Thu, 26 Apr 2007 10:09:07 +0300

ext Martin Hynar wrote:
> Hello,
>
> I am facing one interesting problem which I cannot decide how to 
> solve. See the situation
>
> <service uri="sip:[email-masked] 
> <mailto:[email-masked]>">
> <list name="friends">
> <rl:entry uri="sip:[email-masked] 
> <mailto:[email-masked]>" />
> <rl:entry uri="sip:[email-masked] 
> <mailto:[email-masked]>" />
> <rl:entry uri="sip:[email-masked] 
> <mailto:[email-masked]>" />
> </list>
> <packages>
> PUT 
> /rls-services/.../index/~~/rls-services/service[@uri="sip:[email-masked]"] 
> <mailto:[email-masked]>/list/rl:entry[3]?xmlns(rl=urn:ietf:params:xml:ns:resource-lists)
>
> <!--some comment -->
> <rl:entry uri="sip:[email-masked] 
> <mailto:[email-masked]>" />
>
First, I'm assuming with "insert" you mean "add".  In order to add a new 
entry onto this position instead of overwriting <rl:entry 
uri="sip:[email-masked] 
<mailto:[email-masked]>" /> what your 
r-uri is doing, you need a request like:

PUT 
/rls-services/.../index/~~/rls-services/service[@uri="sip:[email-masked]"] 
<mailto:[email-masked]>/list/rl:entry[3][@uri="sip:presentity_C 
<mailto:[email-masked]>@example.com" 
<mailto:[email-masked]>]?xmlns(rl=urn:ietf:params:xml:ns:resource-lists)

(and of course you must percent-encode the uri)

and FYI you could simplify the r-uri, because the presentity uri is a 
good enough unique selector in this case:

PUT 
/rls-services/.../index/~~/rls-services/service[@uri="sip:[email-masked]"] 
<mailto:[email-masked]>/list/*[3][@uri="sip:presentity_C 
<mailto:[email-masked]>@example.com" 
<mailto:[email-masked]>]

So after the insert is successful get(put(x)=x must be satisfied. 
Unfortunately, this still leaves room for interpretation because of 
whitespace, comment nodes etc.
>   - Is comment addressable with XCAP document/node selector?
You cannot have a sibling comment node of an element within the body 
(breaks get(put(x))=x rule). Also a comment node is not addressable with 
xcap semantics. Comment nodes may appear as child nodes of an element.

So the end result (look at e.g. examples in chapter 8.2.3):

<?xml version="1.0" encoding="UTF-8"?>
<rls-services xmlns="urn:ietf:params:xml:ns:rls-services" 
xmlns:rl="urn:ietf:params:xml:ns:resource-lists">
<service uri="sip:[email-masked] 
<mailto:[email-masked]>">
<list name="friends">
<rl:entry uri="sip:[email-masked] 
<mailto:[email-masked]>" />
<rl:entry uri="sip:[email-masked] 
<mailto:[email-masked]>" /><rl:entry 
uri="sip:[email-masked] 
<mailto:[email-masked]>" />
<rl:entry uri="sip:[email-masked] 
<mailto:[email-masked]>" />
</list>
<packages>
<package>presence</package>
</packages>
</service>
</rls-services>

Note that the new entry appears before the whitespace text node. And if 
you needed "pretty printing style" you must submit e.g. the whole <list>.
> I will be happy for all suggestions. Thanks in advance, Martin Hynar
br, jari

---

From: Martin Hynar <[email-masked]>
Date: Thu, 26 Apr 2007 10:20:07 +0200

Hello,

thanks much for explanation. The result is exactly as I have expected,
also the handling of comments/whitespaces. However, it might be helpful
to mention this also in simple-xcap spec, because this "free room" with
comments and whitespace interpretation might lead to client/server
interoperability issues. E.g. client might suppose that if comment is
not addressable the it might be added using the way in my example
together with some regular element and the subsequent get will then
retrieve only that element. If I consider also the whitespace, then also
putting content like " <el/>" (note the space in the beginning) would
lead to IOP problems.

br, Martin

  TietoEnator 
  Czech Software Center 
  Phone: +420 597 459 713 
  Mobile: +420 724 432 817 

  Vystavni 292/13 
  CZ-709 16 Ostrava

www.tietoenator.com

---

From: Jari Urpalainen <[email-masked]>
Date: Thu, 26 Apr 2007 14:06:23 +0300

On Thu, 2007-04-26 at 10:20 +0200, ext Martin Hynar wrote:
> also the handling of comments/whitespaces. However, it might be
> helpful to mention this also in simple-xcap spec, because this "free
> room" with comments and whitespace interpretation might lead to
> client/server interoperability issues. E.g. client might suppose that
> if comment is not addressable the it might be added using the way in
> my example together with some regular element and the subsequent get
> will then retrieve only that element. If I consider also the
> whitespace, then also putting content like " <el/>" (note the space in
> the beginning) would lead to IOP problems.
> 
> br, Martin
> 
I think the spec already explicitly states what's allowed and what's
not, so there should be no room for interpretations from that point of
view (at least for the items you mention). I fully agree though that
there will be interoperability difficulties, because some parts of the
stuff aren't necessarily that trivial to implement, but they are more or
less deployment issues.
br, Jari