You can Element (Split) and Element (Join) your way through the complete XML structure and replace something at the appropriate position.
If you just want to change one element which is deeply nested, you will either have to write a small plugin for that (which takes a XPath and a new Element to place at the found position) or just replace in string form with a RegEx, without converting to XElement first.
Thanks for clearing things up a little bit herbst.
I have tried the first tactic Element (Split) and Element (Join), but the problem I am having is the “replace something at the appropriate position” - that’s the part I don’t understand how to do.
So i use Split first to get to the level i want - 7 levels down. Then I use getSlice on the value spread, followed by setSlice after the transformation of the value. Then I use element join - 7 levels up. Connect the name spreads and value spreads of the rest and boooom… I get red Element nodes and memory leak in vvvv. Goes to 1.5gb then crashes. I wanted to attach the patch, but couldnt.
Plugin writing is not something i can do. Anyone fancy making a rudimentary SetElement plugin?
The RegEx string route just seems like a hack to me. I would ideally like to replace other elements too, so it would be a shame to disregard the beautiful xml structure. Using regex would also be quite difficult, because the tag i need to change is just called “filename” and there is a lot of those.
If anyone can help that would be much appreciated. At least a working example of Element(Split) and Element (join). They both dont have a help patch. :(
Here is a quick Plugin which can probably do that, but I haven’t tested any spreading behaviour etc. etc., so don’t expect it to work like a node should work. Having the same amount of queries as XElements put into could work, though :).