Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Javascript prase XML

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

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