Hi, After sleeping more on it I came out with an less technical way to solve it by marking nodes and pruning all nodes if themselves or their children has not been marked. Från: Henning Phan <henningphan@hotmail.com>
Skickat: den 5 juli 2016 17:56 Till: xml-dev@lists.xml.org Ämne: [xml-dev] How to merge nodes? Hi, I need a sanity check on my idea and also accept alternative solutions.
I have 3 files.
$conf = 5 GB xml file containing the current server configuration
$input= The changes we want to do to $conf, assume each line is a tuple, (unique path to a node and the new value the node should have)
The only way to change the configuration to the server is to upload a configuration file to the server, but because only a fraction of the values might be updated we DO NOT want to want to modify $conf and upload it.
$newConf= The new configuration file containing the updated values from $input and has the same structure as $conf. The file to be uploaded to the server.
Generic case scenario, $conf has higher node diversity and depth. <y attr=""> <z>1</> </y>
(: This file is a result of the input $conf and $input, note that the hiearchy is retained and attributes but only has the updated values from $input :) for $line in $input let $node := extract($conf,$line) merge($newConf, $node) (: This is some sort of update function :) ============= Last words 1. Please help me out with the merge function 2. Anything I forgot to consider? 3. I did look up on streaming transform but I dont see advantages over the current plan because it feels like it would be hard to feed the $input file. And my lack of skills in that area. Thank you for reading, |