Code example for DOMResult

0
                TransformerHandler handler = this.factory.newTransformerHandler();
                nextHandler = handler;
                if (this.parentNode != null) {
                    this.result = new DOMResult(this.parentNode);
                } else { 
                    this.result = new DOMResult();
                } 
                handler.setResult(this.result);
            } catch (javax.xml.transform.TransformerException local) {
                throw new XWorkException("Fatal-Error: Unable to get transformer handler", local);
            } 
        } 
     
        /** 
         * Return the newly built Document. 
         */ 
        public Document getDocument() {
            if (this.result == null || this.result.getNode() == null) {
                return null; 
            } else if (this.result.getNode().getNodeType() == Node.DOCUMENT_NODE) {
                return (Document) this.result.getNode();