本文整理汇总了PHP中XMLWriter::startAttributeNs方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::startAttributeNs方法的具体用法?PHP XMLWriter::startAttributeNs怎么用?PHP XMLWriter::startAttributeNs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLWriter
的用法示例。
在下文中一共展示了XMLWriter::startAttributeNs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: function
setFn('Render', function ($Call) {
$XML = new XMLWriter();
$XML->openMemory();
$XML->startDocument('1.0', 'UTF-8');
$XML->setIndent(true);
if (isset($Call['Output']['Root'])) {
$XML->startElement($Call['Output']['Root']);
if (isset($Call['Namespace'])) {
$XML->startAttribute('xmlns');
$XML->text($Call['Namespace']);
$XML->endAttribute();
}
if (isset($Call['Attributes'])) {
foreach ($Call['Attributes'] as $Key => $Value) {
if (is_array($Value)) {
$XML->startAttributeNs($Value['Prefix'], $Value['Key'], null);
$XML->text($Value['Value']);
} else {
$XML->startAttribute($Key);
$XML->text($Value);
}
$XML->endAttribute();
}
}
$Root = '';
F::Map($Call['Output']['Content'], function ($Key, $Value) use($XML, &$Root) {
if (substr($Key, 0, 1) == '@') {
$XML->startAttribute(substr($Key, 1));
$XML->text($Value);
$XML->endAttribute();
} else {