Simple XML templates like these ones :structure.xml :\[code\]<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><document><book>first book</book><book>second book</book>((other_books))</document>\[/code\]book_element.xml :\[code\]<book>((name))</book>\[/code\]And this test :\[code\] <?phpHeader("Content-type: text/xml; charset=UTF-8");class XMLTemplate extends DOMDocument{ private $_content_storage; private $_filepath; private $_tags; public function XMLTemplate( $sFilePath ) { if( !file_exists( $sFilePath ) ) throw new Exception("file not found"); $this->_filepath = $sFilePath; $this->_tags = []; $this->_content_storage = file_get_contents( $this->_filepath ); } public function Get() { $this->merge(); $this->loadXML( $this->_content_storage ); return $this->saveXML(); } public function SetTag( $sTagName, $sReplacement ) { $this->_tags[ $sTagName ] = $sReplacement; } private function merge() { foreach( $this->_tags as $k=>$v) { $this->_content_storage = preg_replace( "/\({2}". $k ."\){2}/i", $v, $this->_content_storage ); } $this->_content_storage = preg_replace( "/\({2}[a-z0-9_\-]+\){2}/i", "", $this->_content_storage ); }}$aBooks = [ "troisi