示例#1
0
文件: XmlTrim.php 项目: shevron/stoa
 public function filter($value)
 {
     $this->_initReaderWriter();
     $this->_reader->XML($value);
     $this->_doXmlTrim();
     $this->_writer->endDocument();
     return $this->_writer->outputMemory();
 }
示例#2
0
 public function finalize()
 {
     $this->xml->endElement();
     //root element
     $this->xml->endDocument();
     $this->xml->flush();
     return $this->filename;
 }
示例#3
0
 public function end()
 {
     if (!$this->documentEnded) {
         $this->xmlWriter->endDocument();
         $this->xmlWriter->flush();
         $this->documentEnded = true;
     }
 }
示例#4
0
 /**
  * Get feed as XML string
  *
  * @return string
  */
 public function toString()
 {
     if (!$this->output) {
         $this->xml->endDocument();
         $this->output = $this->xml->outputMemory(true);
     }
     // Remove empty elements
     $this->output = preg_replace('#<[^>]*/>#', '', $this->output);
     return $this->output;
 }
示例#5
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();
 }
示例#6
0
 /**
  * Insert tree-structured array as nodes in XMLWriter
  * and end the current Document.
  *
  * @param $data Array - tree-structured array
  *
  * @throws \Genesis\Exceptions\InvalidArgument
  *
  * @return void
  */
 public function populateNodes($data)
 {
     if (!\Genesis\Utils\Common::isValidArray($data)) {
         throw new \Genesis\Exceptions\InvalidArgument('Invalid data structure');
     }
     // Ensure that the Array position is 0
     reset($data);
     $this->iterateArray(key($data), reset($data));
     // Finish the document
     $this->context->endDocument();
 }
示例#7
0
 public function __toString()
 {
     $this->writer->openMemory();
     $this->writer->startDocument($this->version, $this->encoding);
     $this->writer->startElement($this->root);
     foreach ($this->data as $key => $value) {
         $this->writeElement($key, $value);
     }
     $this->writer->endElement();
     $this->writer->endDocument();
     return $this->writer->outputMemory(true);
 }
 /**
  * Convert the request data into XML.
  *
  * @since 4.3.0
  * @return string
  */
 protected function to_xml()
 {
     if (!empty($this->request_xml)) {
         return $this->request_xml;
     }
     $this->xml = new XMLWriter();
     // Create XML document in memory
     $this->xml->openMemory();
     // Set XML version & encoding
     $this->xml->startDocument('1.0', 'UTF-8');
     $request_data = $this->get_request_data();
     SV_WC_Helper::array_to_xml($this->xml, $this->get_root_element(), $request_data[$this->get_root_element()]);
     $this->xml->endDocument();
     return $this->request_xml = $this->xml->outputMemory();
 }
示例#9
0
 public function creaXml()
 {
     $writer = new XMLWriter();
     //$writer->setIndent(true);
     $csc = 1;
     $writer->openMemory();
     $writer->startDocument();
     $writer->startElement("ROOT");
     while (!$this->rs->EOF) {
         $writer->startElement("registro");
         $writer->startElement("CSC");
         $writer->text($csc);
         $writer->endElement();
         for ($x = 0; $x < $this->rs->FieldCount(); $x++) {
             $fld = $this->rs->FetchField($x);
             $writer->startElement(strtoupper($fld->name));
             $writer->text($this->rs->fields[strtoupper($fld->name)]);
             $writer->endElement();
         }
         $writer->endElement();
         $this->rs->MoveNext();
         $csc++;
     }
     $writer->endElement();
     $writer->endDocument();
     $algo = $writer->outputMemory(true);
     return $algo;
 }
示例#10
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);
 }
示例#11
0
 public function endDocument()
 {
     $this->error = false;
     $this->endElement();
     // ocs
     parent::endDocument();
 }
示例#12
0
 /**
  * Returns the MARCXML collection footer
  *
  * This method produces an XML representation of a MARC record that
  * attempts to adhere to the MARCXML standard documented at
  * http://www.loc.gov/standards/marcxml/
  *
  * @return string           representation of MARC record in MARCXML format
  */
 function toXMLFooter()
 {
     $this->xmlwriter->endElement();
     // end collection
     $this->xmlwriter->endDocument();
     return $this->xmlwriter->outputMemory();
 }
