SharePoint Developer Center >
SharePoint Products and Technologies Forums
>
SharePoint - Development and Programming
>
ListService.GetListItems() throwing exception for invalid character
ListService.GetListItems() throwing exception for invalid character
- this line throws the exception
the exception info is:XmlNode result = listService.GetListItems("PageList", null, query, viewFields, "5000", queryOpt, null);
[System.InvalidOperationException] = {"There is an error in XML document (2978, 6080)."}
InnerException = {"'', hexadecimal value 0x05, is an invalid character. Line 2978, position 6080."}
Source = "System.Xml"
StackTrace = " at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)\r\n at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)\r\n at System.Web....
TargetSite = {System.Object Deserialize(System.Xml.XmlReader, System.String, System.Xml.Serialization.XmlDeserializationEvents)}
this is site-specific, I've run the same method with the list service pointing to other sites and it works fine
Answers
- Cyrix
it seems to be one of your items that makes the trouble and not the list schema itself.
Inside the query to to order the result by ItemID and then try it with increasing rowlimit- until you get the last ItemID that work. Then search for the item with the following ItemID and have a closer look at it.- Marked As Answer bycyrix86 Monday, November 16, 2009 8:55 PM
All Replies
- Is this in the soap exception being returned?
What kind of list is PageList?
Do any of the fields that you list in viewFields contains xml or html?
certdev.com - The fields in my viewFields expression do not contain any xml or html. The only field returned that contains html/xml is the ows_MetaInfo field which I think is a system field. Even so, i've tried the method on other sites and no problems.
This only happens on one site out of 132
- Cyrix, can you narrow down the query so that no results should be read? It would be of interest whether it is a list-problem.
If everything's Ok then try to "open" the query piece by piece in order to get list item that causes the trouble. - I've set everything to null in the getlistItems call except for the list name "Pages", and it works. As soon as I add the rowlimit string it fails.
When the row limit is null, the result set is only 50 rows - which is what the list is paged by.
If I set the row limit to 95 or anything above 95 the method throws the error listed above.
Even setting the row limit to 94 works.
So the query/viewfields have nothing to do with the error. It's something wierd with the row limt. I'm at a loss here.
And btw, the getlistitems method with all parameters works with other lists on this site. the "pages" list is the only list with the issue. - Cyrix
it seems to be one of your items that makes the trouble and not the list schema itself.
Inside the query to to order the result by ItemID and then try it with increasing rowlimit- until you get the last ItemID that work. Then search for the item with the following ItemID and have a closer look at it.- Marked As Answer bycyrix86 Monday, November 16, 2009 8:55 PM
- Yes a document in the list had a field with non printable control characters in it. Thanks for the help


