XmlDocument xmldoc = new XmlDocument(); string xmlPath = HttpContext.Server.MapPath("~/*****.xml"); xmldoc.Load(xmlPath); XmlElement root = xmldoc.DocumentElement; string node = root.SelectSingleNode("/images/image[@id=‘1‘]/url").InnerText;
<?xml version="1.0" encoding="utf-8" ?> <images> <image id="0"> <url>/images/0.png</url> </image> <image id="1"> <url>/images/1.png</url> </image> </images>
时间: 2024-10-06 00:41:17