移动XPathNodeIterator和Child XPathNodeIterator的同步问题
我在代码中创建了两个 XPathNodeIterator it
和 childIt
代码
片段如下,
string selectSfStr = "Equipment/Main/Sub";
it = nav.Select(selectSfStr);
while (it.MoveNext())
{
; // do something here
if (it.Current.HasChildren)
{
XPathNodeIterator childIt;
string selectChildSfStr = "//item";
childIt = nav.Select(selectChildSfStr);
while (childIt.MoveNext())
{
; // do something here, but I found bug. The childIt can't move sychronized with the parent `it`.
;// How can I synchronize `childIt` here when I moved to next `it`.
}
}
}
我的 xml 文件嵌套有 Equipment/Main/Sub/item
的序列> 并且每个sub
节点有多个sub
节点和多个item
I created two XPathNodeIterator it
and childIt
in my code
Code snippet as this,
string selectSfStr = "Equipment/Main/Sub";
it = nav.Select(selectSfStr);
while (it.MoveNext())
{
; // do something here
if (it.Current.HasChildren)
{
XPathNodeIterator childIt;
string selectChildSfStr = "//item";
childIt = nav.Select(selectChildSfStr);
while (childIt.MoveNext())
{
; // do something here, but I found bug. The childIt can't move sychronized with the parent `it`.
;// How can I synchronize `childIt` here when I moved to next `it`.
}
}
}
my xml file nested with the sequence of Equipment/Main/Sub/item
and there are multi sub
nodes and multi item
for each of sub
nodes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最终,我修复了这个错误,如下所示:
Eventually, I fixed this bug as this,