Translator
class Translator implements TranslatorInterface
XPath expression translator interface.
This component is a port of the Python cssselect library, which is copyright Ian Bicking, see https://github.com/SimonSapin/cssselect.
Methods
| __construct(ParserInterface $parser = null) | ||
| static | getXpathLiteral(string $element) | |
| cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::') Translates a CSS selector to an XPath expression. | ||
| selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::') Translates a parsed selector node to an XPath expression. | ||
| registerExtension(ExtensionInterface $extension) | ||
| getExtension(string $name) | ||
| registerParserShortcut(ParserInterface $shortcut) | ||
| nodeToXPath(NodeInterface $node) | ||
| addCombination(string $combiner, NodeInterface $xpath, NodeInterface $combinedXpath) | ||
| addFunction(XPathExpr $xpath, FunctionNode $function) | ||
| addPseudoClass(XPathExpr $xpath, string $pseudoClass) | ||
| addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, $value) | 
Details
__construct(ParserInterface $parser = null)
Parameters
| ParserInterface | $parser | 
static getXpathLiteral(string $element)
Parameters
| string | $element | 
cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::')
Translates a CSS selector to an XPath expression.
Parameters
| string | $cssExpr | |
| string | $prefix | 
selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::')
Translates a parsed selector node to an XPath expression.
Parameters
| SelectorNode | $selector | |
| string | $prefix | 
registerExtension(ExtensionInterface $extension)
Parameters
| ExtensionInterface | $extension | 
getExtension(string $name)
Parameters
| string | $name | 
Exceptions
| ExpressionErrorException | 
registerParserShortcut(ParserInterface $shortcut)
Parameters
| ParserInterface | $shortcut | 
nodeToXPath(NodeInterface $node)
Parameters
| NodeInterface | $node | 
Exceptions
| ExpressionErrorException | 
addCombination(string $combiner, NodeInterface $xpath, NodeInterface $combinedXpath)
Parameters
| string | $combiner | |
| NodeInterface | $xpath | |
| NodeInterface | $combinedXpath | 
Exceptions
| ExpressionErrorException | 
addFunction(XPathExpr $xpath, FunctionNode $function)
Parameters
| XPathExpr | $xpath | |
| FunctionNode | $function | 
Exceptions
| ExpressionErrorException | 
addPseudoClass(XPathExpr $xpath, string $pseudoClass)
Parameters
| XPathExpr | $xpath | |
| string | $pseudoClass | 
Exceptions
| ExpressionErrorException | 
addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, $value)
Parameters
| XPathExpr | $xpath | |
| string | $operator | |
| string | $attribute | |
| $value | 
Exceptions
| ExpressionErrorException | 
    © 2004–2017 Fabien Potencier
Licensed under the MIT License.
    http://api.symfony.com/4.0/Symfony/Component/CssSelector/XPath/Translator.html