Index: /XmlTools2/trunk/main.cpp
===================================================================
--- /XmlTools2/trunk/main.cpp	(revision 922)
+++ /XmlTools2/trunk/main.cpp	(revision 923)
@@ -19,4 +19,5 @@
 
     bool noBackups=false;
+    bool noVerbose=false;
 
     QCommandLineOption addValuesOption(QStringList() << "a" << "add-values", "Add values to a set of XML elements.");
@@ -41,4 +42,5 @@
     QCommandLineOption xPathExpressionOption(QStringList() << "x" << "xpath-expression", "XPath 1.0 expression to select elements where processing will occur.", "xpath-expression");
     QCommandLineOption noBackupsOption(QStringList()  << "no-backups", "No backups [faster processing].");
+    QCommandLineOption noVerboseOption(QStringList()  << "no-verbose", "Reduce the number of text messages output [faster processing].");
 
     parser.addOption(addValuesOption);
@@ -63,4 +65,5 @@
     parser.addOption(xPathExpressionOption);
     parser.addOption(noBackupsOption);
+    parser.addOption(noVerboseOption);
 
     parser.addVersionOption();
@@ -78,4 +81,9 @@
     if(parser.isSet(noBackupsOption)){
         noBackups=true;
+    }
+
+    // Check if the user doesn't want verbose mode (it boosts XmlTools peformance, lower std output)
+    if(parser.isSet(noVerboseOption)){
+        noVerbose=true;
     }
 
@@ -92,5 +100,5 @@
 
 
-        XmlPatch myXmlPatch(patchFilesWildCard,forceTargetFilesWildcard,noBackups);
+        XmlPatch myXmlPatch(patchFilesWildCard,forceTargetFilesWildcard,noBackups,noVerbose);
         myXmlPatch.readAndProcessPatchFile(); // beging file patch processing
 
@@ -168,8 +176,8 @@
 
     if(parser.isSet(elementNameOption)){
-        myXmlTools=new XmlTools(filesWildCard,filters,noBackups);
+        myXmlTools=new XmlTools(filesWildCard,filters,noBackups,noVerbose);
     }
     else{
-        myXmlTools=new XmlTools(filesWildCard,xPathExpression,noBackups);
+        myXmlTools=new XmlTools(filesWildCard,xPathExpression,noBackups,noVerbose);
     }
 
Index: /XmlTools2/trunk/readme.txt
===================================================================
--- /XmlTools2/trunk/readme.txt	(revision 922)
+++ /XmlTools2/trunk/readme.txt	(revision 923)
@@ -20,13 +20,13 @@
 ----------------------------------
 
--Update a xml node (for example, to reposition an OBAN animation or adjust pelvis height for a TRAM).
+-Update all values in a set of XML elements. (e.g., to reposition an OBAN animation or adjust pelvis height for a TRAM).
 
--Invert a xml node (for example, invert an OBAN animation).
+-Inverts a set of XML elements. (e.g., invert an OBAN animation).
 
--Add new values to XML elements (for example, add the 'unkillable' flag to some characters in a level).
+-Add new values to a set of XML elements (e.g., add the 'unkillable' flag to some characters in a level).
 
--Remove values from XML elements (for example, remove boss shields from characters in a level).
+-Remove values from a set of XML elements (e.g., remove boss shields from characters in a level).
 
--Replace values in XML elements (for example, increase the health of characters by replacing the old HP value).
+-Replace values in a set XML elements (e.g., increase the health of characters by replacing the old HP value).
 
 -Patch file support allows the modder to list multiple commands in a file, to all be performed at once.
@@ -62,19 +62,16 @@
 Change Log:
 ----------------------------------
-2.0, 25-01-2014
+2.0, 04-02-2014
 -Rewrite XmlTools fom the scratch from C# to C++ in order to increase (much!) the performance of the program
--The program now uses the following libraries: Qt5, pugixml, 
-Qt5 Google V8 javascript engine and jsxml js library
--The commands were simplified (they now use the unix like syntax)
+-The program now uses the following libraries: Qt5, pugixml and jsxml js library
+-The commands were simplified (they now use unix like syntax)
 -Update node operation (old updatechainvalues) it now receives the DIFFERENCE between the old value 
 and the new value instead of the new value
 -Update node operation (old updatechainvalues) relation parameter was removed
 -The program now only edits files with .xml extension
