Expand my Community achievements bar.

Insert Node into XML using XPATH

Avatar

Level 2
Hi,

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(TxConnectionManager.java:304)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)

Etc..

Thx!

3 Replies

Avatar

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 http://forums.adobe.com/thread/343163  for some alternatives

Avatar

Former Community Member

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

Avatar

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.

Nith