Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

xml

Avatar

Former Community Member
Hi, <br /><br />In a process I have two forms with the same xml schema. I need to copy nodes from the formA to the formB.<br /><br />My problem is in my xml schema I have nodes with maxOccurs = unbounded and I want to pass to the formB only a few of this nodes to the formB.<br /><br />exemple : <br /><br /><FormA><br /> <InfoN><br /> ...<br /> </InfoN><br /> <InfosFils><br /> <login>Jerome</login><br /> ...<br /> </InfosFils><br /> <InfosFils><br /> <login>Marc</login><br /> ...<br /> </InfosFils><br /> <InfosFils><br /> <login>Mikael</login><br /> ...<br /> </InfosFils><br /> <InfosFils><br /> <login>Linda</login><br /> ...<br /> </InfosFils><br /></FormA><br /><br />I want to pass only the nodes <InfosFils> for jerome and linda for example.<br />(In fact, it depend on a variable compt of type int in a loop)<br />I can't do for jerome for example in the setValue : <br /><br />location : <br /><br />/process_data/FormB/object/data/xdp/datasets/data/FormulaireB/InfoFils[1]<br /><br />expression : <br /><br />the info of jerome<br /><br />because the formB is empty and InfoFils[1] doesn't exist.<br /><br />If I do : <br /><br />location : <br /><br />/process_data/FormB/object/data/xdp/datasets/data/FormulaireB<br /><br />and expression : <br /><br />/process_data/FormB/object/data/xdp/datasets/data/FormulaireB/InfoFils[1]<br /><br />It copy the node I want but delete all the other nodes under FormulaireB<br /><br />and if I do the same for linda for example : <br /><br />/process_data/FormB/object/data/xdp/datasets/data/FormulaireB/InfoFils[3]<br /> <br /><br />It will erase the Info of jerome.<br /><br />I don't know how do that. Need I use the xslt transformation ? Or create a component ? Can I use the DOM methodes to create nodes in the setValue ?<br /><br />Thanks for any advice
6 Replies

Avatar

Former Community Member
I think I will try to create my xml into a string variable and then copy it under the root of my formB but it seems to be complicated :(



Edit : It seems to work with small files. Need to test with more data

Avatar

Level 9
Hi Jerome

There are a couple of techniques you can use:

1. Simple XPath

Try /process_data/FormA/InfosFils[login='Jerome' or login='Marc']

There are other ways you could do this.

2. XSLT - ships with Livecycle

3. XQuery component.

4. XMLUtil component



You can find examples of XMLUtil and XQuery here, and download a trial off our web site.:

http://avoka.dnsalias.com/confluence/display/Public/Inserting+XML+data+into+a+form+variable

http://avoka.dnsalias.com/confluence/display/Public/Transforming+XML+Documents



Howard

Avatar

Former Community Member
Thanks,



My issue was not to access node Jerome or linda but to create the nodes in the second form. I did it by creating the xml in a string with serialize and concat function and at the end deserialize this string into the xml I needed.

Avatar

Former Community Member
Hi,



In a setValue,



location :



/process_data/MyXml



Expression :



deserialize(/process_data/@MyStringXml)

Avatar

Level 10
You can use the function deserialize(node) in the xPath builder.



Jasmin