我遇到了一个XML值的问题,它在我调试时将它加载到XML文档中,但没有找到值或要访问的节点。这里是xml。我想得到的价值是“活跃”。现在这个XML不是一个文件或任何东西,是作为一个字符串传递的......(不能修改这个部分)只能访问我可以创建函数来访问它的类,但不能修改实际获取值的代码并且把它当作一个 “XML字符串” 这里只阅读XML节点
<Clients>
<BillingCycle>30</BillingCycle>
<Category>1</Category>
<Type>Admin</Type>
<AddressCat>3</AddressCat>
<ZipCodeCat>5</ZipCodeCat>
<ClientManager>
<UserID>5</UserID>
<ZPVal>1</ZPVal>
<DRY1>Test</DRY1>
<Active>1</Active>
</ClientManager>
</Clients>
C#代码
public bool IsActive(int ClientID, int VassID)
{
bool isActive = false;
HelperClass helper = new HelperClass();
XmlDocument xml = new XmlDocument();
//at this point i can see the data was stored in the xml when debugging
xml.LoadXml(helper.GetClientXML(ClientID, VassID));
//have tried the following do not woerk
// XmlNode node = xml.SelectSingleNode ("/Clients/ClientManager/Active/text()");
XmlNode node = xml.SelectSingleNode("Clients/ClientManager/Active");
int isActiveVal = Convert.ToInt32(node.Value);
if (isActiveVal == 1)
{
isActive = true;
}
return isActive;
}