SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to create a dataset with Reporting Services from a SharePoint list (inside the root web).

When I want to build the query for the dataset I get the following error:


'', hexadecimal value 0x0B, is an invalid character. Line 1, position 9605. (System.Xml)

Program Location:

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar)
   at System.Xml.XmlTextReaderImpl.ParseNumericCharRefInline(Int32 startPos, Boolean expand, BufferBuilder internalSubsetBuilder, Int32& charCount, EntityType& entityType)
   at System.Xml.XmlTextReaderImpl.ParseNumericCharRef(Boolean expand, BufferBuilder internalSubsetBuilder, EntityType& entityType)
   at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
   at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
   at System.Xml.XmlTextReaderImpl.ParseAttributes()
   at System.Xml.XmlTextReaderImpl.ParseElement()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.ReadCurrentNode(XmlDocument doc, XmlReader reader)
   at System.Xml.XmlDocument.ReadNode(XmlReader reader)
   at System.Xml.Serialization.XmlSerializationReader.ReadXmlNode(Boolean wrapped)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderSPListService.Read53_GetListCollectionResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer102.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

What I learned is that some item(s) in some list and some field of the root web must have an invalid character. Not the same as the invalid characters for file names but invalid for the XmlDeserialization that is being used here (all below 0x20).

The character I know try to find an remove is "0x0B" (vertical tab). Does someone know how I can search for this character with C#.

Here's what I've tried so far:

static void Main(string[] args)

            if (args != null && args.Length > 0)
                string site = args[0];
                int invalidChar = 0x0B;

                using (SPWeb web = new Microsoft.SharePoint.SPSite(site).OpenWeb())
                    foreach (SPList list in web.Lists)
                        Console.WriteLine(string.Format("Processing list: {0}", list.Title));

                            foreach (SPField field in list.Fields)
                                if (!field.Hidden &&
                                    field.GetType() == typeof(SPFieldMultiLineText))
                                    //Console.WriteLine(string.Format("-  MLT-Field found: {0}", field.InternalName));

                                    foreach (SPListItem item in list.Items)
                                            if (item.Fields.ContainsField(field.InternalName) &&
                                                item[field.Id] != null &&
                                                Console.WriteLine(string.Format("- Invalid character found. Item: {0}, Field: {1}", item.ID, field.InternalName));
                                        catch (Exception ex)
                                            Console.WriteLine(string.Format("- Error on checking item: {0}. Error: {1}", item.ID, ex.Message));
                        catch (Exception ex)
                            Console.WriteLine(string.Format("- Error on checking fields of list. Error: {0}", ex.Message));

But I was unsuccessful in finding it (to many false results). I believe that this "conversion" doesn't get me the real "0x0B" character as it is stored in the field values.

Does anyone have an idea to solve this?

share|improve this question
For special char, I use char.ConvertFromUtf32(160) where 160 is the base10 value of the char. – Philippe Lavoie Jul 5 '12 at 16:29
Thank you. You're answer helped me in finding more of the "invalid" chars. But unfortunately it didn't solved the problem completely. – Shihan Jul 12 '12 at 9:31
up vote 0 down vote accepted

Apparently a colleague of me was able to solve this issue.

The error occurs because the SOAP web service that uses XML 1.0 doesn't support some hexadecimaal chars during the serialisation/deserialisation process.

Luckily we can "fix" the chars after the serialisation with a SoapExtension. The SoapExtension allows us to intercept the messages between server and client and alter them.

We were able to replace the invalid chars with spaces with our SoapExtension.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.