For some reason the reply that you've sent is no longer in my Inbox, so I will have to reply to my old post.
Your question was:
> Why not do it all in XSLT ? (its not clear to me why you are
> constructing xml in java and then using extension functions)
And the answer is that these XML fragments can be a lot and are not known up-front, being received over the wire.
Additionally, (dynamic) XPath queries are build and used on the NodeInfo instances (build from the XML fragments), so using an already build NodeInfo instance for performing these queries will speed things considerably.
Coming back to my initial question, has anyone ideas on how to approach this in a performance efficient way?
On Wed, Dec 21, 2011 at 10:21 PM, Full Midnight <email@example.com>
Of course, the closing tag should not contain the @id attribute, i.e.:
On Wed, Dec 21, 2011 at 10:17 PM, Full Midnight <firstname.lastname@example.org>
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 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:
Any ideas / links on how this can be achieved?
Thank you in advance for your answers.