本文整理汇总了PHP中Node::isInherited方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::isInherited方法的具体用法?PHP Node::isInherited怎么用?PHP Node::isInherited使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::isInherited方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepare
/**
* Parser::_prepare()
*
* @access private
*/
function _prepare(&$parent)
{
if (!Node::isInherited($parent)) {
return $this->raiseError('the first argument must be object inherited from Node', E_USER_ERROR, 4);
}
$this->_parent =& $parent;
if (Element::isInherited($parent)) {
$this->_dom =& $parent->ownerDocument;
} else {
$this->_dom =& $parent;
}
}
示例2: _handlePHPPI
/**
* Processing php-code in processing-instruction.
*
* @access private
*/
function _handlePHPPI($data)
{
$_PI_RESULT = null;
$keys = array_keys($GLOBALS);
foreach ($keys as $key) {
${$key} =& $GLOBALS[$key];
}
$eval_result = eval($data . ';');
if ($_PI_RESULT !== null) {
$result =& $_PI_RESULT;
} else {
$result = $eval_result;
}
if ($result === false) {
$errmsg = sprintf('processing-instruction error on line: %s, column: %s', xml_get_current_line_number($this->_parser), xml_get_current_column_number($this->_parser));
return $this->raiseError($errmsg);
} elseif (is_string($result)) {
$this->_characterDataHandler($this->_parser, $result);
} elseif (Node::isInherited($result)) {
$child =& $this->_dom->importNode(&$result, true);
$this->_parent->appendChild(&$child);
}
}
示例3: setContext
/**
* Sets selecting context.
*
* Sets initial context of selecting. But, if you use absolute location
* path, then method evaluate() selects from root of document.
*
* @param array list of objects inherited from Node.
* @param boolean for internal use.
* @access public
*/
function setContext($context, $markup = false)
{
if (!is_array($context)) {
return $this->raiseError('the first argument must be array');
}
foreach ($context as $node) {
if (!Node::isInherited($node)) {
return $this->raiseError('the context must contain objects Node');
}
if ($this->_dom->_ID != $node->ownerDocument->_ID) {
return $this->raiseError('node is used in a different document
than the one that created it');
}
}
$this->_context = $context;
$this->_markup = (bool) $markup;
if ($this->_markup) {
$length = sizeof($this->_context);
for ($n = 0; $n < $length; $n++) {
$this->_context[$n]->_context = $this->_context[$n]->_context ? $this->_context[$n]->_context : $this->_context[$n]->_ID;
}
}
}
示例4:
/**
* Node::_appendChild()
*
* @access private
*/
function &_appendChild(&$newChild)
{
if (!Node::isInherited($newChild)) {
return $this->raiseError('the first argument must be inherited from Node');
}
if ($this->ownerDocument->_ID != $newChild->ownerDocument->_ID) {
return $this->raiseError(WRONG_DOCUMENT_ERR);
}
if ($newChild->nodeType < 1 || $newChild->nodeType > 12) {
return $this->raiseError(NOT_SUPPORTED_ERR);
}
if ($newChild->parentNode !== null) {
$newChild->parentNode->removeChild(&$newChild);
}
if (!$this->firstChild) {
$this->firstChild =& $newChild;
}
$newChild->parentNode =& $this;
$newChild->previousSibling =& $this->lastChild;
$newChild->nextSibling = null;
if ($this->lastChild) {
$this->lastChild->nextSibling =& $newChild;
}
$this->lastChild =& $newChild;
$this->childNodes->addItem(&$newChild);
return $newChild;
}