Working with xml files in batch job

Hi everybody,

Excuse me for my english …

I have a class, extending RunBaseBatch, that read an xml file and create an other.

The code runs correctly but when it is executed in batch mode, the following error appears at the underlined line: “System.NullReferenceException: Object reference not set to an instance of an object.”

Xmldeclaration = xmlDoc.createXmlDeclaration(

‘1.0’,‘UTF-8’,‘no’);

xmlDoc.insertBefore(Xmldeclaration,xmlDoc.documentElement());

XmlName = xmlDocument.childNodes().nextNode().nextSibling().name();

xmlElement = xmlDoc.createElement(XmlName);

XMLWrite = xmlDoc.appendChild(xmlElement);

XMLRead = rootNode.selectSingleNode(

“/”+XmlName);

Am i missing something ?

I am using Dynamics AX 2012.

Regards,

Florent