public function Save() { $this->xml->asXML($this->configurationFilePath); }
function testPostNewSalesInvoiceXml() { echo "Starting test: testPostNewSalesInvoiceXml" . "<br />"; echo "-------------------------------------------------------------------------------------<br />"; echo "POST new sales invoice in XML format:" . "<br />"; $guid = NewGuid(); echo "New GUID = {$guid}"; echo "<br />"; $date = date('Y-m-d'); $taxRate = 0.15; $taxCode = "G.S.T."; // creating an xml object in PHP: $invoice = new simpleXMLElement('<SalesInvoice />'); // set all the properties of the sales invoice // use simple xml, not stdClass $invoice->Guid = "{$guid}"; $invoice->OrderNumber = substr($guid, 0, 15); $invoice->OrderDate = $date; $invoice->RequiredDate = $date; $invoice->OrderStatus = "Parked"; $invoice->Customer->CustomerCode = "ACE001"; $invoice->Currency->CurrencyCode = "NZD"; $invoice->Warehouse->WarehouseCode = "W1"; $invoice->Tax->TaxCode = $taxCode; $lines = $invoice->addChild('SalesOrderLines'); addSalesInvoiceLineXml($lines, 1, 'ANIMAL', 5, 10, $taxRate); addSalesInvoiceLineXml($lines, 2, 'BISCUIT', 10, 2, $taxRate); addSalesInvoiceLineXml($lines, 3, 'CANDY', 1, 25, $taxRate); $invoice->SubTotal = 95.0; $invoice->TaxTotal = 14.25; $invoice->Total = 109.25; echo "Input data:" . "<br />"; echo htmlentities($invoice->asXML()); echo "<br />"; echo "Input id:" . "<br />"; echo $invoice->Guid; echo "<br />"; echo "<br />"; $xmlPost = postSalesInvoice($invoice, "xml", $invoice->Guid); echo "Output data:" . "<br />"; echo htmlentities($xmlPost->asXML()); }
// Fetch Stations $conqStationIdArray = array(); $conqStationNameArray = array(); $conqstListURL = "https://api.eveonline.com/eve/ConquerableStationList.xml.aspx"; $conqstListXml = new simpleXMLElement($conqstListURL, NULL, TRUE); foreach ($conqstListXml->result->rowset->row as $row) { array_push($conqStationIdArray, $row['stationID']); array_push($conqStationNameArray, $row['stationName']); } // Fetch Assets $assetListURL = "http://api.eveonline.com/corp/AssetList.xml.aspx?keyID=" . $corpKeyID . "&vCode=" . $corpVcode; $assetListXml = new simpleXMLElement($assetListURL, NULL, TRUE); $doc = new DOMDocument('1.0'); $doc->preserveWhiteSpace = false; $doc->formatOutput = true; $doc->loadXML($assetListXml->asXML()); $doc->save("/xml/AssetList.xml"); echo "<h3>" . $assetListXml->currentTime . " ETC</h3>"; echo "<table cellspacing='5' cellpadding='5' border='1' align='center'>"; echo "<tr>"; echo "<td><b>Icon</b></td>"; echo "<td><b>Asset Name</b></td>"; echo "<td><b>Asset ID</b></td>"; echo "<td><b>Asset Location ID</b></td>"; echo "<td><b>Asset Location Name</b></td>"; echo "</tr>"; foreach ($assetListXml->result->rowset->row as $row) { if ($row['typeID'] == 19724 || $row['typeID'] == 19726 || $row['typeID'] == 19720 || $row['typeID'] == 19722) { $inventoryLocation = intval($row['locationID']) - 6000001; $q = mysql_query("SELECT * FROM staStations WHERE stationID='{$inventoryLocation}'"); $r = mysql_fetch_array($q);
<?php $xml_element = new simpleXMLElement('<root></root>'); $xml_element->node1 = 'a & b'; print $xml_element->node1 . "\n"; $xml_element->node1 = 'a & b'; print $xml_element->node1 . "\n"; $xml_element->addChild('node2', 'a & b'); print $xml_element->node2 . "\n"; $xml_element->node2 = 'a & b'; print $xml_element->node2 . "\n"; print $xml_element->asXML(); ?> ===DONE===
$wsdlcontents = file_get_contents($wsdl); if (!$wsdlcontents) { die('Failed to load wsdl ' . $wsdl); } $wsdlxe = new simpleXMLElement($wsdlcontents); // Remove doc elements (causing issues with wsdl parser). $docels = $wsdlxe->xpath('//wsdl:documentation'); $docelsarr = []; foreach ($docels as $docel) { $docelsarr[] = $docel; } foreach ($docelsarr as $docel) { unset($docel[0]); } // Create local wsdl. $wsdlxe->asXML(__DIR__ . '/wsdl.xml'); $whitelist = ['Html', 'Apollo', 'UrlResponse', 'ServerConfiguration', 'Success']; $htmlels = $wsdlxe->xpath('//xs:complexType | //xs:element'); $soapclasses = ['SASDefaultAdapter']; foreach ($htmlels as $htmlel) { $name = '' . $htmlel->attributes()['name']; foreach ($whitelist as $witem) { if (stripos($name, $witem) !== false) { $soapclasses[] = $name; break; } } } $localwsdl = $CFG->wwwroot . '/mod/collaborate/wsdl.xml'; $generator = new \Wsdl2PhpGenerator\Generator(); $generator->generate(new \Wsdl2PhpGenerator\Config(array('inputFile' => $localwsdl, 'outputDir' => $outputdir, 'namespaceName' => 'mod_collaborate\\soap\\generated', 'classNames' => implode(',', $soapclasses))));