Class OoxmlFacade

java.lang.Object
com.github.oowekyala.ooxml.messages.OoxmlFacade

public final class OoxmlFacade extends Object
Main entry point of the API. Example usage:

    public AppConfig parseConfigFile(Path path) throws IOException, XmlException {
        DocumentBuilder builder;
        try {
            builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            throw new IllegalStateException("Platform does not support XML", e);
        }

        PositionedXmlDoc doc;
        try (Reader reader = Files.newBufferedReader(path)) {
            // configure the input source's system ID to have
            // a file path in the messages
            InputSource iSource = new InputSource();
            iSource.setSystemId(path.toString());
            iSource.setCharacterStream(reader);

            // Here we go
            doc = new OoxmlFacade().parse(builder, iSource);
        }

        // This is the object that maps DOM nodes to file
        // positions
        XmlPositioner positioner = doc.getPositioner();

        // Create the reporter, which you can use during parsing
        // to report messages on specific nodes
        XmlErrorReporter reporter = new DefaultXmlErrorReporter(XmlMessageHandler.SYSTEM_ERR, positioner));

        return appSpecificParsing(doc.getDocument(), reporter);
    }