示例#13
0
文件: View.php 项目: peopleplan/Pyrus
 function getDatabase()
 {
     $output = new \XMLWriter();
     if (!$output->openUri('php://output')) {
         throw new Exception('Cannot open output - this should never happen');
     }
     $output->startElement('html');
     $output->startElement('head');
     $output->writeElement('title', 'Enter a path to the database');
     $output->endElement();
     $output->startElement('body');
     $output->writeElement('h2', 'Please enter the path to a coverage database');
     $output->startElement('form');
     $output->writeAttribute('name', 'getdatabase');
     $output->writeAttribute('method', 'GET');
     $output->writeAttribute('action', $this->controller->getTOCLink());
     $output->startElement('input');
     $output->writeAttribute('size', '90');
     $output->writeAttribute('type', 'text');
     $output->writeAttribute('name', 'setdatabase');
     $output->endElement();
     $output->startElement('input');
     $output->writeAttribute('type', 'submit');
     $output->endElement();
     $output->endElement();
     $output->endElement();
     $output->endElement();
     $output->endDocument();
 }
示例#14
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;
 }
 /**
  * Write the service document in Atom format.
  * 
  * @param Object &$dummy Dummy object
  * 
  * @return string
  */
 public function writeRequest(&$dummy)
 {
     $this->_xmlWriter = new \XMLWriter();
     $this->_xmlWriter->openMemory();
     $this->_xmlWriter->startDocument('1.0', 'UTF-8');
     $this->_xmlWriter->startElementNs(null, ODataConstants::ATOM_PUBLISHING_SERVICE_ELEMENT_NAME, ODataConstants::APP_NAMESPACE);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XML_NAMESPACE_PREFIX, ODataConstants::XML_BASE_ATTRIBUTE_NAME, null, $this->_baseUri);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, self::ATOM_NAMESPACE_PREFIX, null, ODataConstants::ATOM_NAMESPACE);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, self::APP_NAMESPACE_PREFIX, null, ODataConstants::APP_NAMESPACE);
     $this->_xmlWriter->startElement(ODataConstants::ATOM_PUBLISHING_WORKSPACE_ELEMNT_NAME);
     $this->_xmlWriter->startElementNs(self::ATOM_NAMESPACE_PREFIX, ODataConstants::ATOM_TITLE_ELELMET_NAME, null);
     $this->_xmlWriter->text(ODataConstants::ATOM_PUBLISHING_WORKSPACE_DEFAULT_VALUE);
     $this->_xmlWriter->endElement();
     foreach ($this->_metadataQueryproviderWrapper->getResourceSets() as $resourceSetWrapper) {
         //start collection node
         $this->_xmlWriter->startElement(ODataConstants::ATOM_PUBLISHING_COLLECTION_ELEMENT_NAME);
         $this->_xmlWriter->writeAttribute(ODataConstants::ATOM_HREF_ATTRIBUTE_NAME, $resourceSetWrapper->getName());
         //start title node
         $this->_xmlWriter->startElementNs(self::ATOM_NAMESPACE_PREFIX, ODataConstants::ATOM_TITLE_ELELMET_NAME, null);
         $this->_xmlWriter->text($resourceSetWrapper->getName());
         //end title node
         $this->_xmlWriter->endElement();
         //end collection node
         $this->_xmlWriter->endElement();
     }
     //End workspace and service nodes
     $this->_xmlWriter->endElement();
     $this->_xmlWriter->endElement();
     $this->_xmlWriter->endDocument();
     $serviceDocumentInAtom = $this->_xmlWriter->outputMemory(true);
     return $serviceDocumentInAtom;
 }
 /**
  * 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;
 }
示例#17
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;
 }
示例#18
0
文件: XMLFio.php 项目: svobodni/web
 /**
  * Render XML
  *
  * @return string
  */
 public function getXml()
 {
     if ($this->content) {
         return $this->content;
     }
     $this->xml->endDocument();
     return $this->content = $this->xml->outputMemory();
 }
示例#19
0
function main()
{
    $x = new XMLWriter();
    $x->openMemory();
    $x->startDocument('1.0', null);
    $x->writeElement('root');
    $x->endDocument();
    var_dump($x->outputMemory(true));
}
 /**
  * Exports the given sites to the XMLWriter
  *
  * @param array<Site> $sites
  * @param string $nodeTypeFilter
  * @return void
  */
 protected function exportSites(array $sites, $nodeTypeFilter)
 {
     $this->xmlWriter->startDocument('1.0', 'UTF-8');
     $this->xmlWriter->startElement('root');
     foreach ($sites as $site) {
         $this->exportSite($site, $nodeTypeFilter);
     }
     $this->xmlWriter->endElement();
     $this->xmlWriter->endDocument();
 }
