yair Posted December 23, 2008 Share Posted December 23, 2008 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 More sharing options...
ProgAndy Posted December 23, 2008 Share Posted December 23, 2008 (edited) 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 December 23, 2008 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 More sharing options...
weaponx Posted December 23, 2008 Share Posted December 23, 2008 I concur with ProgAndy, otherwise you can just create the node, then use _XMLSetAttrib to add the attributes separately. Link to comment Share on other sites More sharing options...
yair Posted December 23, 2008 Author Share Posted December 23, 2008 (edited) 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 December 23, 2008 by yair Link to comment Share on other sites More sharing options...
weaponx Posted December 23, 2008 Share Posted December 23, 2008 What don't you get? The syntax is explained in the UDF. You just have to provide the path to the node you want to change. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now