code: protected void marshalDomResult(Object graph, DOMResult domResult) throws XmlMappingException {
  		if (domResult.getNode() == null) {
  			try {
  				synchronized (this.documentBuilderFactoryMonitor) {
  					if (this.documentBuilderFactory == null) {
  						this.documentBuilderFactory = createDocumentBuilderFactory();
  					}
  				}
  				DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
  				domResult.setNode(documentBuilder.newDocument());
  			}
  			catch (ParserConfigurationException ex) {
  				throw new UnmarshallingFailureException(
  						"Could not create document placeholder for DOMResult: " + ex.getMessage(), ex);
  			}
  		}
  		marshalDomNode(graph, domResult.getNode());
  	}
docs: Template method for handling {@code DOMResult}s.
  <p>This implementation delegates to {@code marshalDomNode}.
  @param graph    the root of the object graph to marshal
  @param domResult the {@code DOMResult}
  @throws XmlMappingException if the given object cannot be marshalled to the result
  @throws IllegalArgumentException if the {@code domResult} is empty
  @see #marshalDomNode(Object, org.w3c.dom.Node)