@Override
    public void applyAllChanges() throws ApplyChangesException {
        try {
            // Check if we have a valid xml file by attempting to create a xml
            // document from it
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            builder.setErrorHandler(new ErrorHandler() {

                @Override
                public void warning(SAXParseException e) throws SAXParseException {
                    throw e;
                }

                @Override
                public void fatalError(SAXParseException e) throws SAXParseException {
                    throw e;
                }

                @Override
                public void error(SAXParseException e) throws SAXParseException {
                    throw e;
                }
            });

            builder.parse(new InputSource(new StringReader(this.xmlDocument.getText().trim())));
        } catch(SAXParseException e) {
            // Give some nice hints about what to do next
            throw new ApplyChangesException("Error (probably) on line "+e.getLineNumber() + " column "+e.getColumnNumber()+ ": " + e.getMessage());
        } catch(ParserConfigurationException e) {
            // Will never happen, the parser is correctly configured
        } catch(IOException e) {
            // Will never happen, there is no real IO going on
        } catch(SAXException e) {
            // Shouldn't happen, but whatever
            throw new ApplyChangesException("Couldn't verify XML: "+ e.getMessage());
        }
    }