XML with XPath, XMLStarlet, and Python
摘要
You might think of XML as a verbose relic of the past, but it remains a critical component of enterprise architectures, legacy environments, and critical security compliance and identity standards like SCAP and SAML. Forgoing XML in favor of modern YAML or JSON is a luxury a DevSecOps professional cannot afford. This chapter will systematically guide you through the necessary skills, introducing the fundamentals of structure using DTDs and XSDs before exploring more precise automation tools. You’ll discover how to accurately query data using XPath, dynamically manipulate configuration trees with xmlstarlet, and programmatically parse documents with Python’s lxml library. Whether you’re new to deciphering enterprise configuration files or an administrator experienced in automating compliance audits, this section provides the architectural framework you need to manage the data format that supports critical business operations.