示例#21
0
文件: XML.php 项目: fewlines/xml
 /**
  * @param string $resource
  */
 private function writeTo($resource)
 {
     $this->writer->openURI($resource);
     $this->writer->startDocument($this->version, $this->encoding);
     $this->writer->setIndent(true);
     $this->writer->setIndentString("\t");
     $this->getRoot()->save($this->writer);
     $this->writer->endDocument();
     $this->writer->flush();
 }
 /**
  * generate export
  * 
  * @return mixed filename/generated object/...
  */
 public function generate()
 {
     $this->_writer = new XMLWriter();
     $this->_writer->openURI('php://output');
     $this->_writer->startDocument("1.0", "iso-8859-1");
     $this->_writer->startElement("phonebooks");
     $this->_writer->startElement("phonebook");
     $this->_exportRecords();
     $this->_writer->endDocument();
     $this->_writer->flush();
 }
 protected function doProcess($inputPath, $outputPath)
 {
     $sitemap = Yaml::parse(file_get_contents($inputPath));
     if (!isset($sitemap['locations'])) {
         throw new PieCrustException("No locations were defined in the sitemap.");
     }
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->startDocument('1.0', 'utf-8');
     $xml->startElement('urlset');
     $xml->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     foreach ($sitemap['locations'] as $loc) {
         $xml->startElement('url');
         // loc
         $locUrl = $this->pieCrust->getConfig()->getValueUnchecked('site/root') . ltrim($loc['url'], '/');
         $xml->writeElement('loc', $locUrl);
         // lastmod
         $locLastMod = null;
         if (isset($loc['lastmod'])) {
             $locLastMod = $loc['lastmod'];
         } else {
             if (isset($loc['lastmod_path'])) {
                 $fullPath = $this->pieCrust->getRootDir() . ltrim($loc['lastmod_path'], '/\\');
                 $locLastMod = date('c', filemtime($fullPath));
             } else {
                 $urlInfo = UriParser::parseUri($this->pieCrust, $loc['url']);
                 if ($urlInfo) {
                     if (is_file($urlInfo['path'])) {
                         $locLastMod = date('c', filemtime($urlInfo['path']));
                     }
                 }
             }
         }
         if (!$locLastMod) {
             throw new PieCrustException("No idea what '" . $loc['url'] . "' is. Please specify a 'lastmod' time, or 'lastmod_path' path.");
         }
         $xml->writeElement('lastmod', $locLastMod);
         // changefreq
         if (isset($loc['changefreq'])) {
             $xml->writeAttribute('changefreq', $loc['changefreq']);
         }
         // priority
         if (isset($loc['priority'])) {
             $xml->writeAttribute('priority', $loc['priority']);
         }
         $xml->endElement();
     }
     $xml->endElement();
     $xml->endDocument();
     $markup = $xml->outputMemory(true);
     file_put_contents($outputPath, $markup);
 }
 protected function createRequestXml()
 {
     $XMLWriter = new \XMLWriter();
     $XMLWriter->openMemory();
     $XMLWriter->setIndent(true);
     $XMLWriter->startDocument("1.0", "UTF-8");
     $XMLWriter->writeComment(\Svea\Helper::getLibraryAndPlatformPropertiesAsJson($this->config));
     $XMLWriter->startElement($this->method);
     $XMLWriter->writeElement("merchantid", $this->config->getMerchantId(\ConfigurationProvider::HOSTED_TYPE, $this->countryCode));
     $XMLWriter->endElement();
     $XMLWriter->endDocument();
     return $XMLWriter->flush();
 }
示例#25
0
 /** returns xml for hosted webservice "annul" request */
 protected function createRequestXml()
 {
     $XMLWriter = new \XMLWriter();
     $XMLWriter->openMemory();
     $XMLWriter->setIndent(true);
     $XMLWriter->startDocument("1.0", "UTF-8");
     $XMLWriter->writeComment(\Svea\Helper::getLibraryAndPlatformPropertiesAsJson($this->config));
     $XMLWriter->startElement($this->method);
     $XMLWriter->writeElement("transactionid", $this->transactionId);
     $XMLWriter->endElement();
     $XMLWriter->endDocument();
     return $XMLWriter->flush();
 }
 public function generateBody()
 {
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $xmlWriter->startDocument("1.0", "UTF-8");
     $xmlWriter->startElementNS(NULL, Constants::RECEIPT_HANDLES, Constants::MNS_XML_NAMESPACE);
     foreach ($this->receiptHandles as $receiptHandle) {
         $xmlWriter->writeElement(Constants::RECEIPT_HANDLE, $receiptHandle);
     }
     $xmlWriter->endElement();
     $xmlWriter->endDocument();
     return $xmlWriter->outputMemory();
 }
