示例#1
0
 /**
  * Create new XMLWriter
  *
  * @param int $tempLocation Temporary storage location
  * @param string $tempFolder Temporary storage folder
  */
 public function __construct($tempLocation = self::STORAGE_MEMORY, $tempFolder = './')
 {
     // Create internal XMLWriter
     $this->xmlWriter = new \XMLWriter();
     // Open temporary storage
     if ($tempLocation == self::STORAGE_MEMORY) {
         $this->xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->tempFile = @tempnam($tempFolder, 'xml');
         // Open storage
         if ($this->xmlWriter->openUri($this->tempFile) === false) {
             // Fallback to memory...
             $this->xmlWriter->openMemory();
         }
     }
     // Set xml Compatibility
     $compatibility = Settings::getCompatibility();
     if ($compatibility) {
         $this->xmlWriter->setIndent(false);
         $this->xmlWriter->setIndentString('');
     } else {
         $this->xmlWriter->setIndent(true);
         $this->xmlWriter->setIndentString('  ');
     }
 }
示例#2
0
 /**
  * Create new XMLWriter
  *
  * @param int $tempLocation Temporary storage location
  * @param string $tempFolder Temporary storage folder
  */
 public function __construct($tempLocation = self::STORAGE_MEMORY, $tempFolder = './')
 {
     // Create internal XMLWriter
     $this->xmlWriter = new \XMLWriter();
     // Open temporary storage
     if ($tempLocation == self::STORAGE_MEMORY) {
         $this->xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->tempFile = @tempnam($tempFolder, 'xml');
         // Fallback to memory when temporary file cannot be used
         // @codeCoverageIgnoreStart
         // Can't find any test case. Uncomment when found.
         if ($this->xmlWriter->openUri($this->tempFile) === false) {
             $this->xmlWriter->openMemory();
         }
         // @codeCoverageIgnoreEnd
     }
     // Set xml Compatibility
     $compatibility = Settings::hasCompatibility();
     if ($compatibility) {
         $this->xmlWriter->setIndent(false);
         $this->xmlWriter->setIndentString('');
     } else {
         $this->xmlWriter->setIndent(true);
         $this->xmlWriter->setIndentString('  ');
     }
 }
示例#3
0
 protected function setupStoreData()
 {
     // Using XMLWriter because SimpleXML namespaces on attribute names
     $this->doc = new XMLWriter();
     $this->doc->openMemory();
     $this->doc->setIndent(true);
     $this->doc->setIndentString('    ');
     $this->doc->startDocument('1.0', 'UTF-8');
     $this->doc->startElement('feed');
     $this->doc->writeAttribute('xmlns', 'http://www.w3.org/2005/Atom');
     $this->doc->writeAttribute('xmlns:g', 'http://base.google.com/ns/1.0');
     $this->doc->writeElement('title', $this->getConfig('title'));
     $this->doc->startElement('link');
     $this->doc->writeAttribute('rel', 'self');
     $this->doc->writeAttribute('href', $this->_store->getBaseUrl());
     $this->doc->endElement();
     $date = new Zend_Date();
     $this->doc->writeElement('updated', $date->get(Zend_Date::ATOM));
     $this->doc->startElement('author');
     $this->doc->writeElement('name', $this->getConfig('author'));
     $this->doc->endElement();
     $url = $this->_store->getBaseUrl();
     $day = $date->toString('yyyy-MM-dd');
     $path = $this->getConfig('output');
     $filename = $path . '/' . str_replace('+', '-', strtolower(urlencode($this->_store->getName()))) . '-products.xml';
     $this->doc->writeElement('id', 'tag:' . $url . ',' . $day . ':' . $filename);
 }
