Help!
I have an XML log file generated by WinSCP, and I'd like to trigger an alert based on it's contents. I have no control on how the XML is formatted.
I'm trying to use xQuery to read the values, but no luck. All I get are column heading with 0 rows. I've also tried OPENXML and VBA ImportXML, but both methods return nulls.
DECLARE @XML XML =
'<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="http://winscp.net/schema/session/1.0" name="[email protected]" start="2017-11-09T18:00:09.051Z">
<upload>
<filename value="e:\MyUploadFile.txt" />
<destination value="/HostFolder/MyUploadFile.txt" />
<result success="true" />
</upload>
<touch>
<filename value="/HostFolder/MyUploadFile.txt" />
<modification value="2017-11-09T18:00:08.000Z" />
<result success="true" />
</touch>
</session>
'
SELECT
Sess.Upload.value('../filename[1]','varchar(250)') [Filename]
,Sess.Upload.value('../destination[1]','varchar(250)') [Destination]
,Sess.Upload.value('../result[1]','varchar(250)') [Result]
FROM
@XML.nodes ('/session/upload') AS Sess(Upload)