本文整理匯總了PHP中Sabre\Xml\Writer::writeAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Writer::writeAttributes方法的具體用法?PHP Writer::writeAttributes怎麽用?PHP Writer::writeAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sabre\Xml\Writer
的用法示例。
在下文中一共展示了Writer::writeAttributes方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: xmlSerialize
/**
* The xmlSerialize metod is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializble should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
* @return void
*/
function xmlSerialize(Writer $writer)
{
$writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
$writer->writeAttributes(['content-type' => 'text/calendar', 'version' => '2.0']);
$writer->endElement();
// calendar-data
$writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
$writer->writeAttributes(['content-type' => 'application/calendar+json']);
$writer->endElement();
// calendar-data
}
示例2: xmlSerialize
/**
* The xmlSerialize metod is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializble should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
* @return void
*/
function xmlSerialize(Writer $writer)
{
foreach ($this->components as $component) {
$writer->startElement('{' . Plugin::NS_CALDAV . '}comp');
$writer->writeAttributes(['name' => $component]);
$writer->endElement();
}
}
示例3: xmlSerialize
/**
* The xmlSerialize metod is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializble should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
* @return void
*/
function xmlSerialize(Writer $writer)
{
foreach ($this->supportedData as $supported) {
$writer->startElement('{' . Plugin::NS_CARDDAV . '}address-data-type');
$writer->writeAttributes(['content-type' => $supported['contentType'], 'version' => $supported['version']]);
$writer->endElement();
// address-data-type
}
}
示例4: writeDataFields
private function writeDataFields(array $fields, Writer $writer)
{
array_map(function (DataField $field) use($writer) {
$writer->startElement(static::nameElement('datafield'));
$writer->writeAttributes(['tag' => $field->getTag(), 'ind1' => $field->getIndicator1(), 'ind2' => $field->getIndicator2()]);
$this->writeSubFields($field->getSubFields(), $writer);
$writer->endElement();
}, $fields);
}