当前位置: 首页>>代码示例>>PHP>>正文


PHP DOMDocument::createProcessingInstruction方法代码示例

本文整理汇总了PHP中DOMDocument::createProcessingInstruction方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMDocument::createProcessingInstruction方法的具体用法?PHP DOMDocument::createProcessingInstruction怎么用?PHP DOMDocument::createProcessingInstruction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DOMDocument的用法示例。


在下文中一共展示了DOMDocument::createProcessingInstruction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createArticle

function createArticle($aFileName)
{
    $articleDoc = new DOMDocument("1.0", "UTF-8");
    $articleDoc->appendChild($articleDoc->createProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"../component/article/view-article.xsl\""));
    $articleDoc->appendChild($articleDoc->createProcessingInstruction("setter", "href=\"../component/article/setter-article.php\""));
    $articleE = $articleDoc->appendChild($articleDoc->createElementNS("http://formax.cz/ns/article", "article"));
    $articleE->setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "http://formax.cz/ns/article ../component/article/model-article.xsd");
    $articleE->appendChild($articleDoc->createElementNS("http://formax.cz/ns/article", "h", "nový článek"));
    $articleE->appendChild($articleDoc->createElementNS("http://formax.cz/ns/article", "p", "nový článek"));
    $articleDoc->save($aFileName);
}
开发者ID:hynekmusil,项目名称:hr-help,代码行数:11,代码来源:new-article.php

示例2: createCCR

function createCCR($action, $raw = "no")
{
    $authorID = getUuid();
    $patientID = getUuid();
    $sourceID = getUuid();
    $oemrID = getUuid();
    $result = getActorData();
    while ($res = sqlFetchArray($result[2])) {
        ${"labID{$res['id']}"} = getUuid();
    }
    $ccr = new DOMDocument('1.0', 'UTF-8');
    $e_styleSheet = $ccr->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="stylesheet/ccr.xsl"');
    $ccr->appendChild($e_styleSheet);
    $e_ccr = $ccr->createElementNS('urn:astm-org:CCR', 'ContinuityOfCareRecord');
    $ccr->appendChild($e_ccr);
    /////////////// Header
    require_once "createCCRHeader.php";
    $e_Body = $ccr->createElement('Body');
    $e_ccr->appendChild($e_Body);
    /////////////// Problems
    $e_Problems = $ccr->createElement('Problems');
    require_once "createCCRProblem.php";
    $e_Body->appendChild($e_Problems);
    /////////////// Alerts
    $e_Alerts = $ccr->createElement('Alerts');
    require_once "createCCRAlerts.php";
    $e_Body->appendChild($e_Alerts);
    ////////////////// Medication
    $e_Medications = $ccr->createElement('Medications');
    require_once "createCCRMedication.php";
    $e_Body->appendChild($e_Medications);
    ///////////////// Immunization
    $e_Immunizations = $ccr->createElement('Immunizations');
    require_once "createCCRImmunization.php";
    $e_Body->appendChild($e_Immunizations);
    /////////////////// Results
    $e_Results = $ccr->createElement('Results');
    require_once "createCCRResult.php";
    $e_Body->appendChild($e_Results);
    /////////////////// Procedures
    //$e_Procedures = $ccr->createElement('Procedures');
    //require_once("createCCRProcedure.php");
    //$e_Body->appendChild($e_Procedures);
    //////////////////// Footer
    // $e_VitalSigns = $ccr->createElement('VitalSigns');
    // $e_Body->appendChild($e_VitalSigns);
    /////////////// Actors
    $e_Actors = $ccr->createElement('Actors');
    require_once "createCCRActor.php";
    $e_ccr->appendChild($e_Actors);
    if ($action == "generate") {
        gnrtCCR($ccr, $raw);
    }
    if ($action == "viewccd") {
        viewCCD($ccr, $raw);
    }
}
开发者ID:nhom5UET,项目名称:tichhophethong,代码行数:57,代码来源:createCCR.php

示例3: createRssDoc

 private function createRssDoc()
 {
     $doc = new DOMDocument('1.0', 'UTF-8');
     $style = $doc->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="RssStyle.xsl"');
     $doc->appendChild($style);
     $rss = $doc->createElement('rss');
     $rss->setAttribute('version', '2.0');
     $doc->appendChild($rss);
     return $doc;
 }
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:10,代码来源:RssChannel.php

示例4: createCCR

