And this demo on using XPath to parse XML brings us
to the very end of this module.
In this module,
we took our ability to search and filter elements in
the HTML parse tree a step further.
We worked with the find and find_all functions that we are familiar with.
But we used additional input arguments such as the limit
argument and the recursive argument,
and we saw how we could search the tree using advanced functionality.
We also worked with other search functions that Beautiful Soup has to offer,
which allowed us to search parents, descendants,
and siblings of elements.
All of these functions are built atop the basic find and find_all,
and they support the same set of parameters.
We saw that Beautiful Soup could work with the lxml parser to
parse HTML documents in the XML format.
Beautiful Soup can work directly with XML documents as well.
We understood the differences and similarities between XML and HTML,
and we saw that they were similar enough that XPath,
the query language to select nodes in a hierarchical tree structure,
works with both.
And we saw how we could find elements within a page using XPath,
as well as CSS selectors that are enabled with the Soup Sieve Python library.
In the next module,
we'll see how we can leverage the advanced
functionality that Beautiful Soup has to offer.
We'll see how we can use Beautiful Soup to modify the parse tree
and also work with different parser libraries.