+-The program now only reads patches files with .patch or .oni-patch extensions
 -The patch files now have a XmlTools minimum version
--The program now only reads patches files with .patch or .oni-patch extensions
--Some patch files operations were renamed:
-ADDTO -> ADD_INSIDE_NODE
-REMOVE -> REMOVE_NODE
-CUSTOMCODE -> CUSTOM_CODE
+-Some patch files operations were renamed and some extra arguments added
 -Added option to select xml elements by attribute name and value
--Added option to select xml elements by XPath 1.0 (should reduce the need of javascript)
+-Added option to select xml elements by XPath 1.0 (should reduce further the need of javascript)
+-The insertion of xml via patch now support multiple nodes inside <xml></xml> tags
Index: /XmlTools2/trunk/util.cpp
===================================================================
--- /XmlTools2/trunk/util.cpp	(revision 922)
+++ /XmlTools2/trunk/util.cpp	(revision 923)
@@ -171,4 +171,5 @@
     QString pathNormalized;
     QStringList nameWildCard; // entryList requires a QStringList
+    QStringList resultFiles; // result files with absolute path
     int endOfPathIdx;
     QDir directory;
@@ -181,5 +182,5 @@
     pathNormalized=Util::normalizePath(wildcard); // Convert slashes to work in both mac and windows
 
-    if(pathNormalized.contains("/")){
+    if(pathNormalized.contains("/")){ // If contains full path
         endOfPathIdx=Util::indexOfBackward(pathNormalized,"/"); // get last slash
 
@@ -189,12 +190,15 @@
 
         directory=QDir(pathNormalized);
-
-        return directory.entryList(nameWildCard);
-    }
-
-    nameWildCard << wildcard;
-
-    return directory.entryList(nameWildCard);
-}
-
-}
+    }
+    else{ // if relative
+        nameWildCard << wildcard;
+    }
+
+    foreach (QFileInfo fileInfo, directory.entryInfoList(nameWildCard)){
+        resultFiles << fileInfo.absoluteFilePath();
+    }
+
+    return resultFiles;
+}
+
+}
Index: /XmlTools2/trunk/utilxmltools.cpp
===================================================================
--- /XmlTools2/trunk/utilxmltools.cpp	(revision 922)
+++ /XmlTools2/trunk/utilxmltools.cpp	(revision 923)
@@ -43,5 +43,5 @@
 }
 
