Descendant

The following example code shows that the descendants of the publisher element are the product, title, author, and year elements.

The structure of the descendant flows the opposite way, that is, from bottom to top:

<publisher> <product> <title>Quick Start Guide: R</title> <author>Olgun Aydin</author> <year>2018</year> </product></publisher>

XPath is used to select nodes in the XML document to indicate the path expressions of these expressions. The node is selected by following a path or steps. The most useful ways and explanations are given in this table:

Expression Description

node1

This expression is used for selecting all of the nodes that have the name node1.

/

This expression is used for selecting nodes from  ...

Get R Web Scraping Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.