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.

Access XML attributes

Avatar

Level 2

How can I access XML attributes in LiveCycle using JavaScript and XPath.

I've tried using:

mynodesFormData.item(i).Name.attributes.getNamedItem("someattr");

Thanks,

Issa

3 Replies

Avatar

Former Community Member

you can use this code:

var myXML=XMLData.parse(xmlIn,false);

var access=XMLData.applyXPath(myXML,"//setFormAccess/access[1]/@value");
cononsole.println(access.value);

xmlIn is your xml, edit "//setFormAccess/access[1]/@value" to match your xml.

Yan.

Avatar

Level 6

Be aware that this will not work for scripts that are executed on the server (for example, in Output).  The XML scripting objects are supported by Reader/Acrobat.

Avatar

Level 2

I figured it out.

I was simply able to use:

mynodesCRFormData.item(i).Name.englishName.value

mynodesFormData.item(i).Name.attribName.value;

where attribName is the name of the attribute and Name the name of the element.

Thanks,

Issa