Strip  from received XML  is sometimes seen in ows_MetaInfo and prevents the XML from parsing, so it is now stripped.
diff --git a/src/com/google/enterprise/adaptor/sharepoint/SiteDataClient.java b/src/com/google/enterprise/adaptor/sharepoint/SiteDataClient.java index 6ec751c..c3a1138 100644 --- a/src/com/google/enterprise/adaptor/sharepoint/SiteDataClient.java +++ b/src/com/google/enterprise/adaptor/sharepoint/SiteDataClient.java
@@ -292,6 +292,12 @@ @VisibleForTesting <T> T jaxbParse(String xml, Class<T> klass) throws XmlProcessingException { + if (xml.contains("")) { + // Unit separator is sometimes present in ows_MetaInfo of the response + // XML, but it prevents the XML from being parsed. Since we don't actually + // care about MetaInfo we strip it out. + xml = xml.replace("", ""); + } Source source = new StreamSource(new StringReader(xml)); try { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
diff --git a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java index 898f54c..41f68e5 100644 --- a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java +++ b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
@@ -33,6 +33,7 @@ import com.google.enterprise.adaptor.sharepoint.SharePointAdaptor.SiteUserIdMappingCallable; import com.google.enterprise.adaptor.sharepoint.SharePointAdaptor.SoapFactory; +import com.microsoft.schemas.sharepoint.soap.ItemData; import com.microsoft.schemas.sharepoint.soap.ObjectType; import com.microsoft.schemas.sharepoint.soap.SPContentDatabase; import com.microsoft.schemas.sharepoint.soap.SiteDataSoap; @@ -1703,6 +1704,16 @@ assertNotNull(client.jaxbParse(xml, SPContentDatabase.class)); } + @Test + public void testChar31Stripping() throws Exception { + SiteDataClient client = new SiteDataClient( + new UnsupportedSiteData(), true); + String xml = loadTestString("sites-SiteCollection-Lists-CustomList-1-f.xml") + .replace("<Folder>", + "<Folder xmlns='http://schemas.microsoft.com/sharepoint/soap/'>") + .replace("MetaInfo='2;#'", "MetaInfo='2;#'"); + assertNotNull(client.jaxbParse(xml, ItemData.class)); + } @Test public void testParseUnknownXml() throws Exception {