@Nullable private String overrideXmlFileContent(@NotNull Document vdDocument,@Nullable StringBuilder errorLog){
  int targetWidth=0;
  int targetHeight=0;
  try {
    targetWidth=Integer.parseInt(myContext.getVectorWidth());
    targetHeight=Integer.parseInt(myContext.getVectorHeight());
  }
 catch (  NumberFormatException e) {
    errorLog.append("Invalid size " + myContext.getVectorWidth() + " X "+ myContext.getVectorHeight());
    return null;
  }
  if (targetWidth <= 0 || targetHeight <= 0) {
    errorLog.append("Size must be positive!");
    return null;
  }
  if (targetWidth > VdPreview.MAX_PREVIEW_IMAGE_SIZE || targetHeight > VdPreview.MAX_PREVIEW_IMAGE_SIZE) {
    errorLog.append("Size can't be bigger than " + VdPreview.MAX_PREVIEW_IMAGE_SIZE);
    return null;
  }
  VdOverrideInfo info=new VdOverrideInfo(targetWidth,targetHeight,myContext.getVectorOpacity(),myContext.getVectorAutoMirrored());
  String xmlFileContent=VdPreview.overrideXmlContent(vdDocument,info,errorLog);
  return xmlFileContent;
}

@ Nullable private String overrideXmlFileContent ( @ NotNull Document vdDocument , @ Nullable StringBuilder errorLog ) { int targetWidth = 0 ; int targetHeight = 0 ; try { targetWidth = Integer . parseInt ( myContext . getVectorWidth ( ) ) ; targetHeight = Integer . parseInt ( myContext . getVectorHeight ( ) ) ; } catch ( NumberFormatException e ) { errorLog . append ( "Invalid size " + myContext . getVectorWidth ( ) + " X " + myContext . getVectorHeight ( ) ) ; return null ; } if ( targetWidth <= 0 || targetHeight <= 0 ) { errorLog . append ( "Size must be positive!" ) ; return null ; } if ( targetWidth > VdPreview . MAX_PREVIEW_IMAGE_SIZE || targetHeight > VdPreview . MAX_PREVIEW_IMAGE_SIZE ) { errorLog . append ( "Size can't be bigger than " + VdPreview . MAX_PREVIEW_IMAGE_SIZE ) ; return null ; } VdOverrideInfo info = new VdOverrideInfo ( targetWidth , targetHeight , myContext . getVectorOpacity ( ) , myContext . getVectorAutoMirrored ( ) ) ; String xmlFileContent = VdPreview . overrideXmlContent ( vdDocument , info , errorLog ) ; return xmlFileContent ; }
override the xml file by parsing it , modifying attributes and saving to an string .
