本文整理汇总了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);
}
示例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();
}
}