hareko/php-merge-xml — pull request #1 by thefzn (2014-07-11 17:45:11+00:00)
Title: Addition of "Clone" feature

Quick description
---------

This update adds the ability to clone certain nodes. It works similar to the "Stay" feature already included on the class... but this time, when the selected nodes are found on the XML, they will be added without replacing the existing ones.

Examples
---------

Clone nodes as parameters added to the constructor

> $oMX = new MergeXML( array("clone" => "item") );

Clone nodes as parameters included on the AddFile/AddSource methods

> $oMX->AddFile( $fileURL, null, array("object") );
> $oMX->AddSource( $xmlString, null, array("autor") );

Notes
---------

- The "Stay" behavior was also updated in order to match the *tagName* of each node with the array of "Stay" nodes. The script was looking for an attribute named "stay" on the nodes to match the array values before the update.
- The nodes selected to be cloned doesn't need to be marked as "stay" to avoid overwrite.
- The updates doesn't conflict with the "Stay" feature, it is possible to use both at once. Example:

> $oMX->AddSource( $xmlString, array("object","item"), array("autor") );