|
|
PowerML core is a free and very easy to use Java API for converting PowerPoint presentations to XML documents. It consists of a single class and an exception:
PresentationParser parses PowerPoint files and offers several methods for XML
generationInvalidFormatException is thrown if the parsed PowerPoint file is invalidSee the PowerML core Javadoc API documentation for details.
Whether you use PowerML core within a complex web application or a simple command-line program, the steps needed to convert a PowerPoint presentation to XML are the same.
In order to create a parser, pass a java.io.InputStream instance containing a
PowerPoint file to the constructor:
// create a presentation parser for parsing presentation.ppt
PresentationParser parser = new PresentationParser(new FileInputStream("presentation.ppt"));
After creation, some parameters can be set:
// set rounding precision for floating point values to three digits after the decimal point
parser.setRoundPrecision(3);
// do not include PowerML schema location
parser.setSchemaLocation(null);
Finally, parse the presentation and generate PowerML, writing it to an output stream:
// output as formatted XML to the console
parser.toFormattedXml(System.out);
The PowerML format is specified in an XML schema file which can be found
at
http://www.powerml.com/schema/powerml.xsd. This URL is referenced
within the generated PowerML file, if not otherwise specified
by means of the method setSchemaLocation.
Take a look at the PowerML schema documentation. Please allow some time to load (size is about 7 MB). If your connection is slow, you may prefer to download it as a zip (2.2 MB) or as a tgz archive (1.9 MB) .