本文整理匯總了PHP中DOMNode::lookupPrefix方法的典型用法代碼示例。如果您正苦於以下問題:PHP DOMNode::lookupPrefix方法的具體用法?PHP DOMNode::lookupPrefix怎麽用?PHP DOMNode::lookupPrefix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DOMNode
的用法示例。
在下文中一共展示了DOMNode::lookupPrefix方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add_xsi_type
/**
* @param DOMNode $dom_node
* @param $object
*/
private function add_xsi_type(DOMNode $dom_node, $object)
{
$xsi_type_name = $object['__type'];
if (isset($xsi_type_name) && $xsi_type_name != '') {
$prefix = $dom_node->lookupPrefix($object['__ns']);
$dom_node->setAttribute('xsi:type', (isset($prefix) ? $prefix . ':' : '') . $xsi_type_name);
}
}
示例2: AddXsiType
/**
* Adds the xsi:type to the DOMNode generated from the corresponding object.
* @param DOMNode $domNode the DOM node corresponding to the object
* @param $object the object used to determine the xsi:type
* @access private
*/
private function AddXsiType(DOMNode $domNode, $object)
{
$xsiType = $domNode->getAttributeNS(self::$XSI_NAMESPACE, 'xsi:type');
if (method_exists($object, 'getXsiTypeName') && method_exists($object, 'getNamespace') && empty($xsiType)) {
$xsiTypeName = $object->getXsiTypeName();
if (isset($xsiTypeName) && $xsiTypeName != '') {
$prefix = $domNode->lookupPrefix($object->getNamespace());
$domNode->setAttributeNS(self::$XSI_NAMESPACE, 'xsi:type', (isset($prefix) ? $prefix . ':' : '') . $xsiTypeName);
}
}
}
示例3: collateNamespaces
/**
* Get the namespace of the supplied node, and add it to the list of known namespaces for this document
* @param \DOMNode $node
*/
protected function collateNamespaces(\DOMNode $node)
{
if ($this->config['useNamespaces'] && $node->namespaceURI && !array_key_exists($node->namespaceURI, $this->namespaces)) {
$this->namespaces[$node->namespaceURI] = $node->lookupPrefix($node->namespaceURI);
}
}