算法问题,请高手指点,很急,在线等候,马上给分!
<?xml version="1.0"?>
<xmlstart>
<test>
<book>c#</book>
<price>100</price>
<test1>
<date>20020101</date>
<author>
<author1>SZX</author1>
</author>
<author>
<author2>PEK</author2>
</author>
</test1>
</test>
<test>
<book>c++</book>
<price>100</price>
<test1>
<date>20020101</date>
<author>
<author1>SZX</author1>
</author>
<author>
<author2>PEK</author2>
</author>
</test1>
</test>
</xmlstart>
遍历该文件后,需要得到结果为:
c#,100,20020101,SZX
c#,100,20020202,PEK
c++,100,20020101,SZX
c++,100,20020202,PEK
有谁用c#的sax(不用dom)做过这样的算法,很急,请指教?
问题点数:80、回复次数:3Top
1 楼sunwindone(周日华)回复于 2002-11-08 10:20:51 得分 0
我想了一下,但不知道下面几个变量怎么办?
怎么知道当前节点有没有父节点和子节点和他们的值?
当前节点判断
XmlTextReader reader;
while(reader.read())
{
if (currCode 没有 子节点 )
{
while(currCode 没有 父节点)
{
string=string + 节点值;
}
}
}Top
2 楼spring_ok(广州泰能软件)回复于 2002-11-08 10:31:18 得分 80
hasChildNodes 代表有没有子节点。Top
3 楼sunwindone(周日华)回复于 2002-11-08 10:37:31 得分 0
这个好像要在dom的方式才能用到啊?Top




