永发信息网

如何编写或从XML配置文件中读取

答案:1  悬赏:20  手机版
解决时间 2021-12-01 21:38
  • 提问者网友:我一贱你就笑
  • 2021-12-01 14:18
如何编写或从XML配置文件中读取
最佳答案
  • 五星知识达人网友:未来江山和你
  • 2021-12-01 14:55
配置文件是XML配置文件(配置) config文件中会有像许多条目
abcd


xyz


choise1


    NSIS共有4 XML的插件可供选择; NsisXML(由Wizou).xML插件,NsisXML(乔尔)和NSXML 使用NsisXML(由Wizou):Outfile "$%temp%NSISTest.exe"
    RequestExecutionLevel user
    Installdir "$Temp"
    Showinstdetails show
    !include LogicLib.nsh
    Page InstFiles
    !define XMLFILE "$instdirmyxml.xml"
    Section
    StrCpy $9 "Did not exist"
    nsisXML::create
    nsisXML::load "${XMLFILE}"
    ${If} $0 = 0
    ;build a new basic XML file:
    nsisXML::create
    nsisXML::createProcessingInstruction "xml" 'version="1.0" encoding="UTF-8" standalone="yes"'
    nsisXML::appendChild
    nsisXML::release $2
    ${EndIf}
    nsisXML::select '/choise'
    ${If} $2 = 0
    StrCpy $1 $0
    nsisXML::createElement "choise"
    nsisXML::appendChild
    ${Else}
    nsisXML::getText
    StrCpy $9 $3
    ${EndIf}
    DetailPrint "Old value: $9"
    System::Call 'kernel32::GetTickCount()i.r5' ;Get some "random" value to save
    nsisXML::setText "$5"
    nsisXML::release $2
    nsisXML::save "${XMLFILE}"
    nsisXML::release $0
    DetailPrint "Saved new value: $5"
    SectionEnd

    在优先次运行我得到:Old value: Did not exist
    Saved new value: 709289703
    Completed

    并在第二次运行我得到:Old value: 709289703
    Saved new value: 709308687
    Completed


我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