AlbatorV Posted December 16, 2008 Share Posted December 16, 2008 Hi, i need help to read <pathstring> value, check if path exists, if not delete from <path color= to </path> Here my xlm file... <?xml version="1.0" encoding="UTF-8"?> <foldercolors> <path color="{2F499E2B-8B6E-4B80-8E3B-C73E032E801F}"> <dir> <pathstring>C:\EXISTE</pathstring> </dir> </path> <path color="{FEDC8A0B-6F3B-4113-A733-17A008C87ADB}"> <dir> <pathstring>C:\NEXISTEPAS</pathstring> </dir> </path> </foldercolors> Link to comment Share on other sites More sharing options...
weaponx Posted December 16, 2008 Share Posted December 16, 2008 Plenty of examples here:http://www.autoitscript.com/forum/index.ph...hl=xml++wrapperSome tips:$pathstring = _XMLGetValue("/foldercolors/path[" & 1 & "]/dir/pathstring") If NOT FileExists($pathstring) Then _XMLDeleteNode("/foldercolors/path[" & 1 & "]") EndIf Link to comment Share on other sites More sharing options...
AlbatorV Posted December 17, 2008 Author Share Posted December 17, 2008 (edited) First many thanks for this example... Now my problem... my extension's file is "*.oxc". With this extension, nothing work... if i rename to *.xml, it's ok, value can be read. And i don't understand why existing path are deleted with my script... #include "_XMLDomWrapper.au3" #include <Array.au3> $sFile = "C:\TEMP\foldercolors.oxc" $ret = _XMLFileOpen ($sFile) for $i=1 to 100 $pathstring = _XMLGetValue("/foldercolors/path[" & $i & "]/dir/pathstring") If NOT FileExists($pathstring) Then _XMLDeleteNode("/foldercolors/path[" & $i & "]") EndIf next Edited December 17, 2008 by AlbatorV Link to comment Share on other sites More sharing options...
AlbatorV Posted December 22, 2008 Author Share Posted December 22, 2008 (edited) Please i need help again... i don't understand why all non existing path are not delete. i need to execute my script 3 or 4 times to delete all path... #include "_XMLDomWrapper.au3" #include <Array.au3> $sFile = "C:\TEMP\foldercolors.xml" $ret = _XMLFileOpen ($sFile) For $i=1 to _XMLGetNodeCount("/foldercolors/path") $pathstring = _XMLGetValue("/foldercolors/path[" & $i & "]/dir/pathstring") If IsArray($pathstring) Then If NOT FileExists($pathstring[1]) Then _XMLDeleteNode("/foldercolors/path[" & $i & "]") EndIf EndIf Nextfoldercolors.xml Edited December 22, 2008 by AlbatorV Link to comment Share on other sites More sharing options...
will88 Posted December 22, 2008 Share Posted December 22, 2008 (edited) this what you wanted or no? #include "_XMLDomWrapper.au3" #include <Array.au3> $sFile = "C:\TEMP\foldercolors.xml" $ret = _XMLFileOpen ($sFile) For $i=1 to _XMLGetNodeCount("/foldercolors/path") $pathstring = _XMLGetValue("/foldercolors/path[" & $i & "]/dir/pathstring") If IsArray($pathstring) Then If NOT FileExists($pathstring[1]) Then $count = _XMLGetNodeCount("/foldercolors/path") Do deletenode() $count = _XMLGetNodeCount("/foldercolors/path") Until $count = -1 EndIf EndIf Next Func deletenode() _XMLDeleteNode("/foldercolors/path[" & $i & "]") EndFunc Edited December 22, 2008 by will88 Password-Keeper 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