±éÀúÒ»¸öxml²¢Êä³öÖ¸¶¨½ÚµãµÄÖµ - .NET¼¼Êõ / C#
ÎÒÓÐÒ»¸öÀàËƵÄxmlµÄ string£¬Ïëͨ¹ý±éÀúÔõô¸öxml Êä³öÎÒÏëÒªµÄelementµÄÖµ
xml Ϊ£º
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_METADATA</RequestType>
<Restrictions>
<RestrictionList>
<ObjectExpansion>ObjectProperties</ObjectExpansion>
</RestrictionList>
</Restrictions>
<Properties>
<PropertyList>
</PropertyList>
</Properties>
</Discover>
ÎÒÏÖÔÚͨ¹ý±éÀú£¬ÏÈÅжÏÊÇ·ñÓÐ ObjectExpansion ½Úµã£¬Èç¹ûÓÐÊä³öÆäÖµ¡£
ÇëÖ¸½Ì¡£
C# code:
// XML ¶ÁÈ¡XMLÎļþÖеÄÔªËغÍÔªËØÊôÐÔ
private static void PrintElement(XmlDocument document)
{
XmlNodeList nodeList = document.GetElementsByTagName("*"); //»ñÈ¡ËùÓеÄNode
for (int i = 0; i < nodeList.Count; i++)
{
XmlNode node = nodeList.Item(i);
MessageBox.Show(node.Name); //´òӡÿһ¸önodeµÄÃû³Æ
}
}
private static void PrintAttributes(XmlDocument document)
{
XmlNodeList nodeList = document.GetElementsByTagName("*");
XmlNamedNodeMap nameNodeMap;
XmlElement element;
XmlAttribute attribute;
string at
Ïà¹ØÎÊ´ð£º
Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
<a>aaa
</a>
<b>bbb
</b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......
ÈçºÎ¶ÔxmlÄÚÈÝÊý¾Ý½øÐбȽÏ
ÀýÈ磺
<?xml version='1.0' encoding='utf-8'?>
<TestLIST>
<PID>40</PID>
<TestName>ÉîÛÚÊÐ</TestName>
......
ÎÒÃÇC#×öÒ»¸ö´°Ìå ÍùÊý¾Ý¿âÀï²åÈëÊý¾Ý
SqlConnection cn = new SqlConnection("Data Source=20090713-1752\\SQLEXPRESS;Initial Catalog=goods;Integrated Security=True");
......
ÄÚÈÝÈçÌâ¡£¡£ÔÚC#Àï¸ÄÈçºÎдÄØ£¿
±¾À´Ë¼Â·ÊÇÏȱȶԽڵãÃû³Æ£¬ÈçÊǵĻ°¾Í±£´æҪɾ³ý½ÚµãµÄϱê·ÅÔÚÊý×éÀȻºóÑ»·É¾³ý£¬µ«·¢ÏÖ¡£¡£µ±ÎÒɾ³ýµÚÒ»¸öºó£¬ËùÓнڵãϱêÊýÁ¿¶¼·¢Éú¸Ä±ä¡£¡£
¾Í²»ÄÜÔÙ°´ÕÕ֮ǰ¼Í¼µÄ½Úµã ......
ÆäʵÕâ¸öÎÊÌâ¿ÉÒÔÕÒÀÏʦ»Ø´ð£¬Õâ²»·Å¼ÙÁËÂð£¬ÎÊÎʸ÷λ¸ßÊÖ¡£
¾ø¶ÔÓÐ £¬ASP¡¢netÀïÓкöàµÄÂß¼Åжϵȶ¼ÐèÒªwinform»ù´¡
C#ÓïÑÔ
Ado.net C/S½á¹¹
Asp.net B/S½á¹¹
Á©¶¼ÊÇ΢Èí³öµÄ£¬¶¼ÄÜÓÃC#½øÐпª·¢ ......