Einhugur Xml Plugin for Xojo |

# XPathQuery.EvaluateNodeSet Method

Evaluates a query to a node set.

EvaluateNodeSet(
node as EinhugurXml.Node) as EinhugurXml.XPathNodeSet

#### Parameters

node
  The node to run the XPath query on.

#### Returns

EinhugurXml.XPathNodeSet
  XPathNodeSet which can carry either set of nodes or set of attributes.

#### Remarks

Note that XPath queries can throw EinhugurXPathException.
// In this example we will use Pre-compiled XPath query to
// Select nodes.
// --------------------------------------------------------
var f as FolderItem = SpecialFolder.Resources.Child("xgconsole.xml")
if not f.Exists then
MessageBox("Could not find file xgconsole.xml")
return
end if
using EinhugurXml
// Most parts of the plugin do not Throw exceptions, but Loading XML
// document does as well as all XPath query functionality.
try
var document as Document = Document.FromFile(f)
// This can be done simpler with the SelectNodes function on the Node class
// but the point of pre-compiled queries is speed, where you can have
// the query precompiled for multiple executions.
var queryRemoteTools as XPathQuery = new XPathQuery("/Profile/Tools/Tool[@AllowRemote='true']")
var tools as XPathNodeSet = queryRemoteTools.EvaluateNodeSet(document)
ListBox1.RemoveAllRows()
for each node as XPathNode in tools.XPathNodes
// XPathNode can contain either Node or Attribute depending on the query.
ListBox1.AddRow(node.Node.Name + ": " + node.Node.Attribute("Filename").AsString())
next
catch ex as EinhugurXmlParserException
MessageBox(ex.Message + " - Offset:" + ex.Offset.ToString())
catch ex as EinhugurXPathException
MessageBox(ex.Message + " - Offset:" + ex.Offset.ToString())
end try

#### See Also

XPathQuery Class