How to Parse XML
In this article, we'll explain about XML parsing. We'll start by defining XML files, their format and how to navigate them for data extraction.
To select sibling elements in XPath the preceding-sibling
and following-sibling
axes can be used - see these interactive examples:
preceding-sibling::span
will select any siblings that precede (i.e. are above) the current element:following-sibling::span
will select siblings that follow (i.e. are below) the current element:Note that the wildcard character can be used instead of explicit element names (e.g. following-sibling::*
) to select siblings of any element name.
For more on XPath, see our full introduction article
This knowledgebase is provided by Scrapfly data APIs, check us out! 👇