SharePoint 列表数据作为 XML 字符串
我正在尝试使用 GetListItems Web 服务方法来检索列表中的所有项目。该方法引发 InvalidOperation 异常,消息为“XML 文档中存在错误”。似乎至少有一个列值包含“非法”十六进制值……至少就 XML 节点而言是这样。
除了一次拉回每个项目(并跳过“坏”项目)之外,是否有办法获取 GetListItems 返回的原始 XML 数据?我的想法是,如果我有原始字符串,我可以尝试在将其转换为 XML 节点(然后转换为 DataTable)之前对其进行清理。
任何其他想法将不胜感激。
谢谢杰森
I am trying to use the GetListItems web service method to retrieve all the items of a list. The method is raising an InvalidOperation exception with the message being "There is an error in XML document". It seems that at least one of the column values contains "illegal" hex values...at least as far as XML Nodes go.
Besides pulling back each item one at a time (and skipping the "bad" item), is there a way to get at the raw XML data returned by GetListItems? My thought is that if I have the raw string I can try to sanitize it before converting it to XML Nodes (and then later into a DataTable).
Any other ideas would be appreciated.
Thanks
Jason
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能否验证返回的数据实际上是正确的 XML 数据,而不是 HTML 错误页面(例如 401 或 404 错误页面)?
Can you validate that the data being returned is actually the correct XML data and not an HTML error page such as a 401 or 404 error page?
@Jason我无法完全按照您所描述的方式重现问题,但我想尝试这种技术:
显示您的自动生成 Reference.cs ,将光标定位在调用 GetListItems 的位置(即 XmlNode ndListItems =
listService.GetListItems(sList, null, ndQuery, ndViewFields, "0" , ndQueryOptions, null);
然后按 F12(转到定义)
放置一个断点(和一个观察点),甚至更改自动生成的代码;
在这里您可以检查(快速观看,或您最喜欢的技术)调用返回的 objec[] 结果
即:
}
我期待知道这是否可以帮助您更好地识别或解决问题
@Jason I could not reproduce the problem exactly as you described but I would like to try this technique:
Reveal your autogenerate Reference.cs , position the cursor where you call the GetListItems ( i.e XmlNode ndListItems =
listService.GetListItems(sList, null, ndQuery, ndViewFields, "0" , ndQueryOptions, null);
and then pres F12 ( Go To Definition)
Put a breakpoint (and a watchpoint) or even change the code autogenerated;
here you could be able to inspect (quick watch, or your favorite tecnique) the objec[] restults returned by the invocation
i.e:
}
I look forward to know if this can help you better identify or solve the problem