當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLWriter::startElementNS方法代碼示例

本文整理匯總了PHP中XMLWriter::startElementNS方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLWriter::startElementNS方法的具體用法?PHP XMLWriter::startElementNS怎麽用?PHP XMLWriter::startElementNS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLWriter的用法示例。


在下文中一共展示了XMLWriter::startElementNS方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: main

function main()
{
    $x = new XMLWriter();
    $x->openMemory();
    $x->setIndent(true);
    $x->startDocument('1.0');
    $x->startElementNS(null, 'startNullPrefix', null);
    $x->startElementNS('', 'startEmptyPrefix', null);
    $x->writeElementNS(null, 'writeNullPrefix', null);
    $x->writeElementNS('', 'writeEmptyPrefix', null);
    $x->endElement();
    $x->endElement();
    $x->endDocument();
    var_dump($x->outputMemory(true));
}
開發者ID:badlamer,項目名稱:hhvm,代碼行數:15,代碼來源:xmlwriter_null_prefix.php

示例2: generateEDMX

 /**
  * Start Generating EDMX file.
  *
  * @return EDMX xml object.
  */
 public function generateEDMX()
 {
     $this->xmlWriter->startElementNS(ODataConnectorForMySQLConstants::EDMX_NAMESPACE_PREFIX, ODataConnectorForMySQLConstants::EDMX_ELEMENT, ODataConnectorForMySQLConstants::EDMX_NAMESPACE_1_0);
     $this->xmlWriter->writeAttribute(ODataConnectorForMySQLConstants::EDMX_VERSION, ODataConnectorForMySQLConstants::EDMX_VERSION_VALUE);
     $this->xmlWriter->endAttribute();
     $this->xmlWriter->startElementNS(ODataConnectorForMySQLConstants::EDMX_NAMESPACE_PREFIX, ODataConnectorForMySQLConstants::EDMX_DATASERVICES_ELEMENT, null);
     $this->xmlWriter->startElement(ODataConnectorForMySQLConstants::SCHEMA);
     $this->xmlWriter->writeAttribute(ODataConnectorForMySQLConstants::NAMESPACE1, $this->schema->namespace);
     $this->xmlWriter->writeAttributeNS(ODataConnectorForMySQLConstants::XMLNS_NAMESPACE_PREFIX, ODataConnectorForMySQLConstants::ODATA_NAMESPACE_PREFIX, null, ODataConnectorForMySQLConstants::ODATA_NAMESPACE);
     $this->xmlWriter->writeAttributeNS(ODataConnectorForMySQLConstants::XMLNS_NAMESPACE_PREFIX, ODataConnectorForMySQLConstants::ODATA_METADATA_NAMESPACE_PREFIX, null, ODataConnectorForMySQLConstants::ODATA_METADATA_NAMESPACE);
     $this->xmlWriter->writeAttribute(ODataConnectorForMySQLConstants::XMLNS_NAMESPACE_PREFIX, ODataConnectorForMySQLConstants::CSDL_VERSION_1_0);
     $this->xmlWriter->endAttribute();
     try {
         $this->writeEntityType();
         $this->writeAssociations();
         $this->writeEntityContainer();
         $this->writeEntityInfo();
         $this->writeMappingDetails();
     } catch (Exception $e) {
         ODataConnectorForMySQLException::createInternalServerError();
     }
     $this->xmlWriter->endElement();
     $this->xmlWriter->endElement();
     $this->xmlWriter->endElement();
     $this->xmlWriter->endElement();
     return $this->xmlWriter->outputMemory(true);
 }
開發者ID:gizur,項目名稱:odatamysqlphpconnect,代碼行數:32,代碼來源:EDMXGenerator.php

示例3: toXmlWriter

 /**
  * Вывод в XMLWriter
  * @codegen true
  * @param XMLWriter $xw
  * @param string $xmlname Имя корневого узла
  * @param string $xmlns Пространство имен
  * @param int $mode
  */
 public function toXmlWriter(\XMLWriter &$xw, $xmlname = self::ROOT, $xmlns = self::NS, $mode = \Adaptor_XML::ELEMENT)
 {
     if ($mode & \Adaptor_XML::STARTELEMENT) {
         $xw->startElementNS(NULL, $xmlname, $xmlns);
     }
     $xw->text($this->_text());
     if ($mode & \Adaptor_XML::ENDELEMENT) {
         $xw->endElement();
     }
 }
開發者ID:servandserv,項目名稱:happymeal,代碼行數:18,代碼來源:NonNegativeInteger.php

