Jump to content

_XMLCreateChildWAttr problem


yair
 Share

Recommended Posts

hi, i have an xml like

<configuration>
    <appSettings>
        <add key="root_path" value="D:\MvpT2Data"/>
    </appSettings>
</configuration>

using _xml UDF how do i add a key AND and value in the same path?

#include "_XMLDomWrapper.au3"
_XMLFileOpen("config.xml")
_XMLCreateChildWAttr("//appSettings","add", "key", "root_pathyy")
Link to comment
Share on other sites

Does it return the node object? The you could do this:

$Node = _XMLCreateChildWAttr("//appSettings","add", "key", "root_pathyy")

_XMLCreateAttrib($Node,"value","X:\My\Path")

/Edit: No, it doesn't return an object. Instead, use an Array for attribName and attribValue:

Dim $Attribs[2] = ["key","value"]

Dim $values[2] = ["root_pathyy","X:\Path\yy"]

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

cool, this works

Dim $Attribs[2] = ["key","value"]
Dim $values[2] = ["root_path","X:\Path\yy"] 
_XMLCreateChildWAttr("//appSettings","add", $Attribs, $values)

now, whats the best method to overwrite the older child node?

assume the first attribute (key) stays unchanged but the second (root_path) should be changed.

edit:

weaponx, didnt see your reply, i'll check that setAttrib.

re-edit:

no, i dont get it.

Edited by yair
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...