W dniu 3 marca 2010 03:40 użytkownik Jon Cruz <jon@...18...> napisał:
*) When XML nodes are private, it's much easier to implement backwards compatibility - we just implement the reading of obsolete versions in the corresponding SP object.
Ooh, I'd *VERY* strongly recommend against that. It is basically the design pattern taken by Microsoft for the MS Word "format" and leads to all sorts of problems. Backwards compatibility is made much more difficult by such an approach.
Before you said that separating the XML <-> SP transformation from SPObjects into some external entity is bad. Now you say that leaving it in SPObjects is bad. I'm somewhat confused :)
"Making XML private" doesn't mean removing all access to it. The SPObject could still access its XML representation directly, and the "repr" variable wouldn't go away, so there still would be two more-or-less parallel trees. The undo stack would still have access to the XML tree, as well as a few other things that work better at the XML level. But all "semantic" operations, like pasting objects or modifying their shape, would work on the semantic tree (SP) using new, semantic methods like "pasteObjects()" or "setLayer()". It would also be possible for the SP hierarchy not to match the XML hierarchy (for example when svg:switch elements are present). This way we can change the XML representation easily, because we only need to modify the affected SPObjects.
Regards, Krzysztof