Einhugur Xml Plugin for Xojo |

# XPathQuery.EvaluateString Method

Evaluates query to a String result.

EvaluateString(
node as EinhugurXml.Node) as String

#### Parameters

node
  The node to run the XPath query on.

#### Returns

String
  String result.

#### 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)
var queryNameValid as XPathQuery = new XPathQuery("string-length(substring-before(@Filename, '_')) > 0 and @OutputFileMasks")
var queryName as XPathQuery = new XPathQuery("concat(substring-before(@Filename, '_'), ' produces ', @OutputFileMasks)")
ListBox1.RemoveAllRows()
// Here we will be executing the pr-compiled queries many times
for each tool as Node in document.FirstElementByPath("Profile/Tools").Children
var s as String = queryName.EvaluateString(tool)
if queryNameValid.EvaluateBoolean(tool) then
ListBox1.AddRow(s)
end if
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