Re: [Xmldb-org-xupdate] Poorly defined update instruction
Brought to you by:
reinhapa
From: John L. C. <jl...@po...> - 2005-04-29 18:13:05
|
On Thu, Apr 28, 2005 at 11:23:36PM -0700, Ronald Bourret wrote: > 1) The update expression you give is not legal -- the content of the=20 > update element is #PCDATA, not element, attribute, etc. Aha; I didn't examine the DTD closely enough to infer that point. The examples do each only use #PCDATA, but examples for other operations use arbitrary XML and the description of the update operation did not forbid it. I would propose that the description in the spec be made more explicit on this point. > 2) Why can't you say: >=20 > <xupdate:update select=3D"/example/p/text()[2]" > xmlns:xupdate=3D"http://www.xmldb.org/xupdate">baz</xupdate:update> Well, the spec says that the update operation "can be used to update the content of existing nodes". From the example given, I took this to mean that the subtree underneath the selected node was replaced with the update operation's content. This is why I thought that the replacing content could be any valid XML content. If a text node is explicitly selected, though, it does not have any subtree to update. To be explicit, if your example above were allowed, then following the example in the spec, both of: --- <xupdate:update select=3D"/addresses/address[2]/town" xmlns:xupdate=3D"http://www.xmldb.org/xupdate">New York</xupdate:update> --- and --- <xupdate:update select=3D"/addresses/address[2]/town/text()[1]" xmlns:xupdate=3D"http://www.xmldb.org/xupdate">New York</xupdate:update> --- could be used for the same update. However, they explicitly select different nodes for which to "update the content", which I believe is fundamentally broken. I would argue for one way or the other, but not both. I would prefer that the latter be made normative (that is, that update be treated precisely as node replacement, hence my original argument about the assignment operator semantics). > 3) It would be useful for update to allow element, attribute, etc. as=20 > content. That said, I'm not convinced it's worth the complexity, as you= =20 > can simply delete the element and reinsert it with the new content. I'm not convinced that it is that complex; it seems quite natural (at least to me), and it seems to follow suit with the other XUpdate operators. > 4) I agree this should be clarified. There are other issues that could also benefit from clarification here, such as how to update attribute content. Take care, John L. Clark |