QuestionQ51

NETCONF/XML API

Referring to the exhibit below, which two XPath expressions will select all user nodes?

Question Image

Choose two
  • A ./system/login/user
  • B ./user
  • C //user
  • D @user
Explanation

In XPath, //user is an abbreviation for /descendant-or-self::node()/user, meaning it searches the entire document tree for any element named user, regardless of depth, so it always returns all three <user> elements shown under system/login. The expression ./system/login/user is a relative path that, starting from the context node (the document/system root), explicitly walks down through system, then login, then user, matching the exact nesting shown in the exhibit and returning all three <user> nodes as well. By contrast, ./user only looks for user as a direct child of the current context node, which does not match because user is nested inside login (three levels down), and @user attempts to select an attribute named user rather than an element, which does not exist in the configuration hierarchy shown.

Community Discussion

No comments yet. Be the first to start the discussion!