As a network engineer or someone involved in network automation efforts, I need to be able to use XML data from network devices, such as NETCONFG, RESTCONF, or NXAPI, so that I can extract the information I need to complete my tasks.
This repo contains information and tutorials that will help to navigate XML data using Python and the LXML library.
If you have specific questions that you would like answered, please share you XML data files in the xml-files directory and ask your question in the issues area.
XML and XPath
Read W3Schools section on XPath starting here: https://www.w3schools.com/xml/xpath_intro.asp
In particular for Xpath expressions you will need to understand node selection techniques.
Node Selections:
https://www.w3schools.com/xml/xpath_syntax.asp
Using Axes:
https://www.w3schools.com/xml/xpath_axes.asp
You will also want to use builtin functions:
XPath Functions - https://www.w3schools.com/xml/xsl_functions.asp
Python LXML package
Documentation: https://lxml.de/
The LXML package provides for a few extension libraries, for example regular expressions: https://lxml.de/xpathxslt.html#regular-expressions-in-xpath See Code Snippets below
Regular Expression Library Docs - http://exslt.org/regexp/