Parsing XML data files using WQL

I have ran into a problem parsing XML documents which isn’t giving me the results I expect.

Initially the first method of retrieving the XML/HTML documents is

loadDocument (with the appropriate URL)
queryDocument
etc…

which all works fine and the document is correctly shown in the “Variables” tab on the queryDocument flow.

However, I run into problems when I try and parse local files in the following flow context:

getFile
bytesToString
stringToDocument
queryDocument

Now when I run a trace nothing is loaded into the “Variables” tab on the queryDocument flow, which means I can’t parse the file - anyone got any ideas why that might be?

(The stringToDocument appears to be working correctly because if I replace the queryDocument with documentToRecord I get the corresponding record output!?)

Kind Regards

Callum

PS
Makes no difference whether the local document is XML or HTML nothing gets displayed in the Variables tab when doing a trace.