XmlNodeReader 返回 {None}
我目前在从 Web 服务调用反序列化 XmlDocument 时遇到问题,这是我的代码: -
public void getTest(XmlDocument requestDoc)
{
XmlDocument results = new XmlDocument();
XmlSerializer serial = new XmlSerializer(typeof(DataRequest));
DataRequest req;
XmlNodeReader reader = new XmlNodeReader(requestDoc.DocumentElement);
req = (DataRequest)serial.Deserialize(reader);
response.write(req.toString());
}
现在,我遇到的问题是,当我单步执行调试时,XmlNodeReader 仅包含“{None}”,requestDoc 肯定有预期的 XML 结构,有什么想法吗?
亲切的问候 吉布
I'm currently having trouble deserializing an XmlDocument from a web service call, here is my code : -
public void getTest(XmlDocument requestDoc)
{
XmlDocument results = new XmlDocument();
XmlSerializer serial = new XmlSerializer(typeof(DataRequest));
DataRequest req;
XmlNodeReader reader = new XmlNodeReader(requestDoc.DocumentElement);
req = (DataRequest)serial.Deserialize(reader);
response.write(req.toString());
}
now, the trouble I am having is that the XmlNodeReader just contains "{None}" when I step through in debug, the requestDoc definatly has the expected XML structure, any ideas?
Kind regards
Gib
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“none”可能只是意味着它还没有开始迭代,并且处于 BOF(因为缺乏更好的术语)。它应该仍然有效。通常,如果不是,则意味着命名空间不正确 - 仔细检查源代码中的
xmlns
。这工作得很好,例如:
The "none" probably just means it hasn't started iterating yet, and is at BOF (for want of a better term). It should still work. Usually, if it doesn't it means the namespaces are incorrect - double-check for
xmlns
in the source.This works fine, for example: