private void dump (Document doc)
            throws IOException, FileNotFoundException, XPathExpressionException,
                   ProtocolException, TransformerException {
        long startMillis = System.currentTimeMillis();
        String strFileName = null;
        NodeList nl = (NodeList) xp.evaluate("//processing-instruction()",
                                    doc, XPathConstants.NODESET);
        for (int i = 0; i < nl.getLength(); i++) {
            String strTarget = ((ProcessingInstruction) nl.item(i)).getTarget();
            if (strTarget.equals("file-name"))
                strFileName = ((ProcessingInstruction) nl.item(i)).getData();
            nl.item(i).getParentNode().removeChild(nl.item(i));
        }
        
        write(url, strFileName, doc, outputProperties);
        long endMillis = System.currentTimeMillis();
        logger.info("Document " + strFileName + " dumped in " + (endMillis - startMillis) + "ms.");
    }