XPath**********************************************************************************************
=============================================================================================== X P a t h E n g i n e - Class =============================================================================================== **********************************************************************************************
Located in /web/phpsysinfo/includes/XPath.class.php (line 5200)
XPathBase | --XPathEngine | --XPath
(mixed)
appendChild
($xPathQuery $xPathQuery, $node $node, [$afterText $afterText = FALSE], [$autoReindex $autoReindex = TRUE])
(bool)
deleteData
($xPathQuery $xPathQuery, [$offset $offset = 0], [$count $count = 0], [$textPartNr $textPartNr = 1])
(mixed)
insertBefore
($xPathQuery $xPathQuery, $node $node, [$afterText $afterText = TRUE], [$autoReindex $autoReindex = TRUE])
(mixed)
insertChild
($xPathQuery $xPathQuery, $node $node, [$shiftRight $shiftRight = TRUE], [$afterText $afterText = TRUE], [$autoReindex $autoReindex = TRUE])
(bool)
replaceChildByData
($xPathQuery $xPathQuery, $data $data, [$autoReindex $autoReindex = TRUE])
(bool)
replaceData
($xPathQuery $xPathQuery, $replacement $replacement, [$offset $offset = 0], [$count $count = 0], [$textPartNr $textPartNr = 1])
(bool)
setAttribute
($xPathQuery $xPathQuery, $name $name, $value $value, [$overwrite $overwrite = TRUE])
(bool)
setAttributes
($xPathQuery $xPathQuery, $attributes $attributes, [$overwrite $overwrite = TRUE])
(mixed)
substringData
($absoluteXPath $absoluteXPath, [$offset $offset = 0], [$count $count = NULL])
Inherited from XPathEngine
XPathEngine::$axes
XPathEngine::$axPathLiterals
XPathEngine::$emptyNode
XPathEngine::$errorStrings
XPathEngine::$functions
XPathEngine::$nodeIndex
XPathEngine::$nodeRoot
XPathEngine::$nodeStack
XPathEngine::$operators
XPathEngine::$parsedTextLocation
XPathEngine::$parseOptions
XPathEngine::$parseSkipWhiteCache
XPathEngine::$parseStackIndex
XPathEngine::$parsInCData
XPathEngine::$_indexIsDirty
Inherited from XPathBase
XPathBase::$aDebugFunctions
XPathBase::$aDebugOpenLinks
XPathBase::$bClassProfiling
XPathBase::$bDebugXmlParse
XPathBase::$iDebugNextLinkNumber
XPathBase::$_lastError
Constructor of the class
Optionally you may call this constructor with the XML-filename to parse and the XML option vector. A option vector sample: $xmlOpt = array(XML_OPTION_CASE_FOLDING => FALSE, XML_OPTION_SKIP_WHITE => TRUE);
Appends a child to anothers children.
If you intend to do a lot of appending, you should leave autoIndex as FALSE and then call reindexNodeTree() when you are finished all the appending.
Append text data to the end of the text for an attribute OR node text-part.
This method adds content to a node. If it's an attribute node, then the value of the attribute will be set, otherwise the passed data will append to character data of the node text-part. Per default the first text-part is taken.
NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Delete the data of a node.
This method deletes content of a node. If it's an attribute node, then the value of the attribute will be removed, otherwise the node text-part. will be deleted. Per default the first text-part is deleted.
NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Retrieves a dedecated attribute value or a hash-array of all attributes of a node.
The first param $absoluteXPath must be a valid xpath OR a xpath-query that results to *one* xpath. If the second param $attrName is not set, a hash-array of all attributes of that node is returned.
Optionally you may pass an attrubute name in $attrName and the function will return the string value of that attribute.
Retrieve all the text from a node as a single string.
Sample Given is: <AA> This <BB\>is <BB\> some<BB\>text </AA> Return of getData('/AA[1]') would be: " This is sometext " The first param $xPathQuery must be a valid xpath OR a xpath-query that results to *one* xpath.
Retrieve all the text from a node as a vector of strings
Where each element of the array was interrupted by a non-text child element.
Sample Given is: <AA> This <BB\>is <BB\> some<BB\>text </AA> Return of getDataParts('/AA[1]') would be: array([0]=>' This ', [1]=>'is ', [2]=>' some', [3]=>'text '); The first param $absoluteXPath must be a valid xpath OR a xpath-query that results to *one* xpath.
Inserts a node before the reference node with the same parent.
If you intend to do a lot of appending, you should leave autoIndex as FALSE and then call reindexNodeTree() when you are finished all the appending.
Insert passed node (or passed node-tree) at the node(s) that matches the xQuery.
With parameters you can define if the 'hit'-node is shifted to the right or left and if it's placed before of after the text-part. Per derfault the 'hit'-node is shifted to the right and the node takes the place the of the 'hit'-node. NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
E.g. Following is given: AAA[1] / \ ..BBB[1]..BBB[2] ..
a) insertChild('/AAA[1]/BBB[2]', <node CCC>) b) insertChild('/AAA[1]/BBB[2]', <node CCC>, $shiftRight=FALSE) c) insertChild('/AAA[1]/BBB[2]', <node CCC>, $shiftRight=FALSE, $afterText=FALSE)
a) b) c) AAA[1] AAA[1] AAA[1] / | \ / | \ / | \ ..BBB[1]..CCC[1]BBB[2].. ..BBB[1]..BBB[2]..CCC[1] ..BBB[1]..BBB[2]CCC[1]..
#### Do a complete review of the "(optional)" tag after several arguments.
Insert a sub string in a text-part OR attribute-value.
NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Retrieves the name(s) of a node or a group of document nodes.
This method retrieves the names of a group of document nodes specified in the argument. So if the argument was '/A[1]/B[2]' then it would return 'B' if the node did exist in the tree.
Removes an attribute of a node(s).
This method removes *ALL* attributres per default unless the second parameter $attrList is set. $attrList can be either a single attr-name as string OR a vector of attr-names as array. E.g. removeAttribute(<xPath>); # will remove *ALL* attributes. removeAttribute(<xPath>, 'A'); # will only remove attributes called 'A'. removeAttribute(<xPath>, array('A_1','A_2')); # will remove attribute 'A_1' and 'A_2'. NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Removes a node from the XML document.
This method removes a node from the tree of nodes of the XML document. If the node is a document node, all children of the node and its character data will be removed. If the node is an attribute node, only this attribute will be removed, the node to which the attribute belongs as well as its children will remain unmodified.
NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Replace the node(s) that matches the xQuery with the passed node (or passed node-tree)
If the passed node is a string it's assumed to be XML and replaceChildByXml() will be called. NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Replace a node with any data string. The $data is taken 1:1.
This function will delete the node you define by $absoluteXPath (plus it's sub-nodes) and substitute it by the string $text. Often used to push in not well formed HTML. WARNING: The $data is taken 1:1. You are in charge that the data you enter is valid XML if you intend to export and import the content again.
NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Replace a sub string of a text-part OR attribute-value.
NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Resets the object so it's able to take a new xml sting/file
Constructing objects is slow. If you can, reuse ones that you have used already by using this reset() function.
Set attributes of a node(s).
This method sets a number single attributes. An existing attribute is overwritten (default) with the new value, but setting the last param to FALSE will prevent overwritten. NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Version of setAttribute() that sets multiple attributes to node(s).
This method sets a number of attributes. Existing attributes are overwritten (default) with the new values, but setting the last param to FALSE will prevent overwritten. NOTE: When passing a xpath-query instead of an abs. Xpath. Depending on setModMatch() one, none or multiple nodes are affected.
Resolves and xPathQuery array depending on the property['modMatch']
Most of the modification functions of XPath will also accept a xPathQuery (instead of an absolute Xpath). The only problem is that the query could match more the one node. The question is, if the none, the fist or all nodes are to be modified. The behaver can be set with setModMatch()
Retrieves a sub string of a text-part OR attribute-value.
This method retrieves the sub string of a specific text-part OR (if the $absoluteXPath references an attribute) the the sub string of the attribute value. If no 'direct referencing' is used (Xpath ends with text()[<part-number>]), then the first text-part of the node ist returned (if exsiting).
Get a reference-list to node text part(s) or node attribute(s).
If the Xquery references an attribute(s) (Xquery ends with attribute::), then the text value of the node-attribute(s) is/are returned. Otherwise the Xquery is referencing to text part(s) of node(s). This can be either a direct reference to text part(s) (Xquery ends with text()[<nr>]) or indirect reference (a simple Xquery to node(s)). 1) Direct Reference (Xquery ends with text()[<part-number>]): If the 'part-number' is omitted, the first text-part is assumed; starting by 1. Negative numbers are allowed, where -1 is the last text-part a.s.o. 2) Indirect Reference (a simple Xquery to node(s)): Default is to return the first text part(s). Optionally you may pass a parameter $textPartNr to define the text-part you want; starting by 1. Negative numbers are allowed, where -1 is the last text-part a.s.o.
NOTE I : The returned vector is a set of references to the text parts / attributes. This is handy, if you wish to modify the contents. NOTE II: text-part numbers out of range will not be in the list NOTE III:Instead of an absolute xpath you may also pass a xpath-query. Depending on setModMatch() one, none or multiple nodes are affected.
Resolves an xPathQuery vector depending on the property['modMatch']
To:
Resolves an xPathQuery vector for a node op for modification
It is possible to create a brand new object, and try to append and insert nodes into it, so this is a version of _resolveXPathQuery() that will autocreate the super root if it detects that it is not present and the $xPathQuery is empty.
Also it demands that there be at least one node returned, and displays a suitable error message if the returned xPathSet does not contain any nodes.
Parse the XML to a node-tree. A so called 'document'
Inherited From XPathEngine
XPathEngine::XPathEngine()
XPathEngine::cloneNode()
XPathEngine::decodeEntities()
XPathEngine::equalNodes()
XPathEngine::evaluate()
XPathEngine::exportAsHtml()
XPathEngine::exportAsXml()
XPathEngine::exportToFile()
XPathEngine::getNode()
XPathEngine::getNodePath()
XPathEngine::getParentXPath()
XPathEngine::getProperties()
XPathEngine::hasChildNodes()
XPathEngine::importFromFile()
XPathEngine::importFromString()
XPathEngine::match()
XPathEngine::reindexNodeTree()
XPathEngine::reset()
XPathEngine::setCaseFolding()
XPathEngine::setSkipWhiteSpaces()
XPathEngine::setXmlOption()
XPathEngine::setXmlOptions()
XPathEngine::wholeText()
XPathEngine::_addLiteral()
XPathEngine::_asLiteral()
XPathEngine::_checkNodeTest()
XPathEngine::_checkPredicates()
XPathEngine::_createSuperRoot()
XPathEngine::_evaluateExpr()
XPathEngine::_evaluateFunction()
XPathEngine::_evaluateOperator()
XPathEngine::_evaluatePathExpr()
XPathEngine::_evaluatePrimaryExpr()
XPathEngine::_evaluateStep()
XPathEngine::_export()
XPathEngine::_generate_ids()
XPathEngine::_getAxis()
XPathEngine::_GetOperator()
XPathEngine::_handleAxis_ancestor()
XPathEngine::_handleAxis_ancestor_or_self()
XPathEngine::_handleAxis_attribute()
XPathEngine::_handleAxis_child()
XPathEngine::_handleAxis_descendant()
XPathEngine::_handleAxis_descendant_or_self()
XPathEngine::_handleAxis_following()
XPathEngine::_handleAxis_following_sibling()
XPathEngine::_handleAxis_namespace()
XPathEngine::_handleAxis_parent()
XPathEngine::_handleAxis_preceding()
XPathEngine::_handleAxis_preceding_sibling()
XPathEngine::_handleAxis_self()
XPathEngine::_handleCharacterData()
XPathEngine::_handleDefaultData()
XPathEngine::_handleEndElement()
XPathEngine::_handleFunction_boolean()
XPathEngine::_handleFunction_ceiling()
XPathEngine::_handleFunction_concat()
XPathEngine::_handleFunction_contains()
XPathEngine::_handleFunction_count()
XPathEngine::_handleFunction_false()
XPathEngine::_handleFunction_floor()
XPathEngine::_handleFunction_generate_id()
XPathEngine::_handleFunction_id()
XPathEngine::_handleFunction_lang()
XPathEngine::_handleFunction_last()
XPathEngine::_handleFunction_name()
XPathEngine::_handleFunction_normalize_space()
XPathEngine::_handleFunction_not()
XPathEngine::_handleFunction_number()
XPathEngine::_handleFunction_position()
XPathEngine::_handleFunction_round()
XPathEngine::_handleFunction_starts_with()
XPathEngine::_handleFunction_string()
XPathEngine::_handleFunction_string_length()
XPathEngine::_handleFunction_substring()
XPathEngine::_handleFunction_substring_after()
XPathEngine::_handleFunction_substring_before()
XPathEngine::_handleFunction_sum()
XPathEngine::_handleFunction_translate()
XPathEngine::_handleFunction_true()
XPathEngine::_handleFunction_x_lower()
XPathEngine::_handleFunction_x_upper()
XPathEngine::_handlePI()
XPathEngine::_handleStartElement()
XPathEngine::_internalAppendChild()
XPathEngine::_InternalExport()
XPathEngine::_recursiveReindexNodeTree()
XPathEngine::_removeLiterals()
XPathEngine::_sortByDocOrder()
XPathEngine::_stringValue()
XPathEngine::_translateAmpersand()
Inherited From XPathBase
XPathBase::XPathBase()
XPathBase::getLastError()
XPathBase::reset()
XPathBase::setVerbose()
XPathBase::_afterstr()
XPathBase::_beginDebugFunction()
XPathBase::_bracketExplode()
XPathBase::_bracketsCheck()
XPathBase::_closeDebugFunction()
XPathBase::_displayError()
XPathBase::_displayMessage()
XPathBase::_getEndGroups()
XPathBase::_prestr()
XPathBase::_printContext()
XPathBase::_ProfBegin()
XPathBase::_ProfEnd()
XPathBase::_ProfileToHtml()
XPathBase::_searchString()
XPathBase::_setLastError()
XPathBase::_treeDump()
Documentation generated on Mon, 13 Oct 2008 01:10:58 +0200 by phpDocumentor 1.4.0