示例4: generateBody

 public function generateBody()
 {
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $xmlWriter->startDocument("1.0", "UTF-8");
     $xmlWriter->startElementNS(NULL, "Message", Constants::MNS_XML_NAMESPACE);
     $this->writeMessagePropertiesForSendXML($xmlWriter);
     $xmlWriter->endElement();
     $xmlWriter->endDocument();
     return $xmlWriter->outputMemory();
 }
開發者ID:lizhengqiang,項目名稱:thinkphp,代碼行數:11,代碼來源:SendMessageRequest.php

示例5: generateBody

 public function generateBody()
 {
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $xmlWriter->startDocument("1.0", "UTF-8");
     $xmlWriter->startElementNS(NULL, "Topic", Constants::MNS_XML_NAMESPACE);
     $this->attributes->writeXML($xmlWriter);
     $xmlWriter->endElement();
     $xmlWriter->endDocument();
     return $xmlWriter->outputMemory();
 }
開發者ID:lizhengqiang,項目名稱:thinkphp,代碼行數:11,代碼來源:SetTopicAttributeRequest.php

示例6: write

 public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag)
 {
     $xml = $this->value->asXML();
     // Not all combinations of PHP/libxml support stripping
     // the XML declaration. So, we do it ourselves here.
     if (strlen($xml) >= 6 && !strncmp($xml, '<?xml', 5) && strpos(" \t\r\n", $xml[5]) !== false) {
         $xml = (string) substr($xml, strpos($xml, '?>') + 2);
     }
     $writer->startElementNS('ex', 'dom', 'http://ws.apache.org/xmlrpc/namespaces/extensions');
     $writer->writeRaw($xml);
     $writer->fullEndElement();
 }
開發者ID:fpoirotte,項目名稱:xrl,代碼行數:12,代碼來源:Dom.php

示例7: serialize

 /**
  * Serialize a PlayReadyLicenseResponseTemplate object into a PlayReadyLicenseResponseTemplate XML.
  *
  * @param PlayReadyLicenseResponseTemplate $template
  *
  * @return string The PlayReadyLicenseResponseTemplate XML
  */
 public static function serialize($template)
 {
     self::ValidateLicenseResponseTemplate($template);
     $writer = new \XMLWriter();
     $writer->openMemory();
     $writer->startElementNS(null, 'PlayReadyLicenseResponseTemplate', Resources::PRL_XML_NAMESPACE);
     $writer->writeAttributeNS('xmlns', 'i', null, Resources::XSI_XML_NAMESPACE);
     self::serializeLicenseTemplates($writer, $template->getLicenseTemplates());
     $writer->writeElement('ResponseCustomData', $template->getResponseCustomData());
     $writer->endElement();
     return $writer->outputMemory();
 }
開發者ID:southworkscom,項目名稱:azure-sdk-for-php,代碼行數:19,代碼來源:MediaServicesLicenseTemplateSerializer.php

示例8: generateBody

 public function generateBody()
 {
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $xmlWriter->startDocument("1.0", "UTF-8");
     $xmlWriter->startElementNS(NULL, "Messages", Constants::MNS_XML_NAMESPACE);
     foreach ($this->sendMessageRequestItems as $item) {
         $item->writeXML($xmlWriter, $this->base64);
     }
     $xmlWriter->endElement();
     $xmlWriter->endDocument();
     return $xmlWriter->outputMemory();
 }
開發者ID:yunwuxin,項目名稱:aliyun_mns,代碼行數:13,代碼來源:BatchSendMessageRequest.php

示例9: generateBody

 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();
 }
開發者ID:lizhengqiang,項目名稱:thinkphp,代碼行數:13,代碼來源:BatchDeleteMessageRequest.php

示例10: beginWriteProperty

 /**
  * Write a property
  *
  * @param ODataProperty &$odataProperty Property to be written
  * @param boolean       $isTopLevel     is link top level or not.
  * 
  * @return nothing
  */
 protected function beginWriteProperty(ODataProperty &$odataProperty, $isTopLevel)
 {
     $this->xmlWriter->startElementNS(ODataConstants::ODATA_NAMESPACE_PREFIX, $odataProperty->name, null);
     if ($odataProperty->typeName != null) {
         $this->xmlWriter->startAttributeNs(ODataConstants::ODATA_METADATA_NAMESPACE_PREFIX, ODataConstants::ATOM_TYPE_ATTRIBUTE_NAME, null);
         $this->xmlWriter->text($odataProperty->typeName);
     }
     if ($isTopLevel) {
         $this->xmlWriter->startAttribute(ODataConstants::XMLNS_NAMESPACE_PREFIX);
         $this->xmlWriter->text(ODataConstants::ODATA_METADATA_NAMESPACE);
         $this->xmlWriter->startAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, ODataConstants::ODATA_NAMESPACE_PREFIX, null);
         $this->xmlWriter->text(ODataConstants::ODATA_NAMESPACE);
         $this->xmlWriter->startAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, ODataConstants::ODATA_METADATA_NAMESPACE_PREFIX, null);
         $this->xmlWriter->text(ODataConstants::ODATA_METADATA_NAMESPACE);
     }
     if ($odataProperty->typeName != null || $isTopLevel) {
         $this->xmlWriter->endAttribute();
     }
 }
