Create queryDocument flow service

I would like to create a flow service named queryDocument based on XQL language and using pub.xml:queryXMLNode

My idea is to do something like that


It seems to work but

If I have some document like that :

doc (IDATA)
– var1 (Record)
----- val1 (String)
----- key1 (String)
– var2 (Record)
----- val2 (String)

The pub.xml:documentToXMLString transform my doc in the following xml :

tag doc is not included in xml.
So when I query xml, the system doesn’t recorgnize my XQL expression.

Is it a way to include top tag (document) in xml.
By advance thanks