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


PHP XmlWriter::writeAttributeNS方法代码示例

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


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

示例1: outputXml

/**
 * Construct the whole DCAT-AP document given an array of dump info
 *
 * @param array $data data-blob of i18n and config variables
 * @return string: xmldata
 */
function outputXml(array $data)
{
    // Initializing the XML Object
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->setIndent(true);
    $xml->setIndentString('    ');
    // set namespaces
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElementNS('rdf', 'RDF', null);
    $xml->writeAttributeNS('xmlns', 'rdf', null, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
    $xml->writeAttributeNS('xmlns', 'dcterms', null, 'http://purl.org/dc/terms/');
    $xml->writeAttributeNS('xmlns', 'dcat', null, 'http://www.w3.org/ns/dcat#');
    $xml->writeAttributeNS('xmlns', 'foaf', null, 'http://xmlns.com/foaf/0.1/');
    $xml->writeAttributeNS('xmlns', 'adms', null, 'http://www.w3.org/ns/adms#');
    $xml->writeAttributeNS('xmlns', 'vcard', null, 'http://www.w3.org/2006/vcard/ns#');
    // Calls previously declared functions to construct xml
    writePublisher($xml, $data);
    writeContactPoint($xml, $data);
    $dataset = array();
    // Live dataset and distributions
    $liveDistribs = writeDistribution($xml, $data, 'ld', null);
    if ($data['config']['api-enabled']) {
        $liveDistribs = array_merge($liveDistribs, writeDistribution($xml, $data, 'api', null));
    }
    array_push($dataset, writeDataset($xml, $data, null, $liveDistribs));
    // Dump dataset and distributions
    if ($data['config']['dumps-enabled']) {
        foreach ($data['dumps'] as $key => $value) {
            $distIds = writeDistribution($xml, $data, 'dump', $key);
            array_push($dataset, writeDataset($xml, $data, $key, $distIds));
        }
    }
    writeCatalog($xml, $data, $dataset);
    // Closing last XML node
    $xml->endElement();
    // Printing the XML
    return $xml->outputMemory(true);
}
开发者ID:wikimedia,项目名称:operations-dumps-dcat,代码行数:45,代码来源:DCAT.php

示例2: _generateProperties

 /**
  * Generates the atom XML properties.
  * 
  * @param \XmlWriter $xmlw       The XML writer.
  * @param array      $properties The atom properties.
  * 
  * @return none
  */
 private function _generateProperties($xmlw, $properties)
 {
     foreach ($properties as $key => $value) {
         $content = key($value);
         $attributes = $value[$content];
         $xmlw->startElementNS($this->_dataServicesPrefix, $key, null);
         if (!is_null($attributes)) {
             foreach ($attributes as $attribute => $attributeValue) {
                 $xmlw->writeAttributeNS($this->_dataServicesMetadataPrefix, $attribute, null, $attributeValue);
             }
         }
         $xmlw->text($content);
         $xmlw->endElement();
     }
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:23,代码来源:AtomReaderWriter.php


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