diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 2d17126b89f..37ef6e24827 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -193,6 +193,15 @@ Get all the child or parent nodes:: Accessing Node Values ~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 2.6 + The :method:`Symfony\\Component\\DomCrawler\\Crawler::nodeName` + method was introduced in Symfony 2.6. + +Access the node name (HTML tag name) of the first node of the current selection (eg. "p" or "div"):: + + // will return the node name (HTML tag name) of the first child element under + $tag = $crawler->filterXPath('//body/*')->nodeName(); + Access the value of the first node of the current selection:: $message = $crawler->filterXPath('//body/p')->text();