dev-master
9999999-dev https://github.com/hareko/php-merge-xmlMerge multiple XML sources from strings, files, DOM objects
MIT BSD
The Requires
- php >=5.3.0
by Vallo Reima
merge xml
Wallogit.com
2017 © Pedro Peláez
Merge multiple XML sources from strings, files, DOM objects
The class allows to merge the XML sources (files, strings, objects) into single DOM XML object. The merging is performed recursively on the node level adding new elements and replacing existing ones. The nodes with the same path/name are replaced/added sequentially and the modification can be controlled by the options., (*1)
MergeXML could be useful in cases where it is necessary to gather XML data from multiple sources. For example, to join the configuration files of different subsystems depending on the system operation., (*2)
$oMX = new MergeXML([$opts]);, (*3)
$opts - the options array:, (*4)
$oMX->AddFile($file);, (*5)
$file - XML file's pathed name, (*6)
$oMX->AddSource($source);, (*7)
$source - XML string or DOM object, (*8)
The methods merge a sequent source and return the final object or false if failed (see error property below)., (*9)
You can search in the result object:, (*10)
$oMX->Query($expr);, (*11)
$expr - XPath query expression, (*12)
You can get the XML result tree:, (*13)
$oMX->Get([0|1|2]);, (*14)
The result object can be accessed also via $oMX->dom property. The properties available:, (*15)
The sources must have the same default namespace (if have at all). Prefix '_' is reserved to handle default namespace., (*16)
The following files are included:, (*17)
The MergeXML is realized also in JavaScript (see github.com)., (*18)
May 2014, (*19)
September 2015, (*20)
December 2015, (*21)
April 2017, (*22)
May 2018, (*23)
July 2019, (*24)
Merge multiple XML sources from strings, files, DOM objects
MIT BSD
merge xml