示例#27
0
 protected function _convertRoot()
 {
     // Find first <book> element
     while (!($this->_reader->nodeType == XMLReader::ELEMENT && $this->_reader->name == 'book')) {
         $this->_reader->read();
     }
     if (!($this->_reader->nodeType == XMLReader::ELEMENT && $this->_reader->name == 'book')) {
         throw new ErrorException("Unable to find root book element");
     }
     // Find the title attribute
     $bookTitle = $this->_reader->getAttribute('title');
     if (!$bookTitle) {
         throw new ErrorException("Unable to find book title attribute");
     }
     // Start XML and write root element
     $this->_writer->startDocument('1.0', 'UTF-8');
     $this->_writer->startElement('book');
     $this->_writer->writeAttribute('xmlns', 'http://arr.gr/humanhelp/book');
     $this->_writer->writeAttribute('timestamp', time());
     // Write title
     $this->_writer->writeElement('title', $bookTitle);
     // Write default pageFilters
     $this->_writer->startElement('pageFilters');
     $this->_writer->startElement('filter');
     $this->_writer->writeAttribute('class', 'HHLib_XhtmlFilter_FixMediaUrls');
     $this->_writer->endElement();
     $this->_writer->startElement('filter');
     $this->_writer->writeAttribute('class', 'HHLib_XhtmlFilter_FixBSSCPopupUrls');
     $this->_writer->endElement();
     $this->_writer->endElement();
     // Start creating the the TOC
     $this->_writer->startElement('toc');
     while ($this->_reader->read()) {
         if ($this->_reader->nodeType == XMLReader::ELEMENT) {
             switch ($this->_reader->name) {
                 case 'page':
                     $this->_convertPage();
                     break;
                 case 'book':
                     $this->_convertBook();
                     break;
             }
         }
     }
     $this->_writer->endElement();
     // End of <toc> element
     $this->_writer->endElement();
     // End of root <book> element
     $this->_writer->endDocument();
     $this->_writer->flush();
 }
示例#28
0
function GetProjectDetail($projId)
{
    //Return metadata about the columns in each table for a given database (table_schema)
    $qry = "SELECT id, p_name, p_details FROM tb_projects where id = " . $projId;
    date_default_timezone_set('Australia/Sydney');
    error_log("In project_get_detail.php...\n" . $qry);
    $dbConn = opendatabase();
    $result = mysqli_query($dbConn, $qry);
    date_default_timezone_set('Australia/Sydney');
    error_log("Records in Projects: " . mysqli_num_rows($result));
    if (!$result || mysqli_num_rows($result) <= 0) {
        echo "Could not obtain metadata information.";
        return false;
    }
    /*****************************************************************/
    $xml = new XMLWriter();
    //$projXml  = new DOMDocument();
    //$xml->openURI("php://output");
    $xml->openMemory();
    $xml->startDocument();
    $xml->setIndent(true);
    $xml->startElement("projects");
    while ($row = mysqli_fetch_assoc($result)) {
        $xml->startElement("project");
        $xml->writeAttribute('id', $projId);
        $xml->writeRaw($row['p_name']);
        $xml->endElement();
        $xml->startElement("project_details");
        $xml->startCData("details");
        $xml->writeRaw($row['p_details']);
        $xml->endCData();
        $xml->endElement();
    }
    $xml->endElement();
    $xml->endDocument();
    $dbConn->close();
    header('Content-type: text/xml');
    $strXML = $xml->outputMemory(TRUE);
    $xml->flush();
    date_default_timezone_set('Australia/Sydney');
    error_log("String XML:\n " . $strXML);
    //$projXml->loadXML($strXML);
    echo $strXML;
    /*****************************************************************
    	$options = array();
    	while ($row = mysqli_fetch_assoc($result)){
    		$options['object_row'][] = $row;
    	}
    	echo json_encode($options);
    	*****************************************************************/
}
示例#29
0
 protected function finaliseStoreData()
 {
     // Write the end of the xml document
     $this->doc->endElement();
     $this->doc->endDocument();
     // Write dom to file
     $cleanStoreName = str_replace('+', '-', strtolower(urlencode($this->_store->getName())));
     $filename = $cleanStoreName . '-products.xml';
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     $io->write($filename, $this->doc->outputMemory());
     $io->close();
 }
示例#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;
 }