日期:2014-05-18 浏览次数:20782 次
<?xml version="1.0" standalone="yes" ?> <TestCase> <Case CaseID="Case001"> <User UserID="User001"> <FunctionName>FName1</FunctionName> <ActType>Create</ActType> <RequestNumber>3</RequestNumber> <FrequencyNumber>2</FrequencyNumber> <DelayNumber>1</DelayNumber> </User> <User UserID="User002"> <FunctionName>FName2</FunctionName> <ActType>Update</ActType> <RequestNumber>5</RequestNumber> <FrequencyNumber>2</FrequencyNumber> <DelayNumber>3</DelayNumber> </User> </Case> <Case CaseID="Case002"> <User UserID="User001"> <FunctionName>FName21</FunctionName> <ActType>Create</ActType> <RequestNumber>3</RequestNumber> <FrequencyNumber>2</FrequencyNumber> <DelayNumber>1</DelayNumber> </User> <User UserID="User002"> <FunctionName>FName22</FunctionName> <ActType>Update</ActType> <RequestNumber>5</RequestNumber> <FrequencyNumber>2</FrequencyNumber> <DelayNumber>3</DelayNumber> </User> </Case> </TestCase>
<html> <head> <script type="text/javascript" src="loadxmldoc.js"> </script> </head> <body> <script type="text/javascript"> xmlDoc = loadXMLDoc("Xml1.xml"); var nodeList = xmlDoc.selectNodes("//Case[@CaseID='Case001']//User[@UserID='User002']//*"); for(i=0;i<nodeList.length;i++) { alert(nodeList.item(i).nodeName+"-"+nodeList.item(i).childNodes[0].nodeValue); } </script> </body> </html>