问题
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