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.