Option Explicit

Script.RegisterCommand "xpath"

Function onAssist(Command)
	Dim lxmlDoc, lxmlNode
	Dim lstrXPath
	
	lstrXPath = Mid(Command, 6)
	WriteLine "'" & lstrXPath & "'"
	
	Set lxmlDoc = getDOMDoc(File.Path) ' The function 'getDOMDoc' is defined in xml.js
	Set lxmlNode = lxmlDoc.selectSingleNode(lstrXPath)
	Err.Raise 1, , lxmlNode.nodeTypedValue ' Raise an error with the node's contents as error message, 
											'so that ZTreeWin will display it in its error line
	'onAssist = lxmlNode.nodeTypedValue
End Function