示例#4
0
 /**
  * Create a new PHPPowerPoint_Shared_XMLWriter instance
  *
  * @param int		$pTemporaryStorage			Temporary storage location
  * @param string	$pTemporaryStorageFolder	Temporary storage folder
  */
 public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './')
 {
     // Create internal XMLWriter
     $this->_xmlWriter = new XMLWriter();
     // Open temporary storage
     if ($pTemporaryStorage == self::STORAGE_MEMORY) {
         $this->_xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
         // Open storage
         if ($this->_xmlWriter->openUri($this->_tempFileName) === false) {
             // Fallback to memory...
             $this->_xmlWriter->openMemory();
         }
     }
     // Set default values
     // proposed to be false in production version
     $this->_xmlWriter->setIndent(true);
     //$this->_xmlWriter->setIndent(false);
     // Set indent
     // proposed to be '' in production version
     $this->_xmlWriter->setIndentString('  ');
     //$this->_xmlWriter->setIndentString('');
 }
示例#5
0
 public function __construct($documentUri, $version = '1.0', $encoding = 'utf-8')
 {
     $this->xmlWriter = new \XMLWriter();
     $this->elementWriter = new ElementWriter($this->xmlWriter);
     $this->xmlWriter->openUri($documentUri);
     $this->xmlWriter->setIndent(true);
     $this->xmlWriter->startDocument($version, $encoding);
 }
示例#6
0
 /**
  * Set and instantiate new UTF-8 XML document
  */
 public function __construct()
 {
     $this->context = new \XMLWriter();
     $this->context->openMemory();
     $this->context->startDocument('1.0', 'UTF-8');
     $this->context->setIndent(true);
     $this->context->setIndentString("  ");
 }
示例#7
0
文件: Xhtml.php 项目: atlcurling/tkt
 /**
  * Constructor
  * 
  * @param PMF_Faq      $faq      PMF_Faq object
  * @param PMF_Category $category PMF_Category object 
  * 
  * return PMF_Export_Xhtml
  */
 public function __construct(PMF_Faq $faq, PMF_Category $category)
 {
     $this->faq = $faq;
     $this->category = $category;
     $this->xml = new XMLWriter();
     $this->xml->openMemory();
     $this->xml->setIndent(true);
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->map = new \XMLWriter();
     $this->map->openMemory();
     $this->map->startDocument('1.0', 'utf-8');
     $this->map->setIndent(true);
     $this->startSitemap();
 }
 /**
  * Construct a new instance of ConnectionParams.
  *
  * @param array &$connectionParams Connection parameters for database.
  */
 public function __construct(&$connectionParams)
 {
     $this->connectionParams = $connectionParams;
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openMemory();
     $this->xmlWriter->startDocument('1.0', 'UTF-8', 'yes');
     $this->xmlWriter->setIndent(4);
 }
示例#10
0
 /**
  * Start document
  *
  * @param mixed $data
  */
 public function startDocument($data)
 {
     $this->checkStartDocument($data);
     $this->isEmpty = true;
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openMemory();
     $this->xmlWriter->setIndent($this->formatOutput);
     $this->xmlWriter->startDocument('1.0', 'UTF-8');
 }
示例#11
0
 /**
  * Defined by ReportInterface.
  *
  * @see ReportInterface::start()
  */
 public function start()
 {
     $this->writer = new XMLWriter();
     $this->writer->openMemory();
     $this->writer->setIndent(true);
     $this->writer->setIndentString('    ');
     $this->writer->startDocument('1.0', 'UTF-8');
     $this->writer->startElement('checkstyle');
     $this->writer->writeAttribute('version', '5.5');
 }
示例#12
0
 /**
  * Converts array with export data to XML format.
  *
  * @param array $array
  *
  * @return string
  */
 public function write(array $array)
 {
     $this->xmlWriter->openMemory();
     $this->xmlWriter->setIndent($this->formatOutput);
     $this->xmlWriter->setIndentString('    ');
     $this->xmlWriter->startDocument('1.0', 'UTF-8');
     $this->fromArray($array);
     $this->xmlWriter->endDocument();
     return $this->xmlWriter->outputMemory();
 }
示例#13
0
 public function initialize(Config $config, $directory, $filenameWithDate = false)
 {
     $this->setFilename($config, $directory, $filenameWithDate);
     $this->xml = new \XMLWriter();
     $this->xml->openUri($this->filename);
     $this->xml->startDocument('1.0', 'utf-8');
     $this->xml->setIndent(true);
     $this->xml->setIndentString('    ');
     $this->xml->writeComment('list of ' . $config->getClassName());
     $this->elementName = strtolower($config->getClassNameLastPart());
     $this->xml->startElement(strtolower($config->getClassNameLastPart(true)));
 }
