question: @ Nullable public static String mergeXml ( @ NotNull RenderingContext context , String sourceXml , String targetXml , File targetFile ) { boolean ok ; String fileName = targetFile . getName ( ) ; String contents ; if ( fileName . equals ( SdkConstants . FN_ANDROID_MANIFEST_XML ) ) { Document currentDocument = XmlUtils . parseDocumentSilently ( targetXml , true ) ; assert currentDocument != null : targetXml + " failed to parse" ; Document fragment = XmlUtils . parseDocumentSilently ( sourceXml , true ) ; assert fragment != null : sourceXml + " failed to parse" ; contents = mergeManifest ( targetFile , targetXml , sourceXml ) ; ok = contents != null ; } else { String parentFolderName = targetFile . getParentFile ( ) . getName ( ) ; ResourceFolderType folderType = ResourceFolderType . getFolderType ( parentFolderName ) ; contents = mergeResourceFile ( context , targetXml , sourceXml , fileName , folderType ) ; ok = contents != null ; } if ( ! ok ) { contents = wrapWithMergeConflict ( targetXml , sourceXml ) ; context . getWarnings ( ) . add ( String . format ( "Merge conflict for: %1$s this file must be fixed by hand" , targetFile . getName ( ) ) ) ; } return contents ; }
target:  Merges sourceXml into targetXml/targetFile (targetXml is the contents of targetFile). Returns the resulting xml if it still needs to be written to targetFile, or null if the file has already been/doesn't need to be updated.