Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Rename an XML tag using javascript

Avatar

Level 2

Dear adobe experts,

I have a requirement to rename XML tags, in the interface for an adobe form, using javascript.

the XML looks like this:

<ELEMENT>

     <DATA>

          <ROW_IID>0</ROW_IID>

          <PARENT>0</PARENT>

          <CHILD>0</CHILD>

     </DATA>

     <DATA>

          <ROW_IID>1</ROW_IID>

          <PARENT>0</PARENT>

          <CHILD>0</CHILD>

     </DATA>

</ELEMENT>

and the result should look something like this:

<ELEMENT>

     <CHAIR>

          <ROW_IID>0</ROW_IID>

          <PARENT>0</PARENT>

          <CHILD>0</CHILD>

     </CHAIR>

     <TABLE>

          <ROW_IID>0</ROW_IID>

          <PARENT>0</PARENT>

          <CHILD>0</CHILD>

     </TABLE>

</ELEMENT>

Is this possible and how can I do this? I was hoping that something like renameNode() (for instance) is also possible in the javascript set for adobe forms.

If it's not possible I'm going to have to create new nodes, put the data from the existing node in the new node and remove the original node. This will be a lot more work and just renaming is easier :-).

Kind regards,

Niels

0 Replies