Javascript prase XML

emilr19993875

06-03-2018

Hi, I need to read a big XML file and parse it. The problem is that the javascript activity is generating the error `out of memory`.

This code generates the error:

var fileContent = loadFile("FILEPATH", "UTF-8");

fileContent = fileContent.substring(fileContent.indexOf("\n") + 1); // Remove first line: <?xml version="1.0" encoding="UTF-8"?>

xmlContent = new XML(fileContent);

for each(var element in xmlContent.elements) {

logInfo(element.name);

}

Is there a better way to prase an XML file?

Accepted Solutions (1)

Accepted Solutions (1)

Amit_Kumar

MVP

06-03-2018

Hi,

have you seen Importing data ?

Adobe Campaign cannot import XML files using standard file import activities. It is possible to import XML files using JavaScript but only with small volumes: less than 10K records per file.

You are getting this error because of js memory limit.

There is a maxMB setting in serverConf.xml which by default is set to 64MB. So, if you are going to compare multiple lists with a huge number of records, a good idea will be to get the maxMB increased to 512 MB.

If your instance is hosted by Adobe, please reach out to support for getting this done.

You should divide this xml into multiple files and process it in delta mode or change the architecture and check what can you do to import this data in any other way.

Regards,

Amit

Answers (0)