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.

Set xsi:nill="true" attribute in XML

Avatar

Level 2

Hi,

I'm trying to set the xsi:nill attribute in an XML element by scripting. (Javascript)

The setAttribute method doesn't work. And manually adding a new and empty element doesn't work either.

When I leave a field which has binding empty, the nill attribute is automatically set to true.

Why can't I reproduce this by scripting? Does someone have a clue?

Thanks in advance!

Regards,

Kristof

2 Replies

Avatar

Level 2

Does anybody have a clue? I still

need this...

Avatar

Level 10

Hi Kristof,

I think you can only do this with a loadXML method, makes it very clumsy by the following code;

var dataItems = xfa.datasets.createNode("dataGroup","items");
xfa.datasets.data.nodes.append(dataItems);
dataItems.loadXML('<item xsi:nil="true" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"/>',false,true);

Will produce the following xml

<items>
      <item xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</items>

Good Luck

Bruce