Sam Ruby has an insightful response to Joe Gregorio in his post
APP Level Patch where he writes
Joe Gregorio: At Google we are considering using PATCH. One of the big open questions surrounding that decision is XML patch formats. What have you found for patch formats and associated libraries?
I believe that looking for an XML patch format is looking for a solution at the wrong meta level. Two examples, using AtomPub:
- In Atom, the order of elements in an entry is not significant. AtomPub servers often do not store their data in XML serialized form, or even in DOM form. If you PUT an entry, and then send a PATCH based on the original serialization, it may not be understood.
- A lot of data in this world is either not in XML, or if it is in XML, is simply there via tunneling. Atom elements are often merely thin wrappers around HTML. HTML has a DOM, and can flattened into a sequence of SAX like events, just like XML can be.
I totally agree with Sam. A generic “XML patch format” is totally the wrong solution. At Microsoft we had several different XML patch formats produced by the same organization because each targetted a different scenario
- Diffgram: Represent a relational database table and changes to it as XML.
- UpdateGram: Represent changes to an XML view of one or more relational database tables optionally including a mapping from relational <-> XML data
- Patchgram: Represent infoset level differences between two XML documents
Of course, these are one line sumarries but you get the point. Depending on your constraints, you’ll end up with a different set of requirements. Quick test, tell me why one would choose Patchgrams over XUpdate and vice versa?
Given the broad set of constraints that will exist in different server implementations of the Atom Publishing Protocol, a generic XML patch format will have lots of features which just don’t make sense (e.g. XUpdate can create processing instructions, Patchgrams use document ordered positions of nodes for matching).
If you decide you really need a patch format for Atom documents, your best bet is working with the community to define one or more which are specific to the unique constraints of the Atom syndication format instead of hoping that there is a generic XML patch format out there you can shoehorn into a solution. In the words of Joe Gregorio’s former co-worker, “I make it fit!”.
Personally, I think you’ll still end up with so many different requirements (Atom stores backed by actual text documents will have different concerns from those backed by relational databases) and spottiness in supporting the capability that you are best off just walking away from this problem by fixing your data model. As I said before, if you have sub-resources which you think should be individually editable then give them a URI and make them resources as well complete with their own atom:entry
element.
Now playing: Oomp Camp - Time To Throw A Chair