function createCCR($action, $raw = "no")
{
    $authorID = getUuid();
    echo '<!--';
    $ccr = new DOMDocument('1.0', 'UTF-8');
    $e_styleSheet = $ccr->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="ccr.xsl"');
    $ccr->appendChild($e_styleSheet);
    $e_ccr = $ccr->createElementNS('urn:astm-org:CCR', 'ContinuityOfCareRecord');
    $ccr->appendChild($e_ccr);
    /////////////// Header
    require_once "createCCRHeader.php";
    $e_Body = $ccr->createElement('Body');
    $e_ccr->appendChild($e_Body);
    /////////////// Problems
    $e_Problems = $ccr->createElement('Problems');
    require_once "createCCRProblem.php";
    $e_Body->appendChild($e_Problems);
    /////////////// Alerts
    $e_Alerts = $ccr->createElement('Alerts');
    require_once "createCCRAlerts.php";
    $e_Body->appendChild($e_Alerts);
    ////////////////// Medication
    $e_Medications = $ccr->createElement('Medications');
    require_once "createCCRMedication.php";
    $e_Body->appendChild($e_Medications);
    ///////////////// Immunization
    $e_Immunizations = $ccr->createElement('Immunizations');
    require_once "createCCRImmunization.php";
    $e_Body->appendChild($e_Immunizations);
    /////////////////// Results
    $e_Results = $ccr->createElement('Results');
    require_once "createCCRResult.php";
    $e_Body->appendChild($e_Results);
    /////////////////// Procedures
    $e_Procedures = $ccr->createElement('Procedures');
    require_once "createCCRProcedure.php";
    $e_Body->appendChild($e_Procedures);
    //////////////////// Footer
    // $e_VitalSigns = $ccr->createElement('VitalSigns');
    // $e_Body->appendChild($e_VitalSigns);
    /////////////// Actors
    $e_Actors = $ccr->createElement('Actors');
    require_once "createCCRActor.php";
    $e_ccr->appendChild($e_Actors);
    // save created CCR in file
    echo " \n action=" . $action;
    if ($action == "generate") {
        gnrtCCR($ccr, $raw);
    }
    if ($action == "viewccd") {
        viewCCD($ccr, $raw);
    }
}
开发者ID:richsiy,项目名称:openemr,代码行数:53,代码来源:createCCR.php

示例5: add_processing_instruction

 /**
  * Add processing instruction
  *
  * @param string $name
  * @param string $data
  */
 public function add_processing_instruction($name, $data)
 {
     $n = $this->node ? new self($this->owner) : $this;
     $e = $this->doc->createProcessingInstruction($name, $data);
     if (!$this->node) {
         $n->node = $this->node = $this->doc->appendChild($e);
     } else {
         $n->node = $this->node->appendChild($e);
     }
     unset($e);
     return $n;
 }
开发者ID:poppa,项目名称:PLib,代码行数:18,代码来源:builder.php

