beautypg.com

2 introduction to xml path language (xpath) – TANDBERG Gatekeeper/Border Controller API D14172.01 User Manual

Page 6

background image

TANDBERG Gatekeeper/Border Controller API User Guide

D14172.01

page 6 of 84

1.2

Introduction to XML Path Language (XPath)


XPath is a comprehensive language to address data in XML documents. It is, however, very simple to
understand the basics. If you are able to specify the path to a file on your computer, you are able to
specify the path to an element in a XML structure.



Example 1.5


Let us go back to the SNMP configuration of Example 1.1:



On
public
Administrator





To specify the path to the SNMP element we simply start at the root level and separate the levels in the
tree structure by a slash ( / ):

Configuration/SNMP

The path to the CommunityName element is:

Configuration/SNMP/CommunityName


Example 1.6


To address a specific item of an element, the item number is added within brackets ( [ ] ) after the
element name.

The path to the Address element of Server item 2 in Example 1.4 is:

Configuration/IP/DNS/Server[2]/Address

If the item number is omitted for an element, all items of this element will be addressed. The following
expression addresses the Address element of all DNS servers:

Configuration/IP/DNS/Server/Address