Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

how to get element or attribute properly from a list of nodes?

Avatar

Level 1

var producerCdList = xfa.resolveNodes("xfa.record.policyCert.polProducer[*]");

var i=0;

var cd = new Array();;

for(i;i<producerCdList.length;i++){

    //cd = producerCdList.getElement("producerCd",2).rawValue;

    cd[i] = producerCdList.item(i).getAttribute("producerCd");

     //future evaluation/validation

}

i have this code but I cant properly extract the producer code that i need for validation.  how should i do it right?

please help.

thanks.

1 Reply

Avatar

Level 10

Hi,

I'm not sure without seeing the XML you are dealing with but if I understand your code you should be able to just do;

cd[i] = producerCdList.item(i).producerCd.value;

If that doesn't work can you post a sample of the XML.

Regards

Bruce