winform 中关于XML 处理的问题。谢谢.

Kogeo_Guan 2012-05-21 09:21:42
vs 2000 中.
如果 读取 XML 并储存在 数组中.
<?xml version="1.0" encoding="utf-8"?>
<current>
<order id='1'>
<info>
<ordernum>3823</ordernum>
</info>

<product>
<pid id='1'>
<pname>goods1</pname>
<num>1</num>
</pid>

<pid id='2'>
<pname>goods2</pname>
<num>2</num>
</pid>
</product>

<diqu>
<city>city1</city>
<county>county1</county>
<detailed>detailed1</detailed>
</diqu>

<contact>
<moblie>13300000000</moblie>
<tel>2220000</tel>
<member>member</member>
</contact>
</order>

<order id='2'>
<info>
<ordernum>3824</ordernum>
</info>

<product>
<pid id='1'>
<pname>goods1</pname>
<num>1</num>
</pid>

<pid id='2'>
<pname>goods2</pname>
<num>2</num>
</pid>
</product>

<diqu>
<city>city1</city>
<county>county1</county>
<detailed>detailed1</detailed>
</diqu>

<contact>
<moblie>13300000000</moblie>
<tel>2220000</tel>
<member>member</member>
</contact>
</order>
</current>


XML 中有2条 order 数据。 取出 <order> 中的 <info> <product> <diqu> <contact> 请问怎么写呢??
能贴代码吗? 谢谢.. 因为刚学.. 说理论的话 。. 不明白.
...全文
68 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tygh2001 2012-05-22
  • 打赏
  • 举报
回复
一般都是到节点后,进行Children或者Items的循环啊。。
Kogeo_Guan 2012-05-21
  • 打赏
  • 举报
回复
在xml 中. <product> 下的节点 和其他 的节点是不一样的呢.. 怎么判别他是否还有节点? 并输出完整呢?


<product>
<pid id='1'>
<pname>goods1</pname>
<num>1</num>
</pid>

<pid id='2'>
<pname>goods2</pname>
<num>2</num>
</pid>
</product>
tygh2001 2012-05-21
  • 打赏
  • 举报
回复
或者这个?
http://msdn.microsoft.com/zh-cn/library/system.xml.xmldocument.loadxml%28v=vs.80%29.aspx
tygh2001 2012-05-21
  • 打赏
  • 举报
回复
也许下面的内容对你有帮助
http://topic.csdn.net/u/20080523/10/0444c195-4fb1-4d24-9561-62978fe9f363.html
http://blog.csdn.net/iqyeah/article/details/1520753
Kogeo_Guan 2012-05-21
  • 打赏
  • 举报
回复
说少了1下 。。 这段 XML 是 由 Web 返回的 string 类型 字符串! 并不是读取的XML 文件.

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