This section is used to define the namespaces used in XPath queries on returned XML file. Namespaces are used in XML files to disambiguate elements which could otherwise share the same name, and to shorten the element names, making the file shorter and easier to read. In order for the lookup component to be able to find elements in the XML file, it needs to understand the namespaces used in the XPath. A simple XML file may contain no namespaces, in which case this can be left blank. An XML file may contain a default namespace. If this is the case you should enter a string in the default namespace (it doesn't matter what, so long as it matches what you use in the XPath for the parameters. Typically you could use the single letter d.) In XPath DOM manipulation terms, the component checks for a default namespace element in the document element, and aliases it to the string specified in the 'Default namespace' field in the configuration. The component also automatically adds any other namespaces specified in the XML file's document element (but not ones specified elsewhere in the document). To add extra namespaces not found in the document element, enter them in the 'Additional namespaces' list. For each one the namespace name should be specified, along with the URL. For example, if there is an element in the file:
<link xmlns:abc=”http://example.com/path” acb:def=”xyz”
href="http://example.com/image.jpg"> then the additional namespace would be entered as: Namespace: abc URL: http://example.com/path and then in the cache Table Field mapping dialog you could use the Response XPath of
d:link[@abc:def='xyz']/@href
This expression breaks down into: d:link | find link element in the default namespace | @abc:def | def attribute of the link in the abc namespace | [@abc:def='xyz'] | the link element must have def attribute with value 'xyz' | /@href | find href attribute of the link element |
which will find the value of the href attribute of the link element in the default namespace with a value of 'xyz' for it's def attribute in the abc namespace. |