/ * Read XML data in XML mode * /
aaa>
aaa>
/ * The first method * / ds.readxml ("Your XMLFile Name");
Container.DataItem ("bb");
Container.DataItem ("cc");
DS.Readxmlschema ("Your XMLFile Name");
/*The second method*/
aaa>
If I want to find 123, then I should write 321?
USING SYSTEM.XML;
XmlDataDocument Xmldoc = new system.xml.xmldataDocument ();
XMLDoc.Load (@ "c: /config.xml");
XMLELEMENT ELEM = XMLDoc.GetElementByid ("add");
String str = elem.attributes ["value"]. Value
/ * The third method:
Selectsinglenode reads the XML * --- /
-------------------------------------------------- ------------------
XML Version = "1.0" encoding = "UTF-8"?>
XmLDocument Doc = New XmLDocument ();
Doc.Load (strxmlname);
XMLNode node = doc.selectsinglenode ("/ configuration / appsettings / connectionstring");
IF (Node! = NULL)
{
String k1 = node.value;
// null
String k2 = node.innertext;
// data source = yf; user ID = CTM_DBO; Password = 123
String k3 = node.innerxml;
// data source = yf; user ID = CTM_DBO; Password = 123
Node = NULL;
}
*********************************************************** ******************
XML Version = "1.0" Encoding = "UTF-8"?>
XMLNode node = doc.selectsinglenode ("/ configuration / appsettings / add");
IF (Node! = NULL)
{
String k = node.attributes ["key"]. Value;
String v = node.attributes ["value"]. Value;
Node = NULL;
}
* ------------------------------------------------- ------------------- *
XMLNode node = doc.selectsinglenode ("/ configuration / appsettings / add");
IF (Node! = NULL)
{
XMLNodeReader NR = New XMLNodeReader (Node);
nr.movetocontent ();
// Check if the current node is a content node. If this node is not a content node, the reader jumps forward to the next content node or file end.
Nr.MovetoAttribute ("Value");
String s = nr.value;
Node = NULL;
}