Fix for incorrect handling of Whitespace after an array open in XmlFormatReader
diff --git a/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs
index fb89504..6b368b7 100644
--- a/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs
+++ b/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs
@@ -12,6 +12,24 @@
         {

             StringWriter sw = new StringWriter();

             JsonFormatWriter.CreateInstance(sw)

+                .WriteMessage(message);

+            return sw.ToString();

+        }

+

+        protected override TBuilder DeserializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)

+        {

+            JsonFormatReader.CreateInstance((string)message).Merge(builder);

+            return builder;

+        }

+    }

+

+    [TestFixture]

+    public class JsonCompatibilityFormattedTests : CompatibilityTests

+    {

+        protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)

+        {

+            StringWriter sw = new StringWriter();

+            JsonFormatWriter.CreateInstance(sw)

                 .Formatted()

                 .WriteMessage(message);

             return sw.ToString();

diff --git a/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
index 50ef6f0..62b9456 100644
--- a/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
+++ b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
@@ -1,4 +1,5 @@
 using System.IO;

+using System.Xml;

 using Google.ProtocolBuffers.Serialization;

 using Google.ProtocolBuffers.TestProtos;

 using NUnit.Framework;

@@ -22,4 +23,24 @@
             return reader.Merge("root", builder, registry);

         }

     }

+

+    [TestFixture]

+    public class XmlCompatibilityFormattedTests : CompatibilityTests

+    {

+        protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)

+        {

+            StringWriter text = new StringWriter();

+            XmlWriter xwtr = XmlWriter.Create(text, new XmlWriterSettings { Indent = true, IndentChars = "  " });

+

+            XmlFormatWriter writer = XmlFormatWriter.CreateInstance(xwtr).SetOptions(XmlWriterOptions.OutputNestedArrays);

+            writer.WriteMessage("root", message);

+            return text.ToString();

+        }

+

+        protected override TBuilder DeserializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)

+        {

+            XmlFormatReader reader = XmlFormatReader.CreateInstance((string)message).SetOptions(XmlReaderOptions.ReadNestedArrays);

+            return reader.Merge("root", builder, registry);

+        }

+    }

 }
\ No newline at end of file
diff --git a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs
index 4685358..a52d04e 100644
--- a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs
+++ b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs
@@ -194,7 +194,9 @@
                 .Build();

 

             StringWriter sw = new StringWriter();

-            XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message);

+            XmlWriter xwtr = XmlWriter.Create(sw, new XmlWriterSettings {Indent = true, IndentChars = "  "});

+

+            XmlFormatWriter.CreateInstance(xwtr).WriteMessage("root", message);

 

             string xml = sw.ToString();

 

@@ -221,7 +223,9 @@
                 .Build();

 

             StringWriter sw = new StringWriter();

-            XmlFormatWriter.CreateInstance(sw)

+            XmlWriter xwtr = XmlWriter.Create(sw, new XmlWriterSettings { Indent = true, IndentChars = "  " });

+

+            XmlFormatWriter.CreateInstance(xwtr)

                 .SetOptions(XmlWriterOptions.OutputNestedArrays | XmlWriterOptions.OutputEnumValues)

                 .WriteMessage("root", message);