本文整理汇总了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));
}
示例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);
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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;
示例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();
}
示例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();
}
示例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']);
示例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();
//.........这里部分代码省略.........