The XSINIL is telling the XML output to create a namespace section / header at the top.
Do not think you can intercept the way you are asking. Have done some like this, but not having both the XMLNAMESPACES and XSINIL at the same time as wanting to get an element...
Have not given up, always enjoy a good challenge, but so far, the automated way it simply not cutting it...
for example, to get the header you are looking for (nearly), I would use :
with xmlnamespaces(
'
http://www.w3.org/2001/XMLSchema-instance' as "xsi"
, '
http://gtvpmapp02/GoScript/Schema/FrameworkBatch.xsd' as "noNamespaceSchemaLocation
"
)
select
(
select 'TEST' as 'GoScriptName' for xml raw('FrameworkBatch'),type
)
Now to get the rest to be part of the same path of 'FrameworkBatch' is proving the challenge - normally just add another select, but with the "with xmlnamespaces" it is trying to ecapsulate an entire new node.
Might have to go to a manually produced result (as it code for it - still within SQL).
Will get back - just thought I need to share the fact that I have spent a bit of time on this problem, and haven't given up yet...