350-601 Automation Practice Question
A Python script uses NX-API's XML output to extract interface status. Which method is most robust and recommended for parsing the XML?
⚠ Common exam trap
Cisco often tests the distinction between built-in vs. third-party libraries and between string manipulation vs. proper parsing, leading candidates to choose BeautifulSoup (which is overkill and non-standard for XML) or regex (which seems flexible but is technically incorrect for XML).
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use xml.etree.ElementTree
xml.etree.ElementTree is the recommended method because it is part of Python's standard library, provides robust tree-based parsing that handles XML namespaces and nested structures correctly, and is specifically designed for programmatic XML manipulation. For NX-API XML output, which follows a consistent schema, ElementTree allows reliable extraction of interface status using XPath or tag traversal without fragility.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Split the string by tags
Why it's wrong here
String splitting is fragile and cannot handle nested tags.
- ✗
Use regular expressions to find patterns
Why it's wrong here
Regex is not robust for XML due to nested structures.
- ✗
Use BeautifulSoup
Why it's wrong here
BeautifulSoup is an external dependency and heavier; ElementTree is preferred for simple XML.
- ✓
Use xml.etree.ElementTree
Why this is correct
ElementTree is built-in and efficient for XML parsing.
Go deeper
Related to this question
About these practice questions
This 350-601 question is part of Courseiva's 984-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 350-601 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 350-601 exam.