Class

Symfony\Component\CssSelector\XPathExprOr

class XPathExprOr extends XPathExpr

XPathExprOr represents XPath |'d expressions.

Note that unfortunately it isn't the union, it's the sum, so duplicate elements will appear.

This component is a port of the Python lxml library, which is copyright Infrae and distributed under the BSD license.

Methods

__construct(array $items, string $prefix = null)

Constructor.

string getPrefix()

Gets the prefix of this XPath expression.

from XPathExpr
string getPath()

Gets the path of this XPath expression.

from XPathExpr
Boolean hasStarPrefix()

Answers whether this XPath expression has a star prefix.

from XPathExpr
string getElement()

Gets the element of this XPath expression.

from XPathExpr
string getCondition()

Gets the condition of this XPath expression.

from XPathExpr
string __toString()

Gets a string representation of this |'d expression.

addCondition(string $condition)

Adds a condition to this XPath expression.

from XPathExpr
addPrefix(string $prefix)

Adds a prefix to this XPath expression.

from XPathExpr
addNameTest()

Adds a condition to this XPath expression using the name of the element as the desired value.

from XPathExpr
addStarPrefix()

Adds a star prefix to this XPath expression.

from XPathExpr
join(string $combiner, XPathExpr $other)

Joins this XPath expression with $other (another XPath expression) using $combiner to join them.

from XPathExpr
static string xpathLiteral(mixed $s)

Gets an XPath literal for $s.

from XPathExpr

Details

at line 32
public __construct(array $items, string $prefix = null)

Constructor.

Parameters

array $items The items in the expression.
string $prefix Optional prefix for the expression.

in XPathExpr at line 53
public string getPrefix()

Gets the prefix of this XPath expression.

Return Value

string

in XPathExpr at line 63
public string getPath()

Gets the path of this XPath expression.

Return Value

string

in XPathExpr at line 73
public Boolean hasStarPrefix()

Answers whether this XPath expression has a star prefix.

Return Value

Boolean

in XPathExpr at line 83
public string getElement()

Gets the element of this XPath expression.

Return Value

string

in XPathExpr at line 93
public string getCondition()

Gets the condition of this XPath expression.

Return Value

string

at line 43
public string __toString()

Gets a string representation of this |'d expression.

Return Value

string

in XPathExpr at line 129
public addCondition(string $condition)

Adds a condition to this XPath expression.

Any pre-existent condition will be ANDed to it.

Parameters

string $condition The condition to add.

in XPathExpr at line 144
public addPrefix(string $prefix)

Adds a prefix to this XPath expression.

It will be prepended to any pre-existent prefixes.

Parameters

string $prefix The prefix to add.

in XPathExpr at line 158
public addNameTest()

Adds a condition to this XPath expression using the name of the element as the desired value.

This method resets the element to '*'.

in XPathExpr at line 174
public addStarPrefix()

Adds a star prefix to this XPath expression.

This method will prepend a '*' to the path and set the star prefix flag to true.

in XPathExpr at line 197
public join(string $combiner, XPathExpr $other)

Joins this XPath expression with $other (another XPath expression) using $combiner to join them.

Parameters

string $combiner The combiner string.
XPathExpr $other The other XPath expression to combine with this one.

in XPathExpr at line 222
static public string xpathLiteral(mixed $s)

Gets an XPath literal for $s.

Parameters

mixed $s Can either be a Node\ElementNode or a string.

Return Value

string