本文整理汇总了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);
}
}