There is an XML file in the following format:
CopyCode The Code is as follows: <date>
<Item>
<ID> 1 </ID>
<Name> ABC </Name>
</Item>
<Item>
<ID> 2 </ID>
<Name> CDE </Name>
</Item>
<Item>
<ID> 3 </ID>
<Name> EFG </Name>
</Item>
</Date>
I use ASP to query ID = 2 and enter the value of the corresponding name. How can I write it? Using ASPCopy codeThe Code is as follows: dim ID
Id = "2"
Set objxml = server. Createobject ("Microsoft. xmldom ")
Objxml. Load (server. mappath (filepath ))
Set objnodes = objxml. selectsinglenode ("Date/item [ID = '" & ID & "']")
// You can change the above ID to name when querying the name.
Query ID. How do I output the related name?Copy codeThe Code is as follows: 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)
If the ID already exists, the call is:Copy codeThe Code is as follows: Set objnodes = objxml. selectnodes ("Date/item [ID = '" & ID & "']")
Loop output.