XPaths

XPath is the language used to find information in an XML document. In the Web Service interface it is used to retrieve containers from the RPM database. XPaths that are sent with the load function or method from the Application interface.

The ApplicationService interface provides three functions to load a container from a Web Service, however, it only one uses XPath.

Remember that the scoping function allows you to retrieve children and parent at the same time. When no scope is used (null value), only the main container is returned.

XPaths must respect the following syntax:

/statement/statement/...

Statement: The XPath must contain a minimum of 1 statement. The last statement will indicate the type of container that will be returned by the XPath query. Each statement has the following syntax:

container[conditions]

Container: The name of the container being queried. This field is mandatory. The value of this field must match the value of one of the containers described in chapter 6 of this API Guide. If there are multiple statements, the containers used in adjacent statements must have a relationship between each other. The container name is case insensitive.

Condition: A condition that will be applied to the specified container. This field is optional. Supported conditions are the following:

Equals condition: Verifies that a field equals a specific value. Syntax : [field=value]

Not Equal condition: Verifies that a field doesn't equals a specific value. Syntax : [field!=value]

Bigger than condition: Verifies that a field is bigger than a specific value. Syntax : [field>value]

Bigger or equal to condition: Verifies that a field is bigger or equal to a specific value. Syntax : [field>=value]

Smaller than condition: Verifies that a field is smaller than a specific value. Syntax : [field<value]

Smaller or equal to condition: Verifies that a field is smaller or equal to a specific value. Syntax : [field<=value]

Starts with condition: Verifies that a text field starts with a specific value. Syntax : [starts-with(field,value)]

Contains condition: Verifies that a text field contains a specific value. Syntax : [contains(field,value)]

Is null condition: Verifies that a field is null. Syntax : [isnull(field)]

Is not null condition: Verifies that a field is not null. Syntax : [isnotnull(field)]

Multiple conditions: More than one condition can be specified:

Field: Name of a field in the queried container. This field name must match the name specified in chapter 6 of this API Guide. A field name is always prefixed by the @ character. The field name is case insensitive.

Value: The value to be queried. The format of the value can be the following:

Example 1: The following query will return all the pools named ’Pool Name’.

/Pool[@name=’Pool Name’]

Example 2: This query will return all the resources named 'O'Neil'.

/Resource[@lastname= 'O&apos;Neil']

Example 3: This query will return all the resources contained in all the pools named ‘Pool Name’.

/Pool[@name=’Pool Name’]/Resource

Example 4: This query will return all the resources that have an effective start date that occurs after 2006-08-15 9:50:43.

/resource[@EffectiveStartDate>'2006-08-15 09:50:43']

Example 5: This query will return all the pools that contain a resource named ‘Resource Name’.

/pool[@resources[@fullName='Resource Name']

Example 6: This query will return all the resources that are named ‘Resource Name’ and that have an effective start date equal to 2006-08-15.

/Resource[@fullName='Resource Name' and @EffectiveStartDate='2006-08-15']

Example 7: This query will return all the resources that are named ‘Bob’ or ‘Bill’

/Resource[@fullName='Bob' or @fullName='Bill']

Example 8: This query will return all the resources where the full name contains the “Bob” substring.

/Resource[contains(@fullName,’Bob’)]

Example 9: This query will return all the resources that are active.

/Resource[@active = 'true']

Example 10: This query will return all the resources for which the address1 field is not null.

/Resource[isnotnull(@address1)]