示例#14
0
 protected function _getWriter()
 {
     $writer = new XMLWriter();
     $writer->openMemory();
     if ($this->_format == self::OUTPUT_PRETTY) {
         $writer->setIndent(TRUE);
         $writer->startDocument('1.0', 'UTF-8');
     } else {
         $writer->setIndent(FALSE);
         $writer->startDocument();
     }
     return $writer;
 }
示例#15
0
文件: Encoder.php 项目: fpoirotte/xrl
 /**
  * Return an XML writer that will be used
  * to produce XML-RPC requests and responses.
  *
  * \retval XMLWriter
  *      XML writer to use to produce documents.
  */
 protected function getWriter()
 {
     $writer = new \XMLWriter();
     $writer->openMemory();
     if ($this->indent) {
         $writer->setIndent(true);
         $writer->startDocument('1.0', 'UTF-8');
     } else {
         $writer->setIndent(false);
         $writer->startDocument();
     }
     return $writer;
 }
示例#16
0
文件: feed.php 项目: karimo255/myblog
 public function index()
 {
     $writter = new \XMLWriter();
     $writter->openMemory();
     $writter->startDocument('1.0', 'UTF-8');
     $writter->setIndent(TRUE);
     $writter->startElement('rss');
     $writter->writeAttribute('version', '2.0');
     $writter->startElement('channel');
     //header
     $writter->writeElement('title', 'phpMint RSS');
     $writter->writeElement('link', 'mein LINK');
     $writter->writeElement('description', 'Ein PHP-Blog über PHP, jQuery, JavaScript und weiteren Technik-Themen.');
     //body
     foreach ($this->getPosts() as $key => $post) {
         $writter->startElement('item');
         $writter->writeElement('title', $post['title']);
         $writter->writeElement('pubDate', $post['datum']);
         $writter->writeElement('link', $post['slug']);
         $writter->writeElement('description', $post['preview']);
         $writter->endElement();
     }
     while ($writter->endElement() !== false) {
         continue;
     }
     $writter->endDocument();
     $test = $writter->outputMemory(TRUE);
     $loger = new \Loger('session');
     $loger->write($test);
     $this->response->addHeader('Content-type: text/xml; charset=UTF-8');
     $this->response->setOutput($test);
 }
 /**
  * Exports the node data of all nodes in the given sub-tree
  * by writing them to the given XMLWriter.
  *
  * @param string $startingPointNodePath path to the root node of the sub-tree to export. The specified node will not be included, only its sub nodes.
  * @param string $workspaceName
  * @param \XMLWriter $xmlWriter
  * @param boolean $tidy
  * @param boolean $endDocument
  * @param string $resourceSavePath
  * @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "TYPO3.Neos:Page", "!TYPO3.Neos:Page,TYPO3.Neos:Text")
  * @return \XMLWriter
  */
 public function export($startingPointNodePath = '/', $workspaceName = 'live', \XMLWriter $xmlWriter = null, $tidy = true, $endDocument = true, $resourceSavePath = null, $nodeTypeFilter = null)
 {
     $this->propertyMappingConfiguration = new ImportExportPropertyMappingConfiguration($resourceSavePath);
     $this->exceptionsDuringExport = array();
     $this->exportedNodePaths = array();
     if ($startingPointNodePath !== '/') {
         $startingPointParentPath = substr($startingPointNodePath, 0, strrpos($startingPointNodePath, '/'));
         $this->exportedNodePaths[$startingPointParentPath] = true;
     }
     $this->xmlWriter = $xmlWriter;
     if ($this->xmlWriter === null) {
         $this->xmlWriter = new \XMLWriter();
         $this->xmlWriter->openMemory();
         $this->xmlWriter->setIndent($tidy);
         $this->xmlWriter->startDocument('1.0', 'UTF-8');
     }
     $this->securityContext->withoutAuthorizationChecks(function () use($startingPointNodePath, $workspaceName, $nodeTypeFilter) {
         $nodeDataList = $this->findNodeDataListToExport($startingPointNodePath, $workspaceName, $nodeTypeFilter);
         $this->exportNodeDataList($nodeDataList);
     });
     if ($endDocument) {
         $this->xmlWriter->endDocument();
     }
     $this->handleExceptionsDuringExport();
     return $this->xmlWriter;
 }
