depage-xmldb v2.3.1
XML documents in a relational database
Loading...
Searching...
No Matches
XpathParser Class Reference

Detailed Description

The consumer (e.g. XmlDb::getNodeIdsByXpath) receives pre-parsed objects carrying all condition data, avoiding repeated parser calls inside the element iteration loop. SQL assembly is done in the caller so the XpathParser remains SQL-independent and potentially reusable.

Definition at line 15 of file XpathParser.php.

Public Member Functions

 parseXpathElements (string $xpath)
 parsePosition ($condition)
 parseAttributes ($condition)
 translateName ($ns, $name)
 getConditionOperator ($ns, $name)
 getConditionAttributes ($conditionString, $strings)
 cleanOperator ($operator)

Protected Member Functions

 removeLiteralStrings ($text, &$strings)

Member Function Documentation

◆ cleanOperator()

cleanOperator ( $operator)
Parameters
string$operatorxpath operator string
Returns
string cleaned/validated operator
Exceptions
XmlDbExceptionif operator is invalid

Definition at line 168 of file XpathParser.php.

◆ getConditionAttributes()

getConditionAttributes ( $conditionString,
$strings )
Parameters
string$conditionStringcleaned condition string
array$stringsreference array for literal strings
Returns
array array of condition rows

Definition at line 103 of file XpathParser.php.

◆ getConditionOperator()

getConditionOperator ( $ns,
$name )
Parameters
string$nsnamespace
string$namenode name
Returns
string 'LIKE' if wildcards detected, '=' otherwise

Definition at line 89 of file XpathParser.php.

◆ parseAttributes()

parseAttributes ( $condition)
Parameters
string$conditioncondition string to parse
Returns
array|false array of condition rows or false if invalid

Definition at line 62 of file XpathParser.php.

◆ parsePosition()

parsePosition ( $condition)
Parameters
string$conditioncondition string from xpath
Returns
false|array array with ['operator', 'value'] or false if no match

Definition at line 43 of file XpathParser.php.

◆ parseXpathElements()

parseXpathElements ( string $xpath)
Parameters
string$xpathXPath string to parse
Returns
XpathElement[] array of parsed XpathElement objects

Definition at line 21 of file XpathParser.php.

◆ removeLiteralStrings()

removeLiteralStrings ( $text,
& $strings )
protected
Parameters
string$textinput text
array$stringsreference array to populate with extracted literal strings
Returns
string text with literals replaced by placeholders

Definition at line 142 of file XpathParser.php.

◆ translateName()

translateName ( $ns,
$name )
Parameters
string$nsnamespace
string$namenode name
Returns
string translated name with wildcards replaced by SQL LIKE wildcards

Definition at line 78 of file XpathParser.php.


The documentation for this class was generated from the following file: