Skip to main content

<xpath>

Evaluate XPath expressions on a target XML document.

Syntax

<xpath name="xpath"
        source="request.MetaDataXML"
        property="context.Result" context="/staff/doc"
        expression="name[@last='Marston']"/>

Note that the editor uses double quotes around the values of the attributes. Thus if an attribute value needs to include quotes, those must be single quotes as shown here.

Attributes and Elements

source attribute

Required. An expression that yields a stream containing the XML on which the XPath expressions are to be performed. Typically the source attribute will name a context or request property.

property attribute

Required. The property (typically a context property) in which to place the result of the evaluation.

context attribute

Required. The document context.

expression attribute

Required. The XPath expression.

prefixmappings attribute

Optional. Specifies prefix mappings for the document. This is a comma-delimited list of prefix-to-namespace mappings. See details below. Specify a string of up to 255 characters.

schemaspec attribute

Optional. The schema specification. Specify a string of up to 255 characters.

name, disabled, xpos, ypos, xend, yend attributes

Description

The <xpath> element allows a business process to evaluate XPath expressions on a target XML document.

When the <xpath> element executes, the source stream is processed into an XPath document and then the XPath expressions are evaluated in sequence. The BPL runtime engine automatically manages the lifetime of the documents and caches them to allowing processing to be as efficient as possible

Each prefixmappings entry is defined as a prefix, a space, and then the URI to which that prefix maps. This is especially useful if the document defines a default namespace with the xmlns="http://somenamespaceuri" syntax, but does not supply an explicit prefix mapping. The following prefixmappings string would map the myprefix prefix to the http://somenamespaceuri URI. Note the space character in the string:

prefixmappings="myprefix http://somenamespaceuri"

The BPL <xpath> element is intended to support XPath expressions which yield a scalar value, that is a single piece of text, number, date etc. It is not intended to deal with expressions that yield an XPath DOM. This means that if the expression does yield a DOM, the target property will not be updated. DOM programming is beyond the scope of BPL. If your business needs such processing, then the XPath should be performed in a code block or a call to a utility class.

See Also

FeedbackOpens in a new tab