示例#18
0
 /**
  * Create a new \PhpOffice\PhpPowerpoint\Shared\XMLWriter instance
  *
  * @param int $pTemporaryStorage Temporary storage location
  * @param string $pTemporaryStorageDir Temporary storage folder
  */
 public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageDir = './')
 {
     // Create internal XMLWriter
     $this->xmlWriter = new \XMLWriter();
     // Open temporary storage
     if ($pTemporaryStorage == self::STORAGE_MEMORY) {
         $this->xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->tempFileName = @tempnam($pTemporaryStorageDir, 'xml');
         // Open storage
         $this->xmlWriter->openUri($this->tempFileName);
     }
     // Set default values
     $this->xmlWriter->setIndent(true);
 }
示例#19
0
 /**
  * Generate a partial report for a single processed file.
  *
  * Function should return TRUE if it printed or stored data about the file
  * and FALSE if it ignored the file. Returning TRUE indicates that the file and
  * its data should be counted in the grand totals.
  *
  * @param array   $report      Prepared report data.
  * @param boolean $showSources Show sources?
  * @param int     $width       Maximum allowed line width.
  *
  * @return boolean
  */
 public function generateFileReport($report, $showSources = false, $width = 80)
 {
     $out = new XMLWriter();
     $out->openMemory();
     $out->setIndent(true);
     if ($report['errors'] === 0 && $report['warnings'] === 0) {
         // Nothing to print.
         return false;
     }
     $out->startElement('file');
     $out->writeAttribute('name', $report['filename']);
     foreach ($report['messages'] as $line => $lineErrors) {
         foreach ($lineErrors as $column => $colErrors) {
             foreach ($colErrors as $error) {
                 $error['type'] = strtolower($error['type']);
                 if (PHP_CODESNIFFER_ENCODING !== 'utf-8') {
                     $error['message'] = iconv(PHP_CODESNIFFER_ENCODING, 'utf-8', $error['message']);
                 }
                 $out->startElement('error');
                 $out->writeAttribute('line', $line);
                 $out->writeAttribute('column', $column);
                 $out->writeAttribute('severity', $error['type']);
                 $out->writeAttribute('message', $error['message']);
                 $out->writeAttribute('source', $error['source']);
                 $out->endElement();
             }
         }
     }
     //end foreach
     $out->endElement();
     echo $out->flush();
     return true;
 }
示例#20
0
 protected function _internalRender($name)
 {
     $vars = $this->getVars();
     $file = $this->getStream();
     if ($file === false) {
         throw new GlobalServiceException("Impossible to create xml file");
     }
     // Start response object
     fputs($file, '<?xml version="1.0" encoding="UTF-8"?><response>');
     // Temp memory
     $memXml = new XMLWriter();
     $memXml->openMemory();
     $memXml->setIndent(true);
     if (isset($vars['count']) && $this->_countKey) {
         $this->_writeXmlElem($memXml, $this->_countKey, (int) $vars['count']);
         fputs($file, $memXml->outputMemory());
     }
     // Designed for lists only!!!
     if (!empty($vars['data']) && count($vars['data']) && $this->_dataKey) {
         fputs($file, '<' . $this->_dataKey . '>');
         foreach ($vars['data'] as $k => $v) {
             $v = $this->_filterData($v);
             if ($this->_skipEmptyItems && empty($v)) {
                 continue;
             }
             $this->_writeXmlElem($memXml, $k, $v);
             fputs($file, $memXml->outputMemory());
         }
         fputs($file, '</' . $this->_dataKey . '>');
     }
     // End response object
     fputs($file, '</response>');
 }