-void backupFile(const QString &file){
+void backupFile(const QString &file, bool verboseEnabled){
     if(!QFile::exists(file+".bak")){
         if(!Util::backupFile(file)){
@@ -51,5 +51,7 @@
     }
     else{
-        std::cout << "Backup file '" << file.toLatin1().constData() << "'' already exists. Skipping..." << std::endl;
+        if(verboseEnabled){
+            std::cout << "Backup file '" << file.toLatin1().constData() << "'' already exists. Skipping..." << std::endl;
+        }
     }
 }
Index: /XmlTools2/trunk/utilxmltools.h
===================================================================
--- /XmlTools2/trunk/utilxmltools.h	(revision 922)
+++ /XmlTools2/trunk/utilxmltools.h	(revision 923)
@@ -12,5 +12,5 @@
 QStringList getAllXmlFilesByWildcard(const QString &wildcard);
 QStringList getAllPatchFilesByWildcard(const QString &wildcard);
-void backupFile(const QString &file);
+void backupFile(const QString &file, bool verboseEnabled);
 void getAllNamedElements(pugi::xml_node &node, QList<pugi::xml_node> &result, XmlFilter &filters);
 void getAllXpathElements(const QString &xPathExpression, pugi::xml_document &doc, QList<pugi::xml_node> &result);
@@ -22,5 +22,5 @@
 //// inline functions
 
-inline void loadXmlFile(const QString &file, pugi::xml_document &document, pugi::xml_node &rootNode, bool backupsEnabled, const QString &operationForErrorMessage){
+inline void loadXmlFile(const QString &file, pugi::xml_document &document, pugi::xml_node &rootNode, bool backupsEnabled, bool verboseEnabled, const QString &operationForErrorMessage){
 
     pugi::xml_parse_result result = document.load_file(file.toLatin1().constData());
@@ -28,5 +28,7 @@
 
     if(result.status==pugi::status_ok){
-        std::cout << "File '" << file.toLatin1().constData() << "' loaded with sucess." << std::endl;
+        if(verboseEnabled){
+            std::cout << "File '" << file.toLatin1().constData() << "' loaded with sucess." << std::endl;
+        }
     }
     else{
@@ -35,5 +37,5 @@
 
     if(backupsEnabled){
-        UtilXmlTools::backupFile(file); // bake a backup of the file.
+        UtilXmlTools::backupFile(file,verboseEnabled); // bake a backup of the file.
     }
 
Index: /XmlTools2/trunk/xmlpatch.cpp
===================================================================
--- /XmlTools2/trunk/xmlpatch.cpp	(revision 922)
+++ /XmlTools2/trunk/xmlpatch.cpp	(revision 923)
@@ -1,9 +1,10 @@
 #include "xmlpatch.h"
 
-XmlPatch::XmlPatch(QString patchFilesWildcard, QString forceTargetFilesWildcard, bool noBackups)
+XmlPatch::XmlPatch(QString patchFilesWildcard, QString forceTargetFilesWildcard, bool noBackups, bool noVerbose)
 {
     this->patchFilesToProcess=UtilXmlTools::getAllPatchFilesByWildcard(patchFilesWildcard);
     this->forceTargetFilesWildcard=forceTargetFilesWildcard;
     this->backupsEnabled=!noBackups;
+    this->verboseEnabled=!noVerbose;
 
     if(forceTargetFilesWildcard!=""){
@@ -66,5 +67,5 @@
     for(int i=0; i<filesToProcess.size(); i++){
 
-        UtilXmlTools::loadXmlFile(filesToProcess[i],this->document,this->rootNode,this->backupsEnabled,"@ADD_INSIDE_NODES");
+        UtilXmlTools::loadXmlFile(filesToProcess[i],this->document,this->rootNode,this->backupsEnabled,this->verboseEnabled,"@ADD_INSIDE_NODES");
 
         // Check how the element will be fetched via element name or xpath expression
@@ -97,9 +98,14 @@
 
         for(int j=0; j<nodesToInsertion.size(); j++){
-            nodesToInsertion[j].prepend_copy(newNode.first_child()); // append the new node
-        }
-
+            for (pugi::xml_node currNodeToInsert = newNode.first_child(); currNodeToInsert; currNodeToInsert = currNodeToInsert.next_sibling())
+            {
+               nodesToInsertion[j].append_copy(currNodeToInsert); // append the new node
+            }
+
+        }
 
         UtilXmlTools::saveXmlFile(filesToProcess[i],this->document, "@ADD_INSIDE_NODES");
+
+        nodesToInsertion.clear();
     }
 
@@ -122,5 +128,5 @@
     for(int i=0; i<filesToProcess.size(); i++){
 
-        UtilXmlTools::loadXmlFile(filesToProcess[i],this->document,this->rootNode,this->backupsEnabled,"@REMOVE_NODES");
+        UtilXmlTools::loadXmlFile(filesToProcess[i],this->document,this->rootNode,this->backupsEnabled,this->verboseEnabled,"@REMOVE_NODES");
 
         // Check how the element will be fetched via element name or xpath expression
@@ -173,4 +179,6 @@
 
         UtilXmlTools::saveXmlFile(filesToProcess[i],this->document, "@REMOVE_NODES");
+
+        nodesToDeletion.clear();
     }
 
@@ -243,5 +251,5 @@
 
         if(this->backupsEnabled){
-            UtilXmlTools::backupFile(filesToProcess[i]);
+            UtilXmlTools::backupFile(filesToProcess[i], this->verboseEnabled);
         }
 
Index: /XmlTools2/trunk/xmlpatch.h
===================================================================
--- /XmlTools2/trunk/xmlpatch.h	(revision 922)
+++ /XmlTools2/trunk/xmlpatch.h	(revision 923)
@@ -7,5 +7,5 @@
 {
 public:
-    XmlPatch(QString patchFilesWildcard, QString forceTargetFilesWildcard="", bool backupsEnabled=true);
+    XmlPatch(QString patchFilesWildcard, QString forceTargetFilesWildcard, bool backupsEnabled, bool noVerbose);
     void readAndProcessPatchFile();
 private:
@@ -14,5 +14,5 @@
     pugi::xml_document document;
     pugi::xml_node rootNode;
-    bool backupsEnabled;
+    bool backupsEnabled, verboseEnabled;
     QString getPatchParameterValue(const QString& line, QString parameter);
     void insertNodesOperation(const QString &xmlString, XmlFilter &filters, const QString &xPathExpression, const QString &filesWildcard="");
Index: /XmlTools2/trunk/xmltools.cpp
===================================================================
--- /XmlTools2/trunk/xmltools.cpp	(revision 922)
+++ /XmlTools2/trunk/xmltools.cpp	(revision 923)
@@ -2,9 +2,10 @@
 
 // Filters constructor
-XmlTools::XmlTools(QString filesWildcard, XmlFilter filter, bool noBackups)
+XmlTools::XmlTools(QString filesWildcard, XmlFilter filter, bool noBackups, bool noVerbose)
 {
     this->filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard);
     this->filters=filter;
     this->backupsEnabled=!noBackups;
+    this->verboseEnabled=!noVerbose;
 
     if(this->filesToProcess.isEmpty()){
@@ -14,9 +15,10 @@
 
 // XPath constructor
-XmlTools::XmlTools(QString filesWildcard, QString xPathExpression, bool noBackups)
+XmlTools::XmlTools(QString filesWildcard, QString xPathExpression, bool noBackups, bool noVerbose)
 {
     this->filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard);
     this->xPathExpression=xPathExpression;
     this->backupsEnabled=!noBackups;
+    this->verboseEnabled=!noVerbose;
 }
 
@@ -30,5 +32,5 @@
         QList<pugi::xml_node> elements;
 
-        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled,"add-values");
+        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled,this->verboseEnabled,"add-values");
 
         newValuesList=Util::qStringListFromSpacedString(newValues);
@@ -71,5 +73,5 @@
         bool elementChanged=false;
 
-        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, "remove-values");
+        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, this->verboseEnabled, "remove-values");
 
         // Check how the elements will be fetched via element name or xpath expression
@@ -118,5 +120,5 @@
         bool elementChanged=false;
 
-        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, "replace-value");
+        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, this->verboseEnabled, "replace-value");
 
         // Check how the elements will be fetched via element name or xpath expression
@@ -158,5 +160,5 @@
         QList<pugi::xml_node> elements;
 
-        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, "replace-all");
+        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, this->verboseEnabled, "replace-all");
 
         // Check how the elements will be fetched via element name or xpath expression
