本文整理匯總了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 {