{{ figure align=center src=“images/Convert-XML-MPP.png” alt=“convert xml mpp java” }}
XML is abbreviated for Extensible Markup Language. It stores data between tags for easy storage and transmission. The MPP format is used for Microsoft Project plans. You can convert XML to MPP and MPP to XML with Java, making import and export of project files straightforward. See the sections below for details:
- XML to MPP or Microsoft Project Data File to XML Conversion – Java API Installation
- Convert or Import XML to MPP File Programmatically using Java
- Convert MPP to XML File Programmatically in Java
XML to MPP or Microsoft Project File to XML Conversion – Java API Installation
Aspose.Tasks for Java supports MPP, XML, MPT, HTML, and many other file formats. You can convert or import XML files to Microsoft Project files and vice‑versa in Java applications. Install the API by downloading the JAR from the Downloads page or add the following repository to your Maven pom.xml:
Repository:
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
Dependency:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-tasks</artifactId>
<version>21.2</version>
<classifier>jdk18</classifier>
</dependency>
Convert or Import XML to MPP File Programmatically using Java
Follow these steps to convert XML to an MPP file:
- Load the input XML file.
- Load a template MPP file.
- Call the copyTo() method of the
Projectclass. - Save the resulting MPP file.
The snippet below demonstrates the conversion:
{{ gist aspose-com-gists a58d91fc3940675de3c3895f0f1c1537 “convert-xml-to-mpp.java” }}
Convert MPP to XML File Programmatically in Java
MPP files store project management data. Converting MPP to XML lets other systems use this information. Use these steps:
- Load the input MPP file with the
Projectclass. - Save the output as XML using the SaveFileFormat enumeration.
Example code:
{{ gist aspose-com-gists a58d91fc3940675de3c3895f0f1c1537 “convert-mpp-to-xml.java” }}
Conclusion
You now know how to convert XML to MPP and MPP to XML using Java. The sample code and step‑by‑step guide show the full process. For more features, visit the API Documentation. If you have questions, ask in the Free Support Forum. We’re happy to help!