Merge "52887: Unable to format xml documents that begin with comments"
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java
index 0e86736..8fc8dd1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java
@@ -938,4 +938,20 @@
                 "\n" +
                 "</resources>");
     }
+
+    public void test52887() throws Exception {
+        // https://code.google.com/p/android/issues/detail?id=52887
+        checkFormat(
+                "res/layout/relative.xml",
+
+                "<!--Comment-->\n" +
+                "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
+                "  android:layout_width=\"match_parent\"\n" +
+                "  android:layout_height=\"match_parent\"/>\n",
+
+                "<!-- Comment -->\n" +
+                "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
+                "    android:layout_width=\"match_parent\"\n" +
+                "    android:layout_height=\"match_parent\" />\n");
+    }
 }