xmlSave.save(this, writer, options);
}
public Document save(Document doc, Map<?, ?> options, DOMHandler handler)
{
XMLSave xmlSave = createXMLSave();
domHandler = handler;
if (domHandler == null)
{
domHandler = new DefaultDOMHandlerImpl();
}
Document document = doc;
if (document == null)
{
try
{
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
}
catch (Exception e)
{
throw new RuntimeException(e.getMessage());
}
}
if (defaultSaveOptions == null || defaultSaveOptions.isEmpty())
{
return xmlSave.save(this, document, options == null ? Collections.EMPTY_MAP : options, domHandler);
}
else if (options == null)
{
return xmlSave.save(this, document, defaultSaveOptions, domHandler);
}
else
{
Map<Object,Object> mergedOptions = new HashMap<Object, Object>(defaultSaveOptions);
mergedOptions.putAll(options);
return xmlSave.save(this, document, mergedOptions, domHandler);
}
}