XPath\Translator (Component\CssSelector)
Symfony\Component\CssSelector\XPath\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) Constructor. | ||
static string | getXpathLiteral(string $element) | |
string | cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::') Translates a CSS selector to an XPath expression. | |
string | selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::') Translates a parsed selector node to an XPath expression. | |
Translator | registerExtension(ExtensionInterface $extension) Registers an extension. | |
ExtensionInterface | getExtension(string $name) | |
Translator | registerParserShortcut(ParserInterface $shortcut) Registers a shortcut parser. | |
XPathExpr | nodeToXPath(NodeInterface $node) | |
XPathExpr | addCombination(string $combiner, NodeInterface $xpath, NodeInterface $combinedXpath) | |
XPathExpr | addFunction(XPathExpr $xpath, FunctionNode $function) | |
XPathExpr | addPseudoClass(XPathExpr $xpath, string $pseudoClass) | |
XPathExpr | addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, string $value) |
Details
public __construct(ParserInterface $parser = null)
Constructor.
static public string getXpathLiteral(string $element)
public string cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::')
Translates a CSS selector to an XPath expression.
public string selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::')
Translates a parsed selector node to an XPath expression.
public Translator registerExtension(ExtensionInterface $extension)
Registers an extension.
public ExtensionInterface getExtension(string $name)
public Translator registerParserShortcut(ParserInterface $shortcut)
Registers a shortcut parser.
public XPathExpr nodeToXPath(NodeInterface $node)
public XPathExpr addCombination(string $combiner, NodeInterface $xpath, NodeInterface $combinedXpath)
public XPathExpr addFunction(XPathExpr $xpath, FunctionNode $function)
public XPathExpr addPseudoClass(XPathExpr $xpath, string $pseudoClass)
public XPathExpr addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, string $value)
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/CssSelector/XPath/Translator.html