ASP Read XML Instance code _ Application Tips

Source: Internet
Author: User
Language.xml
Copy Code code as follows:

<?xml version= "1.0" encoding= "gb2312"?>
<languageRoot>

<!--Simplified Chinese-->
<language>
<LanguageName> Simplified Chinese </LanguageName>
<LanguageValue>SimpilifiedChinese</LanguageValue>
<LanguageImages>images</LanguageImages>
<LanguageFile></LanguageFile>
</language>

<!--Chinese-->
<language1>
<LanguageName> Traditional Chinese </LanguageName>
<LanguageValue>TraditionalChinese</LanguageValue>
<LanguageImages>imagesBig5</LanguageImages>
<LanguageFile>ddd</LanguageFile>
</language1>
</languageRoot>

Sl.asp
Copy Code code as follows:

<%
Set objXML2 = Server.CreateObject ("Msxml2.domdocument")
Objxml2.async = False
Loadresult = Objxml2.load (Server.MapPath ("Language.xml"))

If not Loadresult then
Response.Write "Load XML File Error"
Response.End
End If
Set objnodes = Objxml2.getelementsbytagname ("Languageroot/language")
For i = 0 to Objnodes.length-1
Response.Write Trim (Objnodes (i). selectSingleNode ("LanguageName"). Text) & "<br>"
Response.Write Trim (Objnodes (i). selectSingleNode ("Languagevalue"). Text) & "<br>"
Response.Write Trim (Objnodes (i). selectSingleNode ("Languageimages"). Text) & "<br>"
Next
Set objnodes = Nothing
Set objnodes = Objxml2.getelementsbytagname ("Languageroot/language1")
For i = 0 to Objnodes.length-1
Response.Write Trim (Objnodes (i). selectSingleNode ("LanguageName"). Text) & "<br>"
Response.Write Trim (Objnodes (i). selectSingleNode ("Languagevalue"). Text) & "<br>"
Response.Write Trim (Objnodes (i). selectSingleNode ("Languageimages"). Text) & "<br>"
Response.Write Trim (Objnodes (i). selectSingleNode ("Languagefile"). Text) & "<br>"
Next
Set objnodes = Nothing
Set Objxml = Nothing
%>

The above code is passed by the cloud-dwelling community editing test.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.