Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Insert Node into XML using XPATH


Level 2

I'm having problems inserting a node into a XML. After getting some attributes from the CRC result i'd like to store them in a temp xml variable.
After that the parent node of the attributes should be inserterd in a goal XML with a repeating node structure.

Whats the right way to set a node to a certain position in the goal XML?

Now the only thing i'm getting is erros about transaction:

Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a307d1e:fd15:4d35c503:1351f50 status: ActionStatus.ABORT_ONLY >
    at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(



0 Replies


Level 8

Inserting a node with an XPath expression is not as easy as it would seem.  If I remember right, all of the sibling nodes get removed (strange but true).

Check out this post  for some alternatives


Level 4

Write a DSC to do it.  I think that's the best way.  Or have your form do it (especially if its Flex)


Level 10

You can always append new nodes which has a unique tag name (this won't get overwritten).

Which means, each time when you add a node, it should have tag name which has not already present within the same parent node.

Later you can replace the tag name with the actual name by using XSL transformations.

I've tried this in one of my project and worked fine.