How to read XML node's value in InstallScript

牧云@^-^@ 提交于 2021-01-29 08:10:24

问题


I have following XML file.

<Configuration>
    <Config1 connection="SQL">SampleData<Config1>
</Configuration>

I want to read the value "SampleData" of node Config1 in InstallScript function. I tried properties text, value, nodevalue. But none of it worked. I can read attribute connection's value. But how I can read node's value "SampleData"?


回答1:


Help Documentation: Maybe try this help file documentation:

  • Searching for XML Data
  • Modifying XML Files
    • Using XPath Expressions to Find XML Data in an XML File
  • XML File Changes View
  • Using Windows Installer Properties to Dynamically Modify XML Files

There are several other places in the help file that XML issues are discussed, but that should get you going.


Installscript: I suppose you could go Installscript on it. I would not recommend it. I don't have any samples for you, but pillaging github.com giveth the following. No idea if it works, but maybe give it a go. No guarantees at all - at your own risk.


Some Further Links:

  • Adding Support for XML Encoding Options
  • Advanced Tab for an XML File


来源:https://stackoverflow.com/questions/53419212/how-to-read-xml-nodes-value-in-installscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!