How To: Work with MSPDI files

Since Microsoft Project 2002, Microsoft Project has been able to read and write an XML-based data interchange format called MSPDI..

The sample code below illustrates how to read data from an MSPDI file.

import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.mspdi.MSPDIReader;

...

MSPDIReader reader = new MSPDIReader();
ProjectFile projectFile = reader.read(inputFile);

The sample code below illustrates how to write data to an MSPDI file.

import net.sf.mpxj.ProjectFile;
import net.sf.mpxj.mspdi.MSPDIWriter;

...

MSPDIWriter writer = new MSPDIWriter();
writer.write(projectFile, outputFileName);