本文整理汇总了PHP中DOMElement::appendNewElementWithChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMElement::appendNewElementWithChildren方法的具体用法?PHP DOMElement::appendNewElementWithChildren怎么用?PHP DOMElement::appendNewElementWithChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::appendNewElementWithChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: describeIdentifier
/**
* Outputs description element child describing the repository's OAI
* identifier implementation.
*
* @param DOMElement $parentElement Parent DOM element for XML output
*/
public static function describeIdentifier($parentElement)
{
$elements = array('scheme' => 'oai', 'repositoryIdentifier' => self::$namespaceId, 'delimiter' => ':', 'sampleIdentifier' => self::itemtoOaiId(1));
$oaiIdentifier = $parentElement->appendNewElementWithChildren('oai-identifier', $elements);
//must set xmlns attribute manually to avoid DOM extension appending
//default: prefix to element name
$oaiIdentifier->setAttribute('xmlns', self::OAI_IDENTIFIER_NAMESPACE_URI);
$oaiIdentifier->setAttribute('xsi:schemaLocation', self::OAI_IDENTIFIER_NAMESPACE_URI . ' ' . self::OAI_IDENTIFIER_SCHEMA_URI);
}
示例2: appendHeader
/**
* Appends the record's header to the XML response.
*
* Adds the identifier, datestamp and setSpec to a header element, and
* appends in to the document.
*
* @param DOMElement $parentElement
* @param Item $item
*/
public function appendHeader($parentElement, $item)
{
$headerData['identifier'] = OaiPmhRepository_OaiIdentifier::itemToOaiId($item->id);
$headerData['datestamp'] = OaiPmhRepository_Date::dbToUtc($item->modified);
$collection = $item->getCollection();
if ($collection && $collection->public) {
$headerData['setSpec'] = $collection->id;
}
$parentElement->appendNewElementWithChildren('header', $headerData);
}