Jump to content
Sign in to follow this  

update an XML field

Recommended Posts


hello all.

i am trying to use _XMLUpdateField to update the value for field "userInactivityTimeOut".

here is the XML:

<?xml version="1.0" encoding="utf-8" ?>
    <section name="lnet" type="lnet.LNetConfigHandler, lnet" />
    <sectionGroup name="sing">
      <section name="context" type="Sing.Context.Support.ContextHandler, Sing.Core"/>
      <section name="objects" type="Sing.Context.Support.DefaultSectionHandler, Sing.Core" />
    <add key="production" value="true"/>
    <add key="environments" value="prod,dev" />
    <add key="environments.production" value="prod"/>
    <add key="ErrorMessageFile" value="cfgErrorMessageList.xml" />
    <add key="logging.file" value="log.config" />
    <add key="application.name" value="NETQ" />
    <add key="userInactivityTimeOut" value="1440000000" />
    <add key="userInactivityCheck" value="60000" />
    <add key="AddTimestampToAlerts" value="true" />

here is what i've tried so far (i can read the current value but stuck on trying to change it):


    $aNodes = _XMLGetNodeCount("/configuration/appSettings/add")

    for $x = 1 to $aNodes
        $key = _XMLGetAttrib("/configuration/appSettings/add[" & $x & "]", "key")

        if $key = "userInactivityTimeOut" Then
            $timeout = _XMLGetAttrib("/configuration/appSettings/add[" & $x & "]", "value")
            ConsoleWrite($timeout & @CRLF)

;neither of the following work
            ;_XMLUpdateField("/configuration/appSettings/add[" & $x & "]", "22")
            ;_XMLUpdateField("/configuration/appSettings/add[" & $x & "]/value", "22")
            ;_XMLUpdateField("/configuration/appSettings/add[" & $x & "]/value/key", "22")

thanks in advance!

Edited by gcue

Share this post

Link to post
Share on other sites

this worked! (hadn't noticed this was available - was too fixated on _XMLUpdateField)

_XMLSetAttrib("/configuration/appSettings/add[" & $x & "]", "value", "144000000000")

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.