示例6: DOMDocument

 function dom_standard()
 {
     $dom = new DOMDocument('1.0', 'utf-8');
     if ($this->xslt_src) {
         $xslt = $dom->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . $this->xslt_src . '"');
         $dom->appendChild($xslt);
     }
     $root = $dom->appendChild($dom->createElement('template'));
     $_pagi_actual = $dom->createElement("actual");
     $_pagi_actual->appendChild($dom->createTextNode($this->_pagi_actual));
     $_pagi_inicial = $dom->createElement("inicial");
     $_pagi_inicial->appendChild($dom->createTextNode($this->_pagi_inicial));
     $_pagi_anterior = $dom->createElement("anterior");
     $_pagi_anterior->appendChild($dom->createTextNode($this->_pagi_anterior));
     $_pagi_siguiente = $dom->createElement("siguiente");
     $_pagi_siguiente->appendChild($dom->createTextNode($this->_pagi_siguiente));
     $_pagi_ultimo = $dom->createElement("ultima");
     $_pagi_ultimo->appendChild($dom->createTextNode($this->_pagi_ultimo));
     $_pagi_total_reg = $dom->createElement("total_reg");
     $_pagi_total_reg->appendChild($dom->createTextNode($this->get_total_reg()));
     $_paginas = $dom->createElement("paginas");
     /**
      * Adicion de paginas
      */
     if ($this->_pagi_actual != $this->_pagi_inicial) {
         //for($i=$actual-1;$i>($actual-3)&&$i>=$primera;$i--)
         for ($i = $this->_pagi_actual - 1; $i > $this->_pagi_actual - 3 && $i >= $this->_pagi_inicial; $i--) {
             $arreglo[] = $i;
         }
         if ($arreglo) {
             sort($arreglo);
             if (!in_array($this->_pagi_inicial, $arreglo)) {
                 $this->_intervalo_paginas[] = $this->_pagi_inicial;
                 $nodo = $dom->createElement("num");
                 $nodo->appendChild($dom->createTextNode($this->_pagi_inicial));
                 $_paginas->appendChild($nodo);
             }
             foreach ($arreglo as $_no_pagina) {
                 if ($_no_pagina != $this->_pagi_actual) {
                     $this->_intervalo_paginas[] = $_no_pagina;
                     $nodo = $dom->createElement("num");
                     $nodo->appendChild($dom->createTextNode($_no_pagina));
                     $_paginas->appendChild($nodo);
                 }
             }
         }
     }
     //Pagina actual
     $nodo = $dom->createElement("num");
     $nodo->appendChild($dom->createTextNode($this->_pagi_actual));
     $nodo->setAttribute("actual", true);
     $_paginas->appendChild($nodo);
     if ($this->_pagi_actual != $this->_pagi_ultimo) {
         //for($i=$actual+1;$i<($actual+3)&&$i<=$ultima;$i++)
         for ($i = $this->_pagi_actual + 1; $i < $this->_pagi_actual + 3 && $i <= $this->_pagi_ultimo; $i++) {
             if ($i != $this->_pagi_actual) {
                 $this->_intervalo_paginas[] = $i;
                 $nodo = $dom->createElement("num");
                 $nodo->appendChild($dom->createTextNode($i));
                 $_paginas->appendChild($nodo);
                 $_ultima_pagina = $i;
             }
         }
         /*
         echo "<pre>";
         var_export( $_ultima_pagina );
         echo "</pre>";
         */
         if ($_ultima_pagina) {
             if ($_ultima_pagina < $this->_pagi_ultimo) {
                 $this->_intervalo_paginas[] = $this->_pagi_ultimo;
                 $nodo = $dom->createElement("num");
                 $nodo->appendChild($dom->createTextNode($this->_pagi_ultimo));
                 $_paginas->appendChild($nodo);
             }
         }
     }
     $paginacion = $dom->createElement("paginacion");
     if ($this->_reg_x_pag != $this->_reg_x_pag_default) {
         $_reg_x_pagina = $dom->createElement("reg_x_pag");
         $_reg_x_pagina->appendChild($dom->createTextNode($this->get_reg_x_pag()));
         $paginacion->appendChild($_reg_x_pagina);
     }
     $paginacion->appendChild($_pagi_actual);
     $paginacion->appendChild($_pagi_inicial);
     $paginacion->appendChild($_pagi_anterior);
     $paginacion->appendChild($_pagi_siguiente);
     $paginacion->appendChild($_pagi_ultimo);
     $paginacion->appendChild($_pagi_total_reg);
     $paginacion->appendChild($_paginas);
     $root->appendChild($paginacion);
     return array($root, $dom);
 }
开发者ID:etlapa,项目名称:uiest,代码行数:93,代码来源:class.paginacion_dom.php

示例7: dirname

<?php

