请求webservice,webservice给你返回一个xml,如何解析xml,并将解析出来的数据插入数据库?
3个回答
展开全部
解析XML
switch (XML.NodeType)
{
case XmlNodeType.Element:
if (XML.Name == "Language ")
{
}
if (XML.Name == "Item")
{
MessageBox.Show(XML.GetAttribute("id"));
}
break;
}
}
把XML写到DateSet
StringReader stream = null;
XmlTextReader reader = null;
DataSet dsXml = new DataSet();
stream = new StringReader(xmlString);
reader = new XmlTextReader(stream);
dsXml.ReadXml(reader);
return dsXml;
switch (XML.NodeType)
{
case XmlNodeType.Element:
if (XML.Name == "Language ")
{
}
if (XML.Name == "Item")
{
MessageBox.Show(XML.GetAttribute("id"));
}
break;
}
}
把XML写到DateSet
StringReader stream = null;
XmlTextReader reader = null;
DataSet dsXml = new DataSet();
stream = new StringReader(xmlString);
reader = new XmlTextReader(stream);
dsXml.ReadXml(reader);
return dsXml;
2011-03-07
展开全部
$dom = new DOMDocument('1.0');
$dom ->loadXML("1.XML");
$xml = simplexml_import_dom($dom);
echo "<p>";
/**
循环列出 第一个 members 的 name;
**/
foreach($xml ->members[0] as $v)
{
echo $v->name."<br>";
}
$dom ->loadXML("1.XML");
$xml = simplexml_import_dom($dom);
echo "<p>";
/**
循环列出 第一个 members 的 name;
**/
foreach($xml ->members[0] as $v)
{
echo $v->name."<br>";
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询