c# 遍历xml问题 - .NET技术 / C#
xml文件格式如下
XML code:
<?xml version="1.0" encoding="GB2312" ?>
<allproducts version="1.0">
<products>
<product name="prodId" value="28127" />
<product name="prodContent" value="5" />
<product name="prodPrice" value="5" />
</products>
<products>
<product name="prodId" value="10335" />
<product name="prodContent" value="5" />
<product name="prodPrice" value="4.95" />
</products>
<products>
<product name="prodId" value="28328" />
<product name="prodContent" value="5" />
<product name="prodPrice" value="5" />
</products>
</allproducts>
遍历代码如下
C# code:
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("E:\\1.xml");
XmlNodeList list2 = xmldoc.SelectSingleNode("/allproducts").ChildNodes;
XmlNodeList list = xmldoc.SelectSingleNode("/allproducts/products").ChildNo
相关问答:
写了个测试程序如下
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
txt 和XML 格式相应
不借助DataSet
导入读取TXT文件
然后直接写入XML(同一文件,不同数据,递增原数据没有被覆盖情况下增加数据.)
教个要点或最好是有个代码提示的
过路好汉 帮个忙撒^^
不会,帮楼主 ......
<?xml version="1.0" encoding="utf-8" ?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical&q ......
我有一个类似的xml的 string,想通过遍历怎么个xml 输出我想要的element的值
xml 为:
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_ME ......