buildSrc/src/main/java/com/uber/okbuck/core/util/XmlUtil.java [53:88]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public static void writeToXml(Document document, File xmlFile) {
    try {
      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
      transformer.setOutputProperty(OutputKeys.INDENT, "no");
      transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "yes");

      // normalize document
      document.normalize();

      // Set xml standalone to true to not print the attribute
      document.setXmlStandalone(true);

      // Set android namespace
      document
          .getDocumentElement()
          .setAttribute("xmlns:android", "http://schemas.android.com/apk/res/android");

      Writer stringWriter = new StringWriter();
      transformer.transform(new DOMSource(document), new StreamResult(stringWriter));

      String xmlString =
          stringWriter
              .toString()
              .replaceAll("(?s)<!--.*?-->", "")
              .replaceAll("xmlns:android=\"http://schemas.android.com/apk/res/android\"", "")
              .replaceFirst(
                  "<manifest ",
                  "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" ")
              .replaceAll(">[\\s\\S]*?<", "><");

      writeText(xmlString, xmlFile);
    } catch (IOException | TransformerException e) {
      throw new IllegalStateException(e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugin/src/main/java/com/uber/okbuck/core/util/XmlUtil.java [53:88]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public static void writeToXml(Document document, File xmlFile) {
    try {
      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
      transformer.setOutputProperty(OutputKeys.INDENT, "no");
      transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, "yes");

      // normalize document
      document.normalize();

      // Set xml standalone to true to not print the attribute
      document.setXmlStandalone(true);

      // Set android namespace
      document
          .getDocumentElement()
          .setAttribute("xmlns:android", "http://schemas.android.com/apk/res/android");

      Writer stringWriter = new StringWriter();
      transformer.transform(new DOMSource(document), new StreamResult(stringWriter));

      String xmlString =
          stringWriter
              .toString()
              .replaceAll("(?s)<!--.*?-->", "")
              .replaceAll("xmlns:android=\"http://schemas.android.com/apk/res/android\"", "")
              .replaceFirst(
                  "<manifest ",
                  "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" ")
              .replaceAll(">[\\s\\S]*?<", "><");

      writeText(xmlString, xmlFile);
    } catch (IOException | TransformerException e) {
      throw new IllegalStateException(e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



