XML-Twig - Re: Determining if twig has been modified

Posted on Thu Aug 16 21:07:53 2007 by mirod in response to 5894 (See the whole thread of 3)
Re: Determining if twig has been modified

At the moment there is nothing that tells you whether a twig was changed, and adding that would be both difficult and bad for performances. What you can do is set a flag in any piece of code that would modify the twig. Maybe you could even automate that to a point by using Hook::LexWrap or something similar. An other option is to subclass XML::Twig::Elt and to redefine the methods that are likely to be used to change the twig (once again, you could use Hook::LexWrap to do this automagically) so they set a flag. Saddly enough the complete list of those methods doesn't exist, and is pretty long. Plus what happens if, for example, you cut an element and then paste it back in the same position?

If you posted a detailed example, I could probably suggest some other ways to do this (how about diffing the input xml and the output, if they aren't too big?).

--
mirod

Direct Responses: 5916 | Write a response