我有以下xml:
<?xml version="1.0" standalone="yes"?>
<DataSet1 xmlns="http://tempuri.org/DataSet1.xsd">
<objectdata>
<id>3</id>
<name>CM 08 10 AT</name>
</objectdata>
</DataSet1>
我试图在C#中从这个xml中获取值id和名称,如下所示:
string folder = Android.OS.Environment.ExternalStorageDirectory.ToString() + "/ObjectFolder/object.xml";
XmlDocument doc = new XmlDocument();
doc.Load(folder);
XmlNode node = doc.DocumentElement.SelectSingleNode("/DataSet1/objectdata");
我也试过了:
XmlNode node = doc.DocumentElement.SelectSingleNode("/objectdata");
但它也不起作用。我哪里错了?