如何使用XMLFile设置值?

时间:2011-07-18 13:04:58

标签: xml xpath wix

如何使用XMLFile为RollingFileAppender设置文件的值?

<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="NULL"/>
      <appendToFile value="true"/>
      <rollingStyle value="Size"/>
      <maxSizeRollBackups value="10"/>
      <maximumFileSize value="100KB"/>
      <staticLogFileName value="true"/>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/>
      </layout>
    </appender>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
      <file value="NULL"/>
    </appender>
</log4net>

1 个答案:

答案 0 :(得分:5)

ElementPath =元素的XPath
 Name =属性名称
 值=要设置的值

<util:XmlFile 
   Action="setValue" 
   ElementPath="//log4net/appender/[\[]@name='RollingFileAppender'[\]]/file" 
   Name="value" 
   Value="SOMETHING NOT NULL"/>