Relationships between nodes

In XPath, there is a hierarchy between nodes, which helps us to understand the flow in any XML documents. Also, sometimes, we need to be more specific, for example, "Get the attribute class of the div node that is the parent node of span with the items class".

In this part, we will discover the relationship of the nodes: parent, child, sibling, ancestor, and descendant. Also, we will investigate how they look using sample XML documents. 

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.