開發者ID:maxromanov,項目名稱:odataphpprod,代碼行數:27,代碼來源:AtomODataWriter.php

示例11: XMLWriter

<?php

/* $Id$ */
$xw = new XMLWriter();
$xw->openMemory();
$xw->setIndent(TRUE);
$xw->setIndentString('   ');
$xw->startDocument('1.0', "UTF-8");
$xw->startElement('root');
$xw->startElementNS('ns1', 'child1', 'urn:ns1');
$xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&');
$xw->writeElement('chars', "special characters: <>\"'&");
$xw->endElement();
$xw->endDocument();
// Force to write and empty the buffer
$output = $xw->flush(true);
print $output;
開發者ID:gleamingthecube,項目名稱:php,代碼行數:17,代碼來源:ext_xmlwriter_tests_OO_010.php

示例12: toXml

 /**
  * Writes this SourceDescription to an XML writer.
  *
  * @param \XMLWriter $writer The XML writer.
  * @param bool $includeNamespaces Whether to write out the namespaces in the element.
  */
 public function toXml(\XMLWriter $writer, $includeNamespaces = true)
 {
     $writer->startElementNS('gx', 'sourceDescription', null);
     if ($includeNamespaces) {
         $writer->writeAttributeNs('xmlns', 'gx', null, 'http://gedcomx.org/v1/');
     }
     $this->writeXmlContents($writer);
     $writer->endElement();
 }
開發者ID:BRGWeb,項目名稱:gedcomx-php,代碼行數:15,代碼來源:SourceDescription.php

示例13: toXml

 /**
  * Writes this ChildAndParentsRelationship to an XML writer.
  *
  * @param \XMLWriter $writer The XML writer.
  * @param bool $includeNamespaces Whether to write out the namespaces in the element.
  */
 public function toXml(\XMLWriter $writer, $includeNamespaces = true)
 {
     $writer->startElementNS('fs', 'childAndParentsRelationship', null);
     if ($includeNamespaces) {
         $writer->writeAttributeNs('xmlns', 'gx', null, 'http://gedcomx.org/v1/');
         $writer->writeAttributeNs('xmlns', 'fs', null, 'http://familysearch.org/v1/');
     }
     $this->writeXmlContents($writer);
     $writer->endElement();
 }
開發者ID:BRGWeb,項目名稱:gedcomx-php,代碼行數:16,代碼來源:ChildAndParentsRelationship.php

示例14: count

PMF_String::init($LANGCODE);
$faq = new PMF_Faq($faqConfig);
$rssData = $faq->getAllOpenQuestions(false);
$num = count($rssData);
$rss = new XMLWriter();
$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->writeAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom');
$rss->startElement('channel');
$rss->writeElement('title', $faqConfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgOpenQuestions']);
$rss->writeElement('description', html_entity_decode($faqConfig->get('main.metaDescription')));
$rss->writeElement('link', $faqConfig->get('main.referenceURL'));
$rss->startElementNS('atom', 'link', 'http://www.w3.org/2005/Atom');
$rss->writeAttribute('rel', 'self');
$rss->writeAttribute('type', 'application/rss+xml');
$rss->writeAttribute('href', $faqConfig->get('main.referenceURL') . 'feed/openquestions/rss.php');
$rss->endElement();
if ($num > 0) {
    $counter = 0;
    foreach ($rssData as $item) {
        if ($counter < PMF_RSS_OPENQUESTIONS_MAX) {
            $counter++;
            $rss->startElement('item');
            $rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item['question'], ENT_COMPAT, 'UTF-8'), 8) . " (" . $item['username'] . ")");
            $rss->startElement('description');
            $rss->writeCdata($item['question']);
            $rss->endElement();
            $rss->writeElement('link', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER['SCRIPT_NAME']) . "?action=open#openq_" . $item['id']);
開發者ID:kapljr,項目名稱:Jay-Kaplan-Farmingdale-BCS-Projects,代碼行數:31,代碼來源:rss.php

