document = (Document)((Node)((XMLRoot)object).getObject()).getOwnerDocument();
} else {
document = objectToXML(object, xmlDescriptor, isXMLRoot);
}
if ((result instanceof SAXResult) && (isFragment())) {
FragmentContentHandler fragmentHandler = new FragmentContentHandler(((SAXResult) result).getHandler());
if (isXMLRoot) {
String oldEncoding = transformer.getEncoding();
String oldVersion = transformer.getVersion();
if (((XMLRoot) object).getEncoding() != null) {
transformer.setEncoding(((XMLRoot) object).getEncoding());