示例#21
0
 function impersonate_login($admin_user, $admin_pass, $site, $user)
 {
     //create a new xmlwriter object
     $xml = new XMLWriter();
     //using memory for string output
     $xml->openMemory();
     //set the indentation to true (if false all the xml will be written on one line)
     $xml->setIndent(true);
     //create the document tag, you can specify the version and encoding here
     $xml->startDocument();
     //Create an element
     $xml->startElement("tsRequest");
     $xml->startElement("credentials");
     $xml->writeAttribute("name", $admin_user);
     $xml->writeAttribute("password", $admin_pass);
     $xml->startElement("site");
     $xml->writeAttribute("contentUrl", strtoupper($site));
     $xml->endElement();
     //close contentUrl
     $xml->startElement("user");
     $xml->writeAttribute("id", $user);
     $xml->endElement();
     //close user
     $xml->endElement();
     //close credentials
     $xml->endElement();
     //close tsRequest
     return $data_string = $xml->outputMemory();
 }
示例#22
0
 /**
  * @param string $fileToSave
  * @param number $offsetStart
  * @param number $limit
  * @param null | string $suffix
  *
  * @return string
  */
 protected function saveToFile($fileToSave, $offsetStart, $limit, $suffix = null)
 {
     $writer = new \XMLWriter();
     $path = pathinfo($fileToSave);
     $filePath = $path['dirname'] . '/' . $path['filename'];
     if (!is_null($suffix)) {
         $filePath .= self::SEPERATOR . $suffix;
     }
     if (empty($path['extension'])) {
         $filePath .= self::XML_EXT;
     } else {
         $filePath .= '.' . $path['extension'];
     }
     $writer->openURI($filePath);
     $writer->startDocument('1.0', 'UTF-8');
     $writer->setIndent(true);
     $writer->startElement('sitemapindex');
     $writer->writeAttribute('xmlns', self::SCHEMA);
     for ($i = $offsetStart; $i < count($this->items) && $i < $limit; $i++) {
         $item = $this->items[$i];
         $writer->startElement('sitemap');
         $writer->writeElement('loc', $item['url']);
         $writer->writeElement('lastmod', $item['modified']->format(ModifiableInterface::MODIFIED_DATE_FORMAT));
         $writer->endElement();
     }
     $writer->endElement();
     $writer->endDocument();
     return $filePath;
 }
示例#23
0
 public static function xml_list()
 {
     $xw = new XMLWriter();
     $xw->openMemory();
     $xw->startDocument('1.0', 'UTF-8');
     $xw->startElement('Albums');
     $xw->setIndent(true);
     foreach (ORM::factory('Album')->with('genre')->order_by('artist')->order_by('name')->find_all()->as_array() as $album) {
         $xw->startElement('Album');
         $xw->startElement('ID');
         $xw->text($album->id);
         $xw->endElement();
         $xw->startElement('Artist');
         $xw->text($album->artist);
         $xw->endElement();
         $xw->startElement('Name');
         $xw->text($album->name);
         $xw->endElement();
         $xw->startElement('Genre');
         $xw->text($album->genre->name);
         $xw->endElement();
         $xw->endElement();
         // Album
     }
     $xw->endElement();
     // Albums
     $data = $xw->outputMemory(true);
     $xw->flush();
     unset($xw);
     return $data;
 }
示例#24
0
 /**
  * @param Definition $definition
  * @param \XMLWriter $writer
  */
 protected function initialize($writer, Definition $definition)
 {
     $writer->setIndent(true);
     $writer->setIndentString("    ");
     $writer->startDocument("1.0", "UTF-8");
     $writer->startElement($definition->getNodeName() ?: "root");
 }
示例#25
0
 private function generateXML(XmlEntityInterface $xmlEntity)
 {
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $xmlWriter->setIndent(false);
     $xmlEntity->toXML($xmlWriter);
     return $xmlWriter->outputMemory(true);
 }
 protected function getItem()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $item = new Price($xml);
     return $item;
 }
