Hi all,

I really did not yet found a solution on how to approach this problem, so I would kindly ask for your support.

There are several XML fragments, each of them being deserialized individually (as queries will run on each of them) using something like:
---
StreamSource source = new StreamSource(new ByteArrayInputStream( xmlFragment.getBytes( "UTF-8" ) ));
Configuration configuration = context.getConfiguration();
NodeInfo deserializedFragment = configuration.buildDocument(source);
---

At a later point in time, some of these fragments will have to be sent back to the transformation, through the integrated extension function.

My question is how can I build another NodeInfo which is composed using the (already deserialized) NodeInfos (corresponding to each XML fragment)?
Please note that, for performance reasons, I would like to avoid serializing each fragment from NodeInfo to XML and then deserializing the concatenated XML fragments to NodeInfo.



As an example, below we have two XML fragments:
--- Fragment 1
<fragment id="1">
  ...
</fragment id="1">
---

--- Fragment 2
<fragment id="2">
  ...
</fragment id="2">
---

In the integrated extension function, a new NodeInfo will be build by putting together nodeInfoFragment1 (the NodeInfo corresponding to Fragment 1) and nodeInfoFragment2 ((the NodeInfo corresponding to Fragment 2), so that the NodeInfo returned from the extension function to the transformation will be:
---
<fragment id="1">
  ...
</fragment id="1">
<fragment id="2">
  ...
</fragment id="2">
---

Any ideas / links on how this can be achieved?

Thank you in advance for your answers.

Regards,
M.