After multiple tries I figure out that I can do something like:
<MyXml><someValues><MoreNodes>Value1</MoreNodes></someValues></MyXml>
*No need to insert the parent node <test>
that I was inserting before.
and then do something like:
XmlObject inputXml = XmlObject.Factory.parse(xmlFileContent).selectChildren(new QName("MyXml"))[0];
paramMap.put("var1", inputXml);
options.setXqueryVariables(paramMap);
XmlObject[] resultsObjects = xmlObject.execQuery("declare variable $var1 as element() external; <a>{$var1/someValues/MoreNodes}</a>", options);
and with these two changes I got what I was looking for:
<a><MoreNodes>Value1</MoreNodes></a>
Hope this helps someone with the same issue that I was facing.There isn't a lot of documentation about how to use this classes.
Thanks.