@@ -198,5 +200,5 @@
         MultiDimVar newXmlValue(0); // value that will update currValue
 
-        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, "update-elements");
+        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled,this->verboseEnabled, "update-elements");
 
         // Check how the elements will be fetched via element name or xpath expression
@@ -242,5 +244,5 @@
     // Process all XmlFiles
     for(int i=0; i<this->filesToProcess.size(); i++){
-        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, "invert-elements");
+        UtilXmlTools::loadXmlFile(this->filesToProcess[i],this->document,this->rootNode,this->backupsEnabled, this->verboseEnabled, "invert-elements");
 
         QList<pugi::xml_node> elements;
Index: /XmlTools2/trunk/xmltools.h
===================================================================
--- /XmlTools2/trunk/xmltools.h	(revision 922)
+++ /XmlTools2/trunk/xmltools.h	(revision 923)
@@ -25,6 +25,6 @@
 {
 public:
-    XmlTools(QString filesWildcard, XmlFilter filter, bool noBackups);
-    XmlTools(QString filesWildcard, QString xPathExpression, bool noBackups);
+    XmlTools(QString filesWildcard, XmlFilter filter, bool noBackups, bool noVerbose);
+    XmlTools(QString filesWildcard, QString xPathExpression, bool noBackups, bool noVerbose);
     void addValues(QString newValues);
     void removeValues(QString valuesToRemove);
@@ -40,5 +40,5 @@
     QString xPathExpression;
     XmlFilter filters;
-    bool backupsEnabled;
+    bool backupsEnabled, verboseEnabled;
 };
 
