dim id id= "2 " Set objXML = Server.CreateObject( "Microsoft.XMLDOM ") objXML.Load(server.MapPath(filePath)) Set objNodes = objXML.selectSingleNode( "date/item[id = ' " id " '] ") //查询name话把上面的id变为name就可以了
查询ID,怎么输出相关的name?
dim id id= "2 " Set objXML = Server.CreateObject( "Microsoft.XMLDOM ") objXML.Load(server.MapPath(filePath))
Response.Write(objXML.selectSingleNode( "date/item[id = ' " id " ']/name ").text)
如果ID有重复的,调用就是: Set objNodes = objXML.selectNodes( "date/item[id = ' " id " '] ") 进行循环输出。