require_once dirname(dirname(__FILE__)) . '/config.php';
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Common/Lib/Obj_RankFactory.php';
if (!CheckTourSession()) {
    print get_text('CrackError');
    exit;
}
$MaxNum = 0;
if (isset($_REQUEST["MaxNum"]) && is_numeric($_REQUEST["MaxNum"])) {
    $MaxNum = $_REQUEST["MaxNum"];
}
$ToFit = isset($_REQUEST['ToFitarco']) ? $_REQUEST['ToFitarco'] : null;
$XmlDoc = new DOMDocument('1.0', 'UTF-8');
$TmpNode = $XmlDoc->createProcessingInstruction("xml-stylesheet", 'type="text/xsl" href="/Common/Styles/StyleElimination.xsl" ');
$XmlDoc->appendChild($TmpNode);
$XmlRoot = $XmlDoc->createElement('Results');
$XmlRoot->setAttribute('IANSEO', ProgramVersion);
$XmlRoot->setAttribute('TS', date('Y-m-d H:i:s'));
$XmlDoc->appendChild($XmlRoot);
$ListHeader = NULL;
$options = array();
if (isset($_REQUEST["Event"]) && preg_match("/^[0-9A-Z]{1,4}\$/i", $_REQUEST["Event"])) {
    $options['events'] = array($_REQUEST["Event"]);
}
$family = 'ElimInd';
$rank = Obj_RankFactory::create($family, $options);
$rank->read();
$rankData = $rank->getData();
if (count($rankData['sections'])) {
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:XmlElimination.php

示例8: mysqli

<?php

//$link = new mysqli("localhost","root","","quiz");
$link = new mysqli("mysql.hostinger.es", "u526113874_rb15", "123456789", "u526113874_quiz");
if ($link->connect_errno) {
    die("Huts egin du konexioak MySQL-ra: (" . $link->connect_errno() . ") " . $link->connect_error());
}
$sql = "Delete from galdera";
//Galdera taula osoa borratu
$link->query($sql);
$balioBerriak = $_POST['berria'];
//Balio guztiak lortu berriz
unlink("galderak.xml");
//XML fitxategia borratu
$xml = new DOMDocument();
$xslt = $xml->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="seeXMLQuestions.xsl"');
//Stylesheet gehitzeko
$xml->appendChild($xslt);
$galderak = $xml->createElement("assessmentItems");
$xml->appendChild($galderak);
$xml->save("galderak.xml");
$kopBalioak = count($balioBerriak);
$kontagailua = 0;
$xml2 = simplexml_load_file('galderak.xml');
while ($kontagailua < $kopBalioak) {
    $galdera = $balioBerriak[$kontagailua];
    $kontagailua++;
    $erantzuna = $balioBerriak[$kontagailua];
    $kontagailua++;
    $zailtasuna = $balioBerriak[$kontagailua];
    $kontagailua++;
开发者ID:BZaldua,项目名称:WebSistemak,代码行数:31,代码来源:galderakEditatu2.php

示例9: viewCCD

function viewCCD($ccr, $raw = "no", $requested_by = "")
{
    global $pid;
    $ccr->preserveWhiteSpace = false;
    $ccr->formatOutput = true;
    $ccr->save(dirname(__FILE__) . '/generatedXml/ccrForCCD.xml');
    $xmlDom = new DOMDocument();
    $xmlDom->loadXML($ccr->saveXML());
    $ccr_ccd = new DOMDocument();
    $ccr_ccd->load(dirname(__FILE__) . '/ccd/ccr_ccd.xsl');
    $xslt = new XSLTProcessor();
    $xslt->importStylesheet($ccr_ccd);
    $ccd = new DOMDocument();
    $ccd->preserveWhiteSpace = false;
    $ccd->formatOutput = true;
    $ccd->loadXML($xslt->transformToXML($xmlDom));
    $ccd->save(dirname(__FILE__) . '/generatedXml/ccdDebug.xml');
    if ($raw == "yes") {
        // simply send the xml to a textarea (nice debugging tool)
        echo "<textarea rows='35' cols='500' style='width:95%' readonly>";
        echo $ccd->saveXml();
        echo "</textarea>";
        return;
    }
    if ($raw == "pure") {
        // send a zip file that contains a separate xml data file and xsl stylesheet
        if (!class_exists('ZipArchive')) {
            displayError(xl("ERROR: Missing ZipArchive PHP Module"));
            return;
        }
        $tempDir = $GLOBALS['temporary_files_dir'];
        $zipName = $tempDir . "/" . getReportFilename() . "-ccd.zip";
        if (file_exists($zipName)) {
            unlink($zipName);
        }
        $zip = new ZipArchive();
        if (!$zip) {
            displayError(xl("ERROR: Unable to Create Zip Archive."));
            return;
        }
        if ($zip->open($zipName, ZIPARCHIVE::CREATE)) {
            $zip->addFile("stylesheet/cda.xsl", "stylesheet/cda.xsl");
            $xmlName = $tempDir . "/" . getReportFilename() . "-ccd.xml";
            if (file_exists($xmlName)) {
                unlink($xmlName);
            }
            $e_styleSheet = $ccd->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="stylesheet/cda.xsl"');
            $ccd->insertBefore($e_styleSheet, $ccd->firstChild);
            $ccd->save($xmlName);
            $zip->addFile($xmlName, basename($xmlName));
            $zip->close();
            header("Pragma: public");
            header("Expires: 0");
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Content-Type: application/force-download");
            header("Content-Length: " . filesize($zipName));
            header("Content-Disposition: attachment; filename=" . basename($zipName) . ";");
            header("Content-Description: File Transfer");
            readfile($zipName);
            unlink($zipName);
            unlink($xmlName);
            exit(0);
        } else {
            displayError(xl("ERROR: Unable to Create Zip Archive."));
            return;
        }
    }
    if (substr($raw, 0, 4) == "send") {
        $recipient = trim(stripslashes(substr($raw, 5)));
        $result = transmitCCD($ccd, $recipient, $requested_by);
        echo htmlspecialchars($result, ENT_NOQUOTES);
        return;
    }
    $ss = new DOMDocument();
    $ss->load(dirname(__FILE__) . "/stylesheet/cda.xsl");
    $xslt->importStyleSheet($ss);
    $html = $xslt->transformToXML($ccd);
    echo $html;
}
开发者ID:katopenzz,项目名称:openemr,代码行数:79,代码来源:createCCR.php

示例10: Db

<?php

include "../config/config.php";
include "../config/autoloadapi.php";
$db = new Db();
$db = Db::connect();
// "Create" the document.
$xml = new DOMDocument("1.0", "ISO-8859-15");
//to have indented output, not just a line
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
// ------------- Interresting part here ------------
//creating an xslt adding processing line
$xslt = $xml->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="rssfeed.xsl"');
//adding it to the xml
$xml->appendChild($xslt);
// ----------- / Interresting part here -------------
//adding some elements
$query = "SELECT * FROM book";
$result = $db->query($query);
$books = $xml->createElement("books");
if ($result->num_rows > 0) {
    while ($row = $result->fetch_object()) {
        $book = $xml->createElement("book");
        $id = $xml->createElement("id", $row->id);
        $book->appendChild($id);
        $name = $xml->createElement("name", $row->name);
        $book->appendChild($name);
        $author = $xml->createElement("author", $row->author);
        $book->appendChild($author);
        $description = $xml->createElement("description", $row->description);
开发者ID:ucantseeme,项目名称:p1,代码行数:31,代码来源:rss-feed.php

示例11: main

 /**
  * The main method of the PlugIn
  *
  * @access	public
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  *
  * @return	void
  */
 public function main($content, $conf)
 {
     // Initialize plugin.
     $this->init($conf);
     // Turn cache off.
     $this->setCache(FALSE);
     // Get GET and POST variables.
     $this->getUrlParams();
     // Delete expired resumption tokens.
     $this->deleteExpiredTokens();
     // Create XML document.
     $this->oai = new DOMDocument('1.0', 'UTF-8');
     // Add processing instruction (aka XSL stylesheet).
     if (!empty($this->conf['stylesheet'])) {
         // Resolve "EXT:" prefix in file path.
         if (substr($this->conf['stylesheet'], 0, 4) == 'EXT:') {
             list($extKey, $filePath) = explode('/', substr($this->conf['stylesheet'], 4), 2);
             if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey)) {
                 $this->conf['stylesheet'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey) . $filePath;
             }
         }
         $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->conf['stylesheet']);
     } else {
         // Use default stylesheet if no custom stylesheet is given.
         $stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'plugins/oai/transform.xsl');
     }
     $this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8') . '"'));
     // Create root element.
     $root = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'OAI-PMH');
     $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $root->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', 'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd');
     // Add response date.
     $root->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'responseDate', gmdate('Y-m-d\\TH:i:s\\Z', $GLOBALS['EXEC_TIME'])));
     // Get response data.
     switch ($this->piVars['verb']) {
         case 'GetRecord':
             $response = $this->verbGetRecord();
             break;
         case 'Identify':
             $response = $this->verbIdentify();
             break;
         case 'ListIdentifiers':
             $response = $this->verbListIdentifiers();
             break;
         case 'ListMetadataFormats':
             $response = $this->verbListMetadataFormats();
             break;
         case 'ListRecords':
             $response = $this->verbListRecords();
             break;
         case 'ListSets':
             $response = $this->verbListSets();
             break;
         default:
             $response = $this->error('badVerb');
     }
     // Add request.
     $linkConf = array('parameter' => $GLOBALS['TSFE']->id, 'forceAbsoluteUrl' => 1);
     $request = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'request', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'));
     if (!$this->error) {
         foreach ($this->piVars as $key => $value) {
             $request->setAttribute($key, htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8'));
         }
     }
     $root->appendChild($request);
     // Add response data.
     $root->appendChild($response);
     // Build XML output.
     $this->oai->appendChild($root);
     $content = $this->oai->saveXML();
     // Clean output buffer.
     \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
     // Send headers.
     header('HTTP/1.1 200 OK');
     header('Cache-Control: no-cache');
     header('Content-Length: ' . strlen($content));
     header('Content-Type: text/xml; charset=utf-8');
     header('Date: ' . date('r', $GLOBALS['EXEC_TIME']));
     header('Expires: ' . date('r', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
     echo $content;
     // Flush output buffer and end script processing.
     ob_end_flush();
     exit;
 }
开发者ID:jacmendt,项目名称:goobi-presentation,代码行数:94,代码来源:class.tx_dlf_oai.php

示例12: printAll

 public function printAll()
 {
     date_default_timezone_set("Europe/Brussels");
     $xml = new DOMDocument("1.0", "UTF-8");
     //<?xml-stylesheet type="text/xsl" href="xmlstylesheets/trains.xsl"
     $xmlstylesheet = $xml->createProcessingInstruction("xml-stylesheet", 'type="text/xsl" href="xmlstylesheets/trains.xsl"');
     $xml->appendChild($xmlstylesheet);
     $rootNode = $xml->createElement("connections");
     $rootNode->setAttribute("version", "0.2");
     $rootNode->setAttribute("timestamp", date("U"));
     $xml->appendChild($rootNode);
     $conId = 0;
     foreach ($this->connections as $c) {
         /* @var $c Connection */
         $connection = $xml->createElement("connection");
         $connection->setAttribute("id", $conId);
         //DEPART
         $departure = $xml->createElement("departure");
         $station = $xml->createElement("station", $c->getDepart()->getStation()->getName());
         $station->setAttribute("location", $c->getDepart()->getStation()->getY() . " " . $c->getDepart()->getStation()->getX());
         $time0 = $xml->createElement("time", date("H:i", $c->getDepart()->getTime()));
         $date0 = $xml->createElement("date", date("dmy", $c->getDepart()->getTime()));
         $departure->appendChild($time0);
         $departure->appendChild($date0);
         $departure->appendChild($station);
         $connection->appendChild($departure);
         //ARRIVAL
         $arrival = $xml->createElement("arrival");
         $station = $xml->createElement("station", $c->getArrival()->getStation()->getName());
         $station->setAttribute("location", $c->getArrival()->getStation()->getY() . " " . $c->getArrival()->getStation()->getX());
         $time0 = $xml->createElement("time", date("H:i", $c->getArrival()->getTime()));
         $date0 = $xml->createElement("date", date("dmy", $c->getArrival()->getTime()));
         $arrival->appendChild($time0);
         $arrival->appendChild($date0);
         $arrival->appendChild($station);
         $connection->appendChild($arrival);
         $delay = $xml->createElement("delay", "0");
         if ($c->getDepart()->getDelay() > 0) {
             $delay = $xml->createElement("delay", "1");
         }
         $connection->appendChild($delay);
         //OTHER
         $minutes = $c->getDuration() / 60 % 60;
         $hours = floor($c->getDuration() / 3600);
         if ($minutes < 10) {
             $minutes = "0" . $minutes;
         }
         $duration = $xml->createElement("duration", $hours . ":" . $minutes);
         $connection->appendChild($duration);
         //TRAINS
         $trains = $xml->createElement("trains");
         foreach ($c->getVias() as $v) {
             $train = $xml->createElement("train", $v->getVehicle()->getInternalId());
             $trains->appendChild($train);
         }
         $trainArr = $xml->createElement("train", $c->getArrival()->getVehicle()->getInternalId());
         $trains->appendChild($trainArr);
         $connection->appendChild($trains);
         $rootNode->appendChild($connection);
         $conId++;
     }
     echo $xml->saveXML();
 }
开发者ID:janfabry,项目名称:iRail,代码行数:63,代码来源:OldAPIOutput.php

示例13: DOMDocument

<?php

// Create the DOMDocument for the XML output
$xmlDoc = new DOMDocument("1.0");
if ($data['format'] == "xml") {
    // Add reference to the XSLT
    $xsl = $xmlDoc->createProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"" . base_url() . "css/api.xsl\"");
    $xmlDoc->appendChild($xsl);
}
// Get the method called, and build the root node
$call = $data['queryInfo']['call'];
$rootNode = $xmlDoc->createElement("Cloudlog-API");
$parentNode = $xmlDoc->appendChild($rootNode);
// Get the results output
$output = $data[$call . "_Result"];
// Add the queryInfo node
$node = $xmlDoc->createElement("queryInfo");
$queryElement = $parentNode->appendChild($node);
$queryElement->setAttribute("timeStamp", date("r", time()));
$queryElement->setAttribute("calledMethod", $data['queryInfo']['call']);
//$queryElement->setAttribute("queryArgs", $queryArgsString);
$queryElement->setAttribute("resultsCount", count($data['queryInfo']['numResults']));
if (ENVIRONMENT == "development") {
    $debugInfo = $xmlDoc->createElement("debugInfo");
    $debugElement = $queryElement->appendChild($debugInfo);
    $debugElement->setAttribute("dbQuery", $data['queryInfo']['dbQuery']);
    $debugElement->setAttribute("clientVersion", $_SERVER['HTTP_USER_AGENT']);
    $debugElement->setAttribute("requestURI", $_SERVER['REQUEST_URI']);
    #	$debugElement->setAttribute("benchMark", $this->benchmark->marker['total_execution_time_start'].", ".$this->benchmark->marker['loading_time:_base_classes_start'].", ".$this->benchmark->marker['loading_time:_base_classes_end'].", ".$this->benchmark->marker['controller_execution_time_( api / add )_start']);
}
$queryElement->setAttribute("executionTime", $data['queryInfo']['executionTime']);
开发者ID:orio33,项目名称:Cloudlog,代码行数:31,代码来源:index.php

示例14: exit

<?php

require_once __DIR__ . '/../conf/bootstrap.php';
require_once __DIR__ . '/../conf/conf.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
        $GLOBALS["HTTP_RAW_POST_DATA"] = file_get_contents("php://input");
    }
    if (array_key_exists("CONTENT_TYPE", $_SERVER) && strpos($_SERVER["CONTENT_TYPE"], "/xml") !== FALSE) {
        $xmlstr = $GLOBALS["HTTP_RAW_POST_DATA"];
        $params = [];
        parse_str($_SERVER['QUERY_STRING'], $params);
        if (isset($params["xsltDocument"])) {
            $doc = new \DOMDocument();
            $xslt = $doc->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="stylesheets/Archive/' . $params["xsltDocument"] . '"');
            $doc->appendChild($xslt);
            $xml = new \DOMDocument();
            $xml->loadXML($xmlstr);
            $root = $xml->documentElement;
            $newRoot = $doc->importNode($root, true);
            $doc->appendChild($newRoot);
            \XML_Output::tryHTML($doc->saveXML(), true);
            exit(0);
        }
        throw new \Exception("Unsupported Media Type. */xml content type supported only.", 415);
    }
    throw new \Exception("Query param `xsltDocument` not found", 400);
}
throw new \Exception("Method not allowed", 405);
开发者ID:servandserv,项目名称:sf,代码行数:29,代码来源:xsltview.php

示例15: generate_europasslp_xml

function generate_europasslp_xml($userid, $showHTML = false, $locale = 'en_GB', $internaldateformat = 'dmy11', $externaldateformat = '/numeric/long', $convert = false)
{
    // ================================
    // Load values from Mahara database
    // ================================
    // load user's existing contact information
    $element_list = array('firstname' => 'text', 'lastname' => 'text');
    $contactinfo = array('firstname' => null, 'lastname' => null);
    $contactinfo_data = get_records_select_array('artefact', "owner=? AND artefacttype IN (" . join(",", array_map(create_function('$a', 'return db_quote($a);'), array_keys($element_list))) . ")", array($userid));
    if ($contactinfo_data) {
        foreach ($contactinfo_data as $field) {
            $contactinfo[$field->artefacttype] = $field->title;
        }
    }
    // load user's existing demographics information
    $demographics = null;
    try {
        $demographics = artefact_instance_from_type('personalinformation', $userid);
    } catch (Exception $e) {
    }
    // load user's existing mother tongue(s) and foreign language(s)
    $artefact_id = get_field('artefact', 'id', 'artefacttype', 'mothertongue', 'owner', $userid);
    if ($artefact_id !== false) {
        $mothertongue_list = get_records_select_array('artefact_europass_mothertongue', "artefact=?", array($artefact_id));
    } else {
        $mothertongue_list = array();
    }
    $artefact_id = get_field('artefact', 'id', 'artefacttype', 'otherlanguage', 'owner', $userid);
    if ($artefact_id !== false) {
        $otherlanguage_list = get_records_select_array('artefact_europass_otherlanguage', "artefact=?", array($artefact_id));
    } else {
        $otherlanguage_list = array();
    }
    // ======================
    // Dinamically create XML
    // ======================
    $xmlDoc = new DOMDocument('1.0', 'UTF-8');
    // We want a nice output
    //$xmlDoc->formatOutput = true;
    $styleSheet = $xmlDoc->createProcessingInstruction('xml-stylesheet', 'href="http://europass.cedefop.europa.eu/xml/lp_' . $locale . '_V2.0.xsl" type="text/xsl"');
    $xmlDoc->appendChild($styleSheet);
    $rootElement = $xmlDoc->createElement('europass:learnerinfo');
    $rootNode = $xmlDoc->appendChild($rootElement);
    $rootNode->setAttribute('locale', $locale);
    $rootNode->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
    $rootNode->setAttribute('xmlns:europass', 'http://europass.cedefop.europa.eu/Europass/V2.0');
    $rootNode->setAttribute('xsi:schemaLocation', 'http://europass.cedefop.europa.eu/Europass/V2.0 http://europass.cedefop.europa.eu/xml/EuropassSchema_V2.0.xsd');
    $children = array('docinfo', 'prefs', 'identification', 'languagelist');
    foreach ($children as $child) {
        $childRoot = $xmlDoc->getElementsByTagName('europass:learnerinfo')->item(0);
        $childElement = $xmlDoc->createElement($child);
        $childRoot->appendChild($childElement);
    }
    // =======================
    // Dinamically set docinfo
    // =======================
    // Dinamically set issuedate
    $childRoot = $xmlDoc->getElementsByTagName('docinfo')->item(0);
    $childElement = $xmlDoc->createElement('issuedate');
    $childElement->nodeValue = date('Y-m-d\\TH:i:sP');
    $childRoot->appendChild($childElement);
    // Dinamically set xsdversion
    $childRoot = $xmlDoc->getElementsByTagName('docinfo')->item(0);
    $childElement = $xmlDoc->createElement('xsdversion');
    $childElement->nodeValue = 'V2.0';
    $childRoot->appendChild($childElement);
    // Dinamically set comment
    $childRoot = $xmlDoc->getElementsByTagName('docinfo')->item(0);
    $childElement = $xmlDoc->createElement('comment');
    $childElement->nodeValue = 'Automatically generated Europass Language Passport from Mahara e-portfolio data';
    $childRoot->appendChild($childElement);
    // ========================================
    // Dinamically set prefs and identification
    // ========================================
    // Dinamically set first and last name
    $childRoot = $xmlDoc->getElementsByTagName('prefs')->item(0);
    $childElement = $xmlDoc->createElement('field');
    $childElement->setAttribute('name', 'personal.lastName');
    $childElement->setAttribute('before', 'personal.firstName');
    $childRoot->appendChild($childElement);
    $childRoot = $xmlDoc->getElementsByTagName('identification')->item(0);
    $childElement = $xmlDoc->createElement('firstname');
    $childElement->nodeValue = valid_xml_string($contactinfo['firstname']);
    $childRoot->appendChild($childElement);
    $childElement = $xmlDoc->createElement('lastname');
    $childElement->nodeValue = valid_xml_string($contactinfo['lastname']);
    $childRoot->appendChild($childElement);
    // ----------------------------
    // Dinamically set demographics
    // ----------------------------
    $childRoot = $xmlDoc->getElementsByTagName('identification')->item(0);
    $childElement = $xmlDoc->createElement('demographics');
    $childRoot->appendChild($childElement);
    // Dinamically set birthdate
    $childRoot = $xmlDoc->getElementsByTagName('prefs')->item(0);
    $childElement = $xmlDoc->createElement('field');
    $childElement->setAttribute('name', 'personal.birthDate');
    $childElement->setAttribute('keep', !empty($demographics) ? 'false' : 'true');
    $childElement->setAttribute('format', $externaldateformat);
    $childRoot->appendChild($childElement);
//.........这里部分代码省略.........
开发者ID:povsod,项目名称:mahara-artefact-europass,代码行数:101,代码来源:europassxml.php


注:本文中的DOMDocument::createProcessingInstruction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。