Native
Synchronous
No Custom Parameters
XmlQuery will query an XML document with XPath.
The XmlQuery action will return both a XmlNodeList and a System.Collections.Specialized.StringCollection, with the results of the XPath expression. The XmlNodeList will return complex types that can be further processed in CustomCode. The StringCollection will return just the textual values of the matching elements.
The use of XmlQuery requires understanding of XML and XPath. The following is an example to illustrate how these technologies interact in the context of this action:
Example 22.1. Sample XML Document supplied as the Xml action parameter in XmlQuery
<?xml version="1.0" ?> <a> <b> <c myattr="1" /> </b> </a>
Example 22.3. Parsing the ValueList and XmlNodeList result parameters of XmlQuery
public static string Execute(System.Xml.XmlNodeList nodes, StringCollection values, LogWriter log)
{
// The result of '//@myattr' should be just one node for the sample XML document.
// The two traces below will output the following:
// 'XML Node List Data: 1 myattr'
// 'StringCollection Data: 1'
log.Write(TraceLevel.Info, "XML Node List Data: {0} {1}", nodes[0].Value, nodes[0].Name);
log.Write(TraceLevel.Info, "StringCollection Data: {0}", values[0]);
return "Success";
}
None.
| Parameter Name | .NET Type | Default | Description |
|---|---|---|---|
| Xml * | System.String | The XML document to use the XPath expression against specified by the Query action parameter. | |
| Query * | System.String | The XPath expression to use on the content specified by the Xml action parameter. |
| Parameter Name | .NET Type | Description |
|---|---|---|
| XmlNodeList | Metreos.Types.Xml.XmlNodeList | The list of XML nodes the XPath expression found. This value should be saved to the XmlNodeList type. |
| ValueList | Metreos.Types.StringCollection | The textual values of the list of XML nodes the XPath expression found. |
Branch Conditions
No description.
No description.