XPATH used with XMLLIB

The XPATH function that is used with XMLLIB queries the XML input.

This function queries the XML input, which is provided as a text stream or URL, by using the specified XPATH expression and context, returning the result of the evaluation.

Syntax:
XPATH (single-text-expression, single-text-expression, single-text-expression)
Meaning:
XPATH (xml_url_or_xml_fragment, xpath_expression, context_expression)
Returns:
A single text item

Examples

  • xmllib->XPATH( "ipo.in.xml", "./order//item[1]/shipDate", "/ipo:purchaseOrders " )

    Returns the content of the shipDate element from the ipo.in.xml file.

  • xmllib->XPATH( PACKAGE(source), "/ipo:purchaseOrders/order/items/item[1]/shipDate", "/" )

    Returns the content of the shipDate element from the input XML fragment.