示例15: wsdl

 public function wsdl()
 {
     /************************
      ** SETUP XML
      ************************/
     $uri = sprintf("http://%s/api/soap", $_SERVER['HTTP_HOST']);
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(TRUE);
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElementNS('wsdl', 'definitions', 'http://schemas.xmlsoap.org/wsdl/');
     $xml->writeAttributeNS('xmlns', 'soap', NULL, "http://schemas.xmlsoap.org/wsdl/soap/");
     #$xml->writeAttributeNS('xmlns', 'schema', NULL, $uri);
     $xml->writeAttributeNS('xmlns', 'xsd', NULL, "http://www.w3.org/2001/XMLSchema");
     $xml->writeAttributeNS('xmlns', 'xsi', NULL, "http://www.w3.org/2001/XMLSchema-instance");
     $xml->writeAttributeNS('xmlns', 'tns', NULL, "{$uri}");
     $xml->writeAttribute('targetNamespace', "{$uri}");
     #$xml->writeAttribute('name', $this->name);
     $xml->startElementNS('wsdl', 'documentation', NULL);
     $xml->text(sprintf('Auto Generated WSDL For %s Class By Quick_WSDL', $this->name));
     $xml->endElement();
     /************************
      ** TYPES
      ************************/
     $xml->startElementNS('wsdl', 'types', NULL);
     $xml->startElementNS('xsd', 'schema', NULL);
     $xml->writeAttribute('targetNamespace', "{$uri}");
     foreach (array_keys($this->ctes) as $n) {
         $xml->startElementNS('xsd', 'element', NULL);
         $xml->writeAttribute('name', $n);
         $xml->startElementNS('xsd', 'complexType', NULL);
         $xml->startElementNS('xsd', 'sequence', NULL);
         foreach ($this->ctes[$n] as $p) {
             $xml->startElementNS('xsd', 'element', NULL);
             $xml->writeAttribute('name', $p->name);
             $xml->writeAttribute('type', $p->type);
             if ($p->mand) {
                 $xml->writeAttribute('minOccurs', '1');
                 $xml->writeAttribute('maxOccurs', '1');
             } else {
                 $xml->writeAttribute('minOccurs', '0');
                 $xml->writeAttribute('maxOccurs', '1');
             }
             $xml->endElement();
             //element
         }
         $xml->endElement();
         //sequence
         $xml->endElement();
         //complexType
         $xml->endElement();
         //element
     }
     foreach ($this->oper as $o) {
         if (!isset($this->ctes[$o])) {
             $xml->startElementNS('xsd', 'element', NULL);
             $xml->writeAttribute('name', sprintf('%s', $o));
             $xml->startElementNS('xsd', 'complexType', NULL);
             $xml->startElementNS('xsd', 'sequence', NULL);
             foreach ($this->msgs[$o] as $p) {
                 $xml->startElementNS('xsd', 'element', NULL);
                 $xml->writeAttribute('name', $p->name);
                 $xml->writeAttribute('type', $p->type);
                 if ($p->mand) {
                     $xml->writeAttribute('minOccurs', '1');
                     $xml->writeAttribute('maxOccurs', '1');
                 } else {
                     $xml->writeAttribute('minOccurs', '0');
                     $xml->writeAttribute('maxOccurs', '1');
                 }
                 $xml->endElement();
             }
             $xml->endElement();
             //sequence
             $xml->endElement();
             //complexType
             $xml->endElement();
             //element
         }
         if (!isset($this->ctes[sprintf('%sResponse', $o)])) {
             $xml->startElementNS('xsd', 'element', NULL);
             $xml->writeAttribute('name', sprintf('%sResponse', $o));
             $xml->startElementNS('xsd', 'complexType', NULL);
             $xml->startElementNS('xsd', 'sequence', NULL);
             $xml->startElementNS('xsd', 'element', NULL);
             $xml->writeAttribute('name', $this->rets[$o]->name);
             $xml->writeAttribute('type', $this->rets[$o]->type);
             if ($p->mand) {
                 $xml->writeAttribute('minOccurs', '1');
                 $xml->writeAttribute('maxOccurs', '1');
             } else {
                 $xml->writeAttribute('minOccurs', '0');
                 $xml->writeAttribute('maxOccurs', '1');
             }
             $xml->endElement();
             $xml->endElement();
             //sequence
             $xml->endElement();
             //complexType
             $xml->endElement();
//.........這裏部分代碼省略.........
開發者ID:jclifford0251,項目名稱:quickphp,代碼行數:101,代碼來源:quickwsdl.php


注:本文中的XMLWriter::startElementNS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。