eltorro Posted April 21, 2007 Author Share Posted April 21, 2007 Hmmm bow I cant get XMLCreateChildNodeWAttr to work #include <_XMLDomWrapper.au3> #include <Array.au3> Local $sFile = @ScriptFullPath & ".xml" If @error = 0 Then _XMLCreateFile ($sFile, "Work", True) _XMLFileOpen ($sFile) _XMLCreateRootChild("Day") $attribs = _ArrayCreate("Start") $values = _ArrayCreate("1200") _XMLCreateChildNode("Work/Day", "Enheder") _XMLCreateChildNodeWAttr("Work/Day/Enheder", "Enhed", $attribs, $values) EndIf The last entry is not written as far as I can see You are correct. I rewrote the fuction as _XmlCreateChildWAttr() and forgot to rename it. I have fixed it now. I just mapped _XMLCreateChildNodeWAttr to _XmlCreateChildWAttr and deleted the obsolete code. I have updated the downloads. This should be your output now: <?xml version="1.0"?> <Work> <Day> <Enheder> <Enhed Start="1200"/> </Enheder> </Day> </Work> eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Shevilie Posted April 22, 2007 Share Posted April 22, 2007 But you fogot to upload it ?? The _XmlCreateChildWAttr() function work but the _XMLCreateChildNodeWAttr still doesnt Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
eltorro Posted April 22, 2007 Author Share Posted April 22, 2007 I uploaded it again. I clicked on the download link and looked at the code and for sure it's what I uploaded now. eltorro. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Shevilie Posted April 22, 2007 Share Posted April 22, 2007 Nice works now You should change the last updated text 04.03.2007 (Version 1.0.3.39) and now the function produce this output in the console - (Not important as it works, but may confuse) >Running:(3.2.2.0):C:\Programmer\AutoIt3\autoit3.exe "C:\Documents and Settings\Kalle\Skrivebord\test.au3" <><><><><><><><><><><><><><><>+>18:02:38 AutoIT3.exe ended.rc:0 +>18:02:39 AutoIt3Wrapper Finished Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
ofLight Posted April 24, 2007 Share Posted April 24, 2007 First off let me just say i Love this UDF, great work eltorro I am useing the same Longhorn Unattend_LH.xml file that Jazkal posted about. I am currently useing your suggested solution of adding a Prefix and it is working great with the XMLUpdateField function. This works great _XMLUpdateField("/un:unattend/un:settings/un:component/un:UILanguage","NewValue")oÝ÷ Øz0z÷«Â§"Úò¶¬z+pØmåÌ,*Þj×)]6^~éܶ*'ÖvƧºw±¥ç-yÖ¶¸º×+"²Ø^.)Þ!©±è§«¢+Ø%}a51 ÉÑ ¡¥±9½ ÅÕ½Ðì½Õ¸éÕ¹Ñѹ½Õ¸éÍÑÑ¥¹Ì½Õ¸é½µÁ½¹¹Ð½Õ¸éUÍɽչÑÌÅÕ½Ðì°ÅÕ½Ðí1½±½Õ¹ÑÌÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤$ and it is Adding This to the XML file <LocalAccounts xmlns=""/> I am Trying to get THis as a Result <LocalAccounts /> There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
eltorro Posted April 25, 2007 Author Share Posted April 25, 2007 First off let me just say i Love this UDF, great work eltorro I am useing the same Longhorn Unattend_LH.xml file that Jazkal posted about. I am currently useing your suggested solution of adding a Prefix and it is working great with the XMLUpdateField function. This works great _XMLUpdateField("/un:unattend/un:settings/un:component/un:UILanguage","NewValue")oÝ÷ Øz0z÷«Â§"Úò¶¬z+pØmåÌ,*Þj×)]6^~éܶ*'ÖvƧºw±¥ç-yÖ¶¸º×+"²Ø^.)Þ!©±è§«¢+Ø}a51 ÉÑ ¡¥±9½ ÅÕ½Ðì½Õ¸éÕ¹Ñѹ½Õ¸éÍÑÑ¥¹Ì½Õ¸é½µÁ½¹¹Ð½Õ¸éUÍɽչÑÌÅÕ½Ðì°ÅÕ½Ðí1½±½Õ¹ÑÌÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤oÝ÷ Ù©Ýج×báËh¶0·âç(uî´.¢éí³¥ eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
ofLight Posted April 25, 2007 Share Posted April 25, 2007 That Worked for the _XMLCreateChildNode thank you for your help, I really apreciate it, also thank you for the Microsoft support link. I ended up using _XMLCreateChildNode("/un:unattend/un:settings/un:component/un:UserAccounts","LocalAccounts","","urn:schemas-microsoft-com:unattend") I also noticed there is No "Create Node Attribute" Function in your UDF, is that because it isnt possible to add an Attribute after a node has been created? There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
eltorro Posted April 25, 2007 Author Share Posted April 25, 2007 (edited) I think this won't work because the node doesn't exist. _XMLCreateChildNodeWAttr("/un:unattend/un:settings/un:component/un:UserAccounts/un:LocalAccounts", "LocalAccounts", "wcm:action", "add","","urn:schemas-microsoft-com:unattend")oÝ÷ Ø"¶Ë©¦vÚzØb±«¢+Ù}a51 ÉÑ ¡¥±9½]ÑÑÈ ÅÕ½Ðì½Õ¸éÕ¹Ñѹ½Õ¸éÍÑÑ¥¹Ì½Õ¸é½µÁ½¹¹Ð½Õ¸éUÍɽչÑÌÅÕ½Ðì°ÅÕ½Ðí1½±½Õ¹ÑÌÅÕ½Ðì°ÅÕ½ÐíÝ´éÑ¥½¸ÅÕ½Ðì°ÅÕ½ÐíÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíÕɸéÍ¡µÌµµ¥É½Í½Ðµ½´éÕ¹ÑѹÅÕ½ÐìoÝ÷ Ú«¨µâÊ'¢ØyÛaz·¢°Ú*ºBæxÚxm®&îµê®¢ÑnËb¢x§Ê«P1b²ØZµ·jëجÚh²Èëhi×Zm®&îµæµêÚ^«yéÜæyßêº^bj{¬ysIë@¶ÚânÚæzØ^jÛk»y«¢+Ø)}a51MÑÑÑÉ¥ ÅÕ½Ðì½Õ¸éÕ¹Ñѹ½Õ¸éÍÑÑ¥¹Ì½Õ¸é½µÁ½¹¹Ð½Õ¸éUÍɽչÑ̽ոé1½±½Õ¹ÑÌÅÕ½Ðì°ÅÕ½ÐíÝ´éÑ¥½¸ÅÕ½Ðì°ÅÕ½ÐíÅÕ½Ðì¤oÝ÷ Ù»ü¨º¯zj+zØZYµÈb èuèÂ)ei×m涸º×¡©e¡ûazb-Â¥u·§yǬ±ªò¶¨ç±¦XÙrªæ¥üêZ¶¬xØ^©â×±z'îºjPr§¶Íh©×=«aªç«Ég¥uçW0°«y«^Ûk¶§Ë²°pYZuÛay«m®&îµëh¶~*ì·öæj×!x'¡×+%yÛhiÊ.¦W¨~az·âÅë-¢yø«²Úh²Ö®¶s`¥õÔÄ7&VFTGG&"gV÷C²÷Vã§VæGFVæB÷Vã§6WGFæw2÷Vã¦6ö×öæVçB÷Vã¥W6W$66÷VçG2÷Vã¤Æö6Ä66÷VçG2gV÷C²ÂgV÷C·v6Ó¦7FöâgV÷C²ÂgV÷C¶FBgV÷C² eltorro Edited April 26, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
ofLight Posted April 26, 2007 Share Posted April 26, 2007 Is it supposed to be this?No, That was My Bad, The Line I posted was correct because in my Script I create that First "LocalAccounts" Node at an earlyer Point. So at the time I run that line the node has already been created. Sorry for not includeing that.Thank you for the Update and Suggestions, _XMLCreateAttrib seems to be workin Great There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
RooperGee Posted May 2, 2007 Share Posted May 2, 2007 Excellent - this was just what I was looking for! Any ideas on an error I am getting? I am using the following function to change the settings for a scanner program before I launch it:Func _ScanSettings() $sXmlFile ="C:\settings.xml" If @error Then MsgBox(4096, "File Open", "Cannot open PACSScan XML File") Exit Else $oOXml = "" $oOXml = _XMLFileOpen($sXmlFile) EndIf If Not IsObj($oOXml) then MsgBox(0,"Error","No Xml file.") Exit EndIf $sRet = _XMLSelectNodes ("//SETTINGS/*") For $i = 1 to $sRet[0] Select Case $sRet[$i] = "STATIONNAME" _XMLUpdateField("SETTINGS/*[" & $i & "]", $Location) Case $sRet[$i] = "COLORMODE" _XMLUpdateField("SETTINGS/*[" & $i & "]", $ColorMode) Case $sRet[$i] = "AUTOINVERT" _XMLUpdateField("SETTINGS/*[" & $i & "]", $AutoInvert) EndSelect Next EndFuncThe second time the function is called I get this error:COM Error with DOM!err.description is: err.windescription: Invalid class stringerr.number is: 800401F3err.lastdllerror is: 14000err.scriptline is: 111err.source is: err.helpfile is: err.helpcontext is: I see I am having trouble with this portion of the XML DOM wrapper include, but I don't know what to do.$objDoc = ObjCreate("Msxml2.DOMdocument." & $x & ".0")Thanks! Progress lies not in enhancing what is, but in advancing towards what will be. - Kahlil Gibran Link to comment Share on other sites More sharing options...
eltorro Posted May 3, 2007 Author Share Posted May 3, 2007 (edited) Excellent - this was just what I was looking for! Any ideas on an error I am getting? I am using the following function to change the settings for a scanner program before I launch it: Func _ScanSettings() $sXmlFile ="C:\settings.xml" If @error Then MsgBox(4096, "File Open", "Cannot open PACSScan XML File") Exit Else $oOXml = "" $oOXml = _XMLFileOpen($sXmlFile) EndIf If Not IsObj($oOXml) then MsgBox(0,"Error","No Xml file.") Exit EndIf $sRet = _XMLSelectNodes ("//SETTINGS/*") For $i = 1 to $sRet[0] Select Case $sRet[$i] = "STATIONNAME" _XMLUpdateField("SETTINGS/*[" & $i & "]", $Location) Case $sRet[$i] = "COLORMODE" _XMLUpdateField("SETTINGS/*[" & $i & "]", $ColorMode) Case $sRet[$i] = "AUTOINVERT" _XMLUpdateField("SETTINGS/*[" & $i & "]", $AutoInvert) EndSelect Next EndFunc The second time the function is called I get this error: COM Error with DOM! err.description is: err.windescription: Invalid class string err.number is: 800401F3 err.lastdllerror is: 14000 err.scriptline is: 111 err.source is: err.helpfile is: err.helpcontext is: I see I am having trouble with this portion of the XML DOM wrapper include, but I don't know what to do. $objDoc = ObjCreate("Msxml2.DOMdocument." & $x & ".0") Thanks!What's happening is that the loop is trying to find the latest version of MSXML. I set the highest number to look for at 8 ( future??). Currently, I believe msxml is at ver 6. I guess I should supress the error message unless no version is found. If you want to know what version the udf is using, open a file and call _XMLGetDomVersion(). You can set the the loop to that version or call the _XMLFileOpen with an explicit version number. _XMLFileOpen("myfile.xml","",4) What I need is a better way to determine version. Edit: Duh. Just search System32 Edited May 3, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
RooperGee Posted May 3, 2007 Share Posted May 3, 2007 What's happening is that the loop is trying to find the latest version of MSXML. I set the highest number to look for at 8 ( future??). Currently, I believe msxml is at ver 6. I guess I should supress the error message unless no version is found. If you want to know what version the udf is using, open a file and call _XMLGetDomVersion(). You can set the the loop to that version or call the _XMLFileOpen with an explicit version number. _XMLFileOpen("myfile.xml","",4) What I need is a better way to determine version. Edit: Duh. Just search System32 Thanks Eltorro! I modified my script to use _XMLGetDomVersion() after the first _XMLFileOpen to get the version number. Then call subsequent _XMLFileOpen's with the explicit version number. This seems to be working fine. Thanks for your help! Progress lies not in enhancing what is, but in advancing towards what will be. - Kahlil Gibran Link to comment Share on other sites More sharing options...
eltorro Posted May 3, 2007 Author Share Posted May 3, 2007 Updated the download. The search for the version now look is @Systemdir for msxml[x].dll. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Leandro Conca Posted May 10, 2007 Share Posted May 10, 2007 Updated the download. The search for the version now look is @Systemdir for msxml[x].dll. There is a typing mistake in this version! This did not work! If FileExists(@SystemDir&"msxml"&$x&".dll") Then oÝ÷ Ø =Ú+&Ë" ÷"Û!¢é]m殶s`¤bfÆTW7G277FVÔF"fײgV÷C²b3#¶×7ÖÂgV÷C²fײb33c·fײgV÷C²æFÆÂgV÷C²FVà Both in _XMLCreateFile and _XMLFileOpen (lines 126 and 203). By the way... Great UDF! Link to comment Share on other sites More sharing options...
eltorro Posted May 11, 2007 Author Share Posted May 11, 2007 @#$%! Fixed. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
weaponx Posted June 7, 2007 Share Posted June 7, 2007 (edited) First off I really like this UDF, so far it is working well. However I am getting an error attempting to create grandchild nodes. ACTUAL OUTPUT: <menu> <folder name="Antivirus" oscode="255"> <item xmlns="0" name="Norton Antivirus" target="WINFILES\Antivirus\Norton\NAV.exe" oscode="112" /> <item xmlns="0" name="AVG" target="WINFILES\Antivirus\AVG\avg.exe" oscode="112" /> </folder> <folder name="Spyware" oscode="255"> <folder xmlns="0" name="Install" oscode="255" /> <folder xmlns="0" name="Run" oscode="255" /> </folder> </menu> EXPECTED OUTPUT: <menu> <folder name="Antivirus" oscode="255"> <item xmlns="0" name="Norton Antivirus" target="WINFILES\Antivirus\Norton\NAV.exe" oscode="112" /> <item xmlns="0" name="AVG" target="WINFILES\Antivirus\AVG\avg.exe" oscode="112" /> </folder> <folder name="Spyware" oscode="255"> <folder xmlns="0" name="Install" oscode="255"> <item name="Spyware Auto Install" target="WINFILES\Spyware\spywareinstall.exe" oscode="" /> </folder> <folder xmlns="0" name="Run" oscode="255"> <item name="Spyware Auto Install" target="WINFILES\Spyware\spywarerun.exe" oscode="" /> </folder> </folder> </menu> #include "_XMLDomWrapper.au3" #include <Array.au3> Local $sFile = "archrival.xml" FileDelete ( $sFile ) _XMLCreateFile ($sFile, "menu", True) _XMLFileOpen ($sFile) $ATTRIBS1 = _ArrayCreate("name", "oscode") $ATTRIBS2 = _ArrayCreate("name", "target", "oscode") ;Root folders _XMLCreateRootNodeWAttr("folder", $ATTRIBS1, _ArrayCreate("Antivirus", "255")) _XMLCreateRootNodeWAttr("folder", $ATTRIBS1, _ArrayCreate("Spyware", "255")) ;Child folders _XMLCreateChildWAttr("/menu/folder[@name='Spyware']", "folder", $ATTRIBS1, _ArrayCreate("Install", "255")) _XMLCreateChildWAttr("/menu/folder[@name='Spyware']", "folder", $ATTRIBS1, _ArrayCreate("Run", "255")) ;Grandchild items $R1 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[@name='Install']", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Install", "WINFILES\Spyware\spywareinstall.exe", "255")) $R2 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[@name='Run']", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Run", "WINFILES\Spyware\spywarerun.exe", "255")) ;These should work as well but doesn't ;$R1 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[0]", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Install", "WINFILES\Spyware\spywareinstall.exe", "255")) ;$R2 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[1]", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Run", "WINFILES\Spyware\spywarerun.exe", "255")) ;Child items _XMLCreateChildWAttr("/menu/folder[@name='Antivirus']", "item", $ATTRIBS2, _ArrayCreate("Norton Antivirus", "WINFILES\Antivirus\Norton\NAV.exe", "112")) _XMLCreateChildWAttr("/menu/folder[@name='Antivirus']", "item", $ATTRIBS2, _ArrayCreate("AVG", "WINFILES\Antivirus\AVG\avg.exe", "112")) MsgBox(0,"", $R1 & @CRLF & $R2) EDIT: To accomplish this with XMLStarlet I had to use this command xml ed -s "/menu/folder[@name='Spyware']/folder[@name='Install']" -t elem -n "item" -v "12345" archrival.xml Where -s is used for subnode instead of -i for insert. Edited June 8, 2007 by weaponx Link to comment Share on other sites More sharing options...
eltorro Posted June 8, 2007 Author Share Posted June 8, 2007 (edited) First off I really like this UDF, so far it is working well. However I am getting an error attempting to create grandchild nodes. ACTUAL OUTPUT: <menu> <folder name="Antivirus" oscode="255"> <item xmlns="0" name="Norton Antivirus" target="WINFILES\Antivirus\Norton\NAV.exe" oscode="112" /> <item xmlns="0" name="AVG" target="WINFILES\Antivirus\AVG\avg.exe" oscode="112" /> </folder> <folder name="Spyware" oscode="255"> <folder xmlns="0" name="Install" oscode="255" /> <folder xmlns="0" name="Run" oscode="255" /> </folder> </menu> EXPECTED OUTPUT: <menu> <folder name="Antivirus" oscode="255"> <item xmlns="0" name="Norton Antivirus" target="WINFILES\Antivirus\Norton\NAV.exe" oscode="112" /> <item xmlns="0" name="AVG" target="WINFILES\Antivirus\AVG\avg.exe" oscode="112" /> </folder> <folder name="Spyware" oscode="255"> <folder xmlns="0" name="Install" oscode="255"> <item name="Spyware Auto Install" target="WINFILES\Spyware\spywareinstall.exe" oscode="" /> </folder> <folder xmlns="0" name="Run" oscode="255"> <item name="Spyware Auto Install" target="WINFILES\Spyware\spywarerun.exe" oscode="" /> </folder> </folder> </menu> #include "_XMLDomWrapper.au3" #include <Array.au3> Local $sFile = "archrival.xml" FileDelete ( $sFile ) _XMLCreateFile ($sFile, "menu", True) _XMLFileOpen ($sFile) $ATTRIBS1 = _ArrayCreate("name", "oscode") $ATTRIBS2 = _ArrayCreate("name", "target", "oscode") ;Root folders _XMLCreateRootNodeWAttr("folder", $ATTRIBS1, _ArrayCreate("Antivirus", "255")) _XMLCreateRootNodeWAttr("folder", $ATTRIBS1, _ArrayCreate("Spyware", "255")) ;Child folders _XMLCreateChildWAttr("/menu/folder[@name='Spyware']", "folder", $ATTRIBS1, _ArrayCreate("Install", "255")) _XMLCreateChildWAttr("/menu/folder[@name='Spyware']", "folder", $ATTRIBS1, _ArrayCreate("Run", "255")) ;Grandchild items $R1 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[@name='Install']", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Install", "WINFILES\Spyware\spywareinstall.exe", "255")) $R2 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[@name='Run']", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Run", "WINFILES\Spyware\spywarerun.exe", "255")) ;These should work as well but doesn't ;$R1 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[0]", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Install", "WINFILES\Spyware\spywareinstall.exe", "255")) ;$R2 = _XMLCreateChildWAttr("/menu/folder[@name='Spyware']/folder[1]", "item", $ATTRIBS2, _ArrayCreate("Spyware Auto Run", "WINFILES\Spyware\spywarerun.exe", "255")) ;Child items _XMLCreateChildWAttr("/menu/folder[@name='Antivirus']", "item", $ATTRIBS2, _ArrayCreate("Norton Antivirus", "WINFILES\Antivirus\Norton\NAV.exe", "112")) _XMLCreateChildWAttr("/menu/folder[@name='Antivirus']", "item", $ATTRIBS2, _ArrayCreate("AVG", "WINFILES\Antivirus\AVG\avg.exe", "112")) MsgBox(0,"", $R1 & @CRLF & $R2) EDIT: To accomplish this with XMLStarlet I had to use this command xml ed -s "/menu/folder[@name='Spyware']/folder[@name='Install']" -t elem -n "item" -v "12345" archrival.xml Where -s is used for subnode instead of -i for insert. Thanks for the reply, I glad you like the UDF. I apologize for not replying sooner. I got figure out why I don't get subscription notification on the thread. I tracked your problem down to a namespace issue that was probably introduce with the last fix. It should work now. This will be the output: <?xml version="1.0"?> <menu> <folder name="Antivirus" oscode="255"> <item name="Norton Antivirus" target="WINFILES\Antivirus\Norton\NAV.exe" oscode="112"/> <item name="AVG" target="WINFILES\Antivirus\AVG\avg.exe" oscode="112"/> </folder> <folder name="Spyware" oscode="255"> <folder name="Install" oscode="255"> <item name="Spyware Auto Install" target="WINFILES\Spyware\spywareinstall.exe" oscode="255"/> </folder> <folder name="Run" oscode="255"> <item name="Spyware Auto Run" target="WINFILES\Spyware\spywarerun.exe" oscode="255"/> </folder> </folder> </menu> Notice that 'xmlns="0"' is not in the above output. That was being added because of the bug and causing your node creation to fail. Edit: typo. Edited June 9, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
weaponx Posted June 9, 2007 Share Posted June 9, 2007 That worked, I hope it was as simple as that. If I experience any other trouble I will let you know. Link to comment Share on other sites More sharing options...
linus Posted June 11, 2007 Share Posted June 11, 2007 Hello - first a big "thank you" for this UDF - I just started with it, but it seems to be VERY useful (BTW: why isn't it part of the 'legal' AU3-release??) Second: I am writing this not just to say how I like the UDF - of course I have a problem ... I have to change some settings in .xml files like this: <!DOCTYPE preferences> <preferences application="XML" version="0.9" > <group name="Environments" > <option key="ARCH_BUILD" type="2" value="$KU_SRC/buildings/" /> <option key="BE_PARA" type="2" value="$KU_SRC/para/" /> .... (much more lines of 'options') ... </group> </preferences> With $var = _XMLGetAttrib("preferences/group[starts-with(@name,'Environments')]/option[starts-with(@key,'ARCH_BUILD')]", "value") I can get attribute texts, but ONLY after kicking the 'DOCTYPE'-line, otherwise _XMLGetAttrib returns an error. As I know, the syntax of the doctype-line is wrong, but it is (and will be) part of the files. Is it possible to get it working WITH this line? Regards and thanks, Linus Link to comment Share on other sites More sharing options...
eltorro Posted June 11, 2007 Author Share Posted June 11, 2007 I can get attribute texts, but ONLY after kicking the 'DOCTYPE'-line, otherwise _XMLGetAttrib returns an error. As I know, the syntax of the doctype-line is wrong, but it is (and will be) part of the files. Is it possible to get it working WITH this line? Regards and thanks, Linus Hi, and Thanks for the interest! After some digging, it seems that the simple solution is to add the following to _XMLFileOpen() before $objDoc.Load($strFile) $objDoc.validateOnParse = false oÝ÷ Ù8b³ +Ì"¶¡Ë¦z{Hµë-yØ^â&k)æ©àzÚ-çîËb¢x^i׫jwZuÖ§¢Ø^®mÚö«¦åzÚ"µ«¢+Ø)Õ¹}a51¥±=Á¸ ÀÌØíÍÑÉa51¥±°ÀÌØíÍÑÉ9µMÁôÅÕ½ÐìÅÕ½Ðì°ÀÌØíÙÈô´Ä°ÀÌØíY±=¹AÉÍôÑÉÕ¤(¸¸¸(ÀÌØí½©½¹Ù±¥Ñ=¹AÉÍôÀÌØíY±=¹AÉÍ(ÀÌØí½©½¹1½ ÀÌØíÍÑÉ¥±¤(¸¸¸¸ Another possible solution is to create a dummy preferences.dtd if the original can't be found. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code 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