示例#27
0
 /**
  * @param string $source
  *
  * @return fDOMDocument
  *
  * @throws \TheSeer\fDOM\fDOMException
  */
 public function toXML($source)
 {
     $this->writer = new \XMLWriter();
     $this->writer->openMemory();
     $this->writer->setIndent(true);
     $this->writer->startDocument();
     $this->writer->startElement('source');
     $this->writer->writeAttribute('xmlns', 'http://xml.phpdox.net/token');
     $this->writer->startElement('line');
     $this->writer->writeAttribute('no', 1);
     $this->lastLine = 1;
     $tokens = token_get_all($source);
     foreach ($tokens as $pos => $tok) {
         if (is_string($tok)) {
             $line = 1;
             $step = 1;
             while (!is_array($tokens[$pos - $step])) {
                 $step++;
                 if ($pos - $step == -1) {
                     break;
                 }
             }
             if ($pos - $step != -1) {
                 $line = $tokens[$pos - $step][2];
                 $line += count(preg_split('/\\R+/', $tokens[$pos - $step][1])) - 1;
             }
             $token = array('name' => $this->map[$tok], 'value' => $tok, 'line' => $line);
             $this->addToken($token);
         } else {
             $line = $tok[2];
             $values = preg_split('/\\R+/Uu', $tok[1]);
             foreach ($values as $v) {
                 $token = array('name' => token_name($tok[0]), 'value' => $v, 'line' => $line);
                 $this->addToken($token);
                 $line++;
             }
         }
     }
     $this->writer->endElement();
     $this->writer->endElement();
     $this->writer->endDocument();
     $dom = new fDOMDocument();
     $dom->preserveWhiteSpace = false;
     $dom->loadXML($this->writer->outputMemory());
     return $dom;
 }
示例#28
0
 /**
  * Creates a new XML document.
  * 
  * @param	string		$rootElement
  * @param	string		$namespace
  * @param	string		$schemaLocation
  * @param	array<string>	$attributes
  */
 public function beginDocument($rootElement, $namespace, $schemaLocation, array $attributes = array())
 {
     if ($this->activeDocument) {
         throw new SystemException("Could not begin a new document unless the previous is finished");
     }
     if ($this->xml === null) {
         $this->xml = new \XMLWriter();
         $this->xml->openMemory();
         $this->xml->setIndent(true);
         $this->xml->setIndentString("\t");
     }
     $this->xml->startDocument('1.0', 'UTF-8');
     $this->startElement($rootElement);
     $attributes = array_merge($attributes, array('xmlns' => $namespace, 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => $namespace . ' ' . $schemaLocation));
     $this->writeAttributes($attributes);
     $this->activeDocument = true;
 }
示例#29
0
 public function testSetImageType()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $image = new Image($xml);
     $this->setExpectedException('InvalidArgumentException');
     $image->setImageType('Foo');
 }
示例#30
-11
 public static function Encode($requestObject)
 {
     $soap = "";
     try {
         $writer = new XMLWriter();
         $writer->openMemory();
         $writer->startDocument();
         $writer->setIndent(4);
         $writer->startElement("soap:Envelope");
         $writer->writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
         $writer->writeAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
         $writer->writeAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
         $writer->startElement("soap:Body");
         $options = array(XML_SERIALIZER_OPTION_INDENT => '    ', XML_SERIALIZER_OPTION_LINEBREAKS => "\n", XML_SERIALIZER_OPTION_DEFAULT_TAG => '', XML_SERIALIZER_OPTION_TYPEHINTS => false, XML_SERIALIZER_OPTION_IGNORE_NULL => true, XML_SERIALIZER_OPTION_CLASSNAME_AS_TAGNAME => true);
         $serializer = new XML_Serializer($options);
         $result = $serializer->serialize($requestObject);
         if ($result === true) {
             $xml = $serializer->getSerializedData();
             $xml = str_replace('<>', '', $xml);
             $xml = str_replace('</>', '', $xml);
         }
         $writer->writeRaw($xml);
         $writer->endElement();
         $writer->endElement();
         $writer->endDocument();
         $soap = $writer->flush();
         $soap = str_replace("<?xml version=\"1.0\"?>", "", $soap);
     } catch (Exception $ex) {
         throw new Exception("Error occurred while Soap encoding");
     }
     return $soap;
 }