Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Update XML tree nodes

Avatar

Level 4

Hi all,

For example, if my form have a XML schema structured as follow:

<Form>

  <Attribute1/>

  <Attribute2/>

  <Structure1>

    <item1/>

    <item2/>

    <item3/>

  <Structure1/>

</Form>

And the data of tree node "Structure1" are come form database, so I get the following XML from the JDBC service.

<Data>

  <Structure1>

    <item1>value1</item1>

    <item2>value2</item2>

    <item3>value3</item2>

  <Structure1/>

<Data/>

Can I update the tree note "\Form\Structure1" with one statement but not updating each item by separate statement?

Regards

Bill

5 Replies

Avatar

Former Community Member

hi,

After some testing, I concluded that it was not possible because the import data from XML is done for the entire form.

If fields are not defined, they will be considered void and if the data existed before they are overwritten.

Ludo

Avatar

Level 4

Hi Ludo,

Thanks for the reply, am also with no luck with this.

Any guru can confirm it is not supported?

Regards

Bill

Avatar

Level 10

I'm using /process_data/xml1/Form/Structure1 = /process_data/xml2/Data/Structure1

and I get the following result.

<Form>
  <Attribute1/>
  <Attribute2/>
  <Structure1>
    <item1>value1</item1>
    <item2>value2</item2>
    <item3>value3</item3>
  </Structure1>
</Form>

Is that not what  you want?

Jasmin

Avatar

Level 4

Hi Jasmin,

Thanks for the reply.

I think I am missing some of the detail, which is the data will have more then one record:

<Data>

  <Structure1>

    <item1>value1</item1>

    <item2>value2</item2>

    <item3>value3</item3>

  </Structure1>
  <Structure1>

    <item1>value4</item1>

    <item2>value5</item2>

    <item3>value6</item3>

  </Structure1>

</Data>

And with the syntax you listed, I can only assign the first record to the target, checked the XPath syntax and tried a few with no luck

Regards

Bill

Avatar

Level 10

If you need more than one record, then it won't work.

You'll need to write your own function in a Script service or a custom component.

Jasmin