motionman95 Posted January 3, 2010 Share Posted January 3, 2010 Quick question: this works with the latest version of Autoit, correct? Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 4, 2010 Share Posted January 4, 2010 Thanks, I'll check that out.As for it being non XML your right i guess. The files i want to take data out of are incomplete XML files. the file i want to add them too is the rest of the xml file.The idea here is when new reports are added to the directory my autoit.exe would add those parts to the xml file, effectively adding new content to the gallery. This would allow me to create a sort of drag and drop process. So i guess i'm looking for a way to do this with txt files?Happy New Year!!!!!!The reading of the incomplete file is plain text manipulation. Adding the results to the completed XML can be done most easily with the _XMLDOMWrapper.au3 UDF. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 4, 2010 Share Posted January 4, 2010 Quick question: this works with the latest version of Autoit, correct?So, what happened when you tried it? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ghetek Posted January 16, 2010 Share Posted January 16, 2010 this link isnt working for me. do you have the example up anywhere else? Link to comment Share on other sites More sharing options...
gregnottage Posted January 18, 2010 Share Posted January 18, 2010 Hi guys, I'm an AutoIT-XML newbie who has been trying very hard to use the _XMLDomWrapper UDF to manipulate an XML file that I have here. However, so far I haven't been able to make it work correctly. Here's a copy of the XML file I am working with: expandcollapse popup<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="els.xslt"?> <els> <Code id="101"> <Name>101</Name> <APPLET> <Name>P2S</Name> <Desc>System Soft</Desc> <install>-1</install> </APPLET> <APPLET> <Name>PSET</Name> <Desc>Int Client</Desc> <install>-1</install> </APPLET> </Code> <Code id="1101"> <Name>1101</Name> <APPLET> <Name>P2S</Name> <Desc>System Soft</Desc> <install>-1</install> </APPLET> <APPLET> <Name>PSET</Name> <Desc>Int Client</Desc> <install>-1</install> </APPLET> </Code> <Code id="1203"> <Name>1203</Name> <APPLET> <Name>P2S</Name> <Desc>System Soft</Desc> <install>-1</install> </APPLET> <APPLET> <Name>PSET</Name> <Desc>Int Client</Desc> <install>-1</install> </APPLET> </Code> </els> I'm trying to find all instances of PSET and then change the <install>-1</install> to <install>0</install> I've pieced together the following code, but it's not working: $strSysDrv = EnvGet("SYSTEMDRIVE"); Find correct drive letter $strMyXML = $strSysDrv & "\D\Bfg\my.xml" dim $aAttName[1],$aAttVal[1], $node $strXMLFile = _XMLFileOpen($strMyXML) $node = _XMLGetAllAttrib('//APPLET/*[Name="PSET"]',$aAttName,$aAttVal) If IsArray($aAttName) Then _ArrayDisplay($aAttName,"Names"); show the names _ArrayDisplay($aAttVal,"Values"); show the values EndIf Please could someone advise me on what I need to change in the code to make it do what I need? Many thanks, Greg. Link to comment Share on other sites More sharing options...
Zazza Posted January 19, 2010 Share Posted January 19, 2010 Greetings,I'm trying to use this wrapper while passing one variable from ActionScript to AutoIt.In AutoIt if I "trace" the XML coming from ActionScript (ExternalInterface.Call), I can see:<invoke name ="switch" returntype="xml"><arguments><string>test</string></arguments></invoke>and this is RIGHT.But if I use _XMLGetValue() to get the string "test" I come up with an empty string:$param = _XMLGetValue("/invoke/arguments/string")_XMLGetValue should return an array but not in this case.What am I doing wrong? Thanks... Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 21, 2010 Share Posted January 21, 2010 Hi guys, I'm an AutoIT-XML newbie who has been trying very hard to use the _XMLDomWrapper UDF to manipulate an XML file that I have here. However, so far I haven't been able to make it work correctly. Here's a copy of the XML file I am working with: expandcollapse popup<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="els.xslt"?> <els> <Code id="101"> <Name>101</Name> <APPLET> <Name>P2S</Name> <Desc>System Soft</Desc> <install>-1</install> </APPLET> <APPLET> <Name>PSET</Name> <Desc>Int Client</Desc> <install>-1</install> </APPLET> </Code> <Code id="1101"> <Name>1101</Name> <APPLET> <Name>P2S</Name> <Desc>System Soft</Desc> <install>-1</install> </APPLET> <APPLET> <Name>PSET</Name> <Desc>Int Client</Desc> <install>-1</install> </APPLET> </Code> <Code id="1203"> <Name>1203</Name> <APPLET> <Name>P2S</Name> <Desc>System Soft</Desc> <install>-1</install> </APPLET> <APPLET> <Name>PSET</Name> <Desc>Int Client</Desc> <install>-1</install> </APPLET> </Code> </els> I'm trying to find all instances of PSET and then change the <install>-1</install> to <install>0</install> I've pieced together the following code, but it's not working: $strSysDrv = EnvGet("SYSTEMDRIVE"); Find correct drive letter $strMyXML = $strSysDrv & "\D\Bfg\my.xml" dim $aAttName[1],$aAttVal[1], $node $strXMLFile = _XMLFileOpen($strMyXML) $node = _XMLGetAllAttrib('//APPLET/*[Name="PSET"]',$aAttName,$aAttVal) If IsArray($aAttName) Then _ArrayDisplay($aAttName,"Names"); show the names _ArrayDisplay($aAttVal,"Values"); show the values EndIf Please could someone advise me on what I need to change in the code to make it do what I need? Many thanks, Greg. You need to walk through the heirarchy to find APPLET elements where Name='PSET'. The _XMLDOMWrapper UDF does not make this easy, because it doesn't expose the objects being used (as, for example IE.au3 exposes IE DOM collections). Using just the functions available, this should work: expandcollapse popup#include <_XMLDOMWrapper.au3> Global $sMyXML, $iRET, $iCodeCnt, $sID, $iAppCnt, $aName, $aInstall ; Load XML $sMyXML = @ScriptDir & "\Test_1.xml" $iRET = _XMLFileOpen($sMyXML) If @error Or $iRET <> 1 Then ConsoleWrite("Error: Failed to load XML document: " & $sMyXML & @LF) Exit EndIf ; Walk the 'Code' elements $iCodeCnt = _XMLGetNodeCount("/els/Code[*]") ConsoleWrite("$iCodeCnt = " & $iCodeCnt & @LF) For $a = 1 To $iCodeCnt $sID = _XMLGetAttrib("/els/Code[" & $a & "]", "id") ConsoleWrite("$sID = " & $sID & @LF) ; For each Code element, walk the 'APPLET' elements $iAppCnt = _XMLGetNodeCount("/els/Code[" & $a & "]/APPLET[*]") ConsoleWrite("$iAppCnt = " & $iAppCnt & @LF) For $b = 1 To $iAppCnt ; Check 'Name' for 'PSET' $aName = _XMLGetValue("/els/Code[" & $a & "]/APPLET[" & $b & "]/Name") If IsArray($aName) And $aName[0] = 1 Then ConsoleWrite("Name = " & $aName[1] & @LF) If $aName[1] = "PSET" Then ; Check 'install' $aInstall = _XMLGetValue("/els/Code[" & $a & "]/APPLET[" & $b & "]/install") If IsArray($aInstall) And $aInstall[0] = 1 Then ConsoleWrite("install = " & $aInstall[1] & @LF) If $aInstall[1] = "-1" Then _XMLUpdateField("/els/Code[" & $a & "]/APPLET[" & $b & "]/install", 0) ConsoleWrite("Changed install = 0" & @LF) EndIf EndIf EndIf EndIf Next Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 21, 2010 Share Posted January 21, 2010 (edited) Greetings, I'm trying to use this wrapper while passing one variable from ActionScript to AutoIt. In AutoIt if I "trace" the XML coming from ActionScript (ExternalInterface.Call), I can see: <invoke name ="switch" returntype="xml"><arguments><string>test</string></arguments></invoke> and this is RIGHT. But if I use _XMLGetValue() to get the string "test" I come up with an empty string: $param = _XMLGetValue("/invoke/arguments/string") _XMLGetValue should return an array but not in this case. What am I doing wrong? Thanks... The return from _XMLGetValue() is an array if successful, so somehow it didn't succeed. This works: #include <Array.au3> #include <_XMLDOMWrapper.au3> $sInput = '<invoke name ="switch" returntype="xml"><arguments><string>test</string></arguments></invoke>' $iRET = _XMLLoadXML($sInput) ConsoleWrite("$iRET = " & $iRET & "; @error = " & @error & "; @extended = " & @extended & @LF) $aValues = _XMLGetValue("/invoke/arguments/string") ConsoleWrite("$aValues = " & $aValues & "; @error = " & @error & "; @extended = " & @extended & @LF) If IsArray($aValues) Then _ArrayDisplay($aValues, "$aValues") Edited January 21, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
weaponx Posted January 21, 2010 Share Posted January 21, 2010 You need to walk through the heirarchy to find APPLET elements where Name='PSET'. The _XMLDOMWrapper UDF does not make this easy, because it doesn't expose the objects being used (as, for example IE.au3 exposes IE DOM collections). Using just the functions available, this should work: expandcollapse popup#include <_XMLDOMWrapper.au3> Global $sMyXML, $iRET, $iCodeCnt, $sID, $iAppCnt, $aName, $aInstall ; Load XML $sMyXML = @ScriptDir & "\Test_1.xml" $iRET = _XMLFileOpen($sMyXML) If @error Or $iRET <> 1 Then ConsoleWrite("Error: Failed to load XML document: " & $sMyXML & @LF) Exit EndIf ; Walk the 'Code' elements $iCodeCnt = _XMLGetNodeCount("/els/Code[*]") ConsoleWrite("$iCodeCnt = " & $iCodeCnt & @LF) For $a = 1 To $iCodeCnt $sID = _XMLGetAttrib("/els/Code[" & $a & "]", "id") ConsoleWrite("$sID = " & $sID & @LF) ; For each Code element, walk the 'APPLET' elements $iAppCnt = _XMLGetNodeCount("/els/Code[" & $a & "]/APPLET[*]") ConsoleWrite("$iAppCnt = " & $iAppCnt & @LF) For $b = 1 To $iAppCnt ; Check 'Name' for 'PSET' $aName = _XMLGetValue("/els/Code[" & $a & "]/APPLET[" & $b & "]/Name") If IsArray($aName) And $aName[0] = 1 Then ConsoleWrite("Name = " & $aName[1] & @LF) If $aName[1] = "PSET" Then ; Check 'install' $aInstall = _XMLGetValue("/els/Code[" & $a & "]/APPLET[" & $b & "]/install") If IsArray($aInstall) And $aInstall[0] = 1 Then ConsoleWrite("install = " & $aInstall[1] & @LF) If $aInstall[1] = "-1" Then _XMLUpdateField("/els/Code[" & $a & "]/APPLET[" & $b & "]/install", 0) ConsoleWrite("Changed install = 0" & @LF) EndIf EndIf EndIf EndIf Next Next This can technically be done in one line with _XMLUpdateField, but the udf limits it to writing to only a single node at one time. With some manipulation you can update ALL matching nodes at once. expandcollapse popup#include "..\_XMLDomWrapper2.au3" $sXMLFile = "applet.xml" $result = _XMLFileOpen($sXMLFile) if $result = 0 then Exit ;Retrieve original values $sXPath = '//Code/APPLET[Name="PSET"]/install' $aNodes = _XMLGetValue($sXPath) If @Error Then MsgBox(0,"","Name not found") For $X = 0 to Ubound($aNodes)-1 ConsoleWrite("[" & $X & "]: " & $aNodes[$X] & @CRLF) Next ;Update node values _XMLUpdateField2($sXPath,"0") ;Retrieve new values $aNodes = _XMLGetValue($sXPath) If @Error Then MsgBox(0,"","Name not found") For $X = 0 to Ubound($aNodes)-1 ConsoleWrite("[" & $X & "]: " & $aNodes[$X] & @CRLF) Next Func _XMLUpdateField2($strXPath, $strData) If Not IsObj($objDoc) Then _XMLError("No object passed to function _XMLUpdateField") Return SetError(1, 9, -1) EndIf Local $objNodeList, $objNodeChild, $xmlerr $objNodeList = $objDoc.documentElement.selectNodes($strXPath) If $objNodeList.length > 0 Then _DebugWrite("GetValue list length:" & $objNodeList.length) For $objNode In $objNodeList If $objNode.hasChildNodes() = False Then ;??? Else For $objNodeChild In $objNode.childNodes() If $objNodeChild.nodetype = $NODE_TEXT Then $objNodeChild.Text = $strData $bUpdate = True ExitLoop EndIf Next EndIf Next Return 1 Else $xmlerr = @CRLF & "No matching node(s)found!" Return SetError(1, 0, -1) EndIf _XMLError("Error Retrieving: " & $strXPath & $xmlerr) Return SetError(1, 0, -1) EndFunc ;==>_XMLUpdateField Link to comment Share on other sites More sharing options...
Zazza Posted January 21, 2010 Share Posted January 21, 2010 The return from _XMLGetValue() is an array if successful, so somehow it didn't succeed. This works: #include <Array.au3> #include <_XMLDOMWrapper.au3> $sInput = '<invoke name ="switch" returntype="xml"><arguments><string>test</string></arguments></invoke>' $iRET = _XMLLoadXML($sInput) ConsoleWrite("$iRET = " & $iRET & "; @error = " & @error & "; @extended = " & @extended & @LF) $aValues = _XMLGetValue("/invoke/arguments/string") ConsoleWrite("$aValues = " & $aValues & "; @error = " & @error & "; @extended = " & @extended & @LF) If IsArray($aValues) Then _ArrayDisplay($aValues, "$aValues") Thanks Psalty... To be honest I should edit my previous post since I finally understood where was the problem: I was calling the wrong index in my array. Thank you very much for your support. Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 21, 2010 Share Posted January 21, 2010 This can technically be done in one line with _XMLUpdateField, but the udf limits it to writing to only a single node at one time. With some manipulation you can update ALL matching nodes at once.Yeah, I saw that, but tried to post a solution using only the UDF's functions. If I were coding it myself, I would select the node to a collection and do 'em similar to what you had. I'm really getting to the point of trying to rewrite the XML UDF to expose the COM objects to the user some, ala Dale's IE.au3. Haven't heard from eltorro in ages, so I guess it's just a matter of barging in on my spare time. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted January 21, 2010 Share Posted January 21, 2010 (edited) I have been toying with the same idea, Psalty. My needs for it were more for multiple document handling, than for enhanced controls (other than a few changes to let me add CDATA sections where ever I wanted). I have a basic version of what I was doing on my laptop, but from the sounds of it, your version wouldn't need anything from this version, it would need all new functions. Edit: Almost forgot, another thing that made me want to redo most of it: the non-standard way you specify the XPath strings. Some functions require the root name at the front, others don't. I'm all for an XML UDF to allow for accessing those files, but a better way of getting at the files (more standard across the board) would be much appreciated. Edited January 21, 2010 by SkinnyWhiteGuy Link to comment Share on other sites More sharing options...
gregnottage Posted January 22, 2010 Share Posted January 22, 2010 Hi guys, Thanks so much for your help in getting me some working code. Psalty's code worked first time, out of the box - but I needed to make a slight amendment to Weaponx's code (not very often I have to say that I must admit). Weaponx's code showed all the amendments to the fields in the Console, but it wasn't saving those amendments back to my XML file. So I added this line in near the end of your _XMLUpdateField2 function "If ($bXMLAUTOSAVE = True) Then $objDoc.save ($strFile)" and that works like a charm: expandcollapse popup;#include "..\_XMLDomWrapper2.au3" #include "..\_XMLDomWrapper.au3" $sXMLFile = "applet.xml" $result = _XMLFileOpen($sXMLFile) if $result = 0 then Exit ;Retrieve original values $sXPath = '//Code/APPLET[Name="PSET"]/install' $aNodes = _XMLGetValue($sXPath) If @Error Then MsgBox(0,"","Name not found") For $X = 0 to Ubound($aNodes)-1 ConsoleWrite("[" & $X & "]: " & $aNodes[$X] & @CRLF) Next ;Update node values _XMLUpdateField2($sXPath,"0") ;Retrieve new values $aNodes = _XMLGetValue($sXPath) If @Error Then MsgBox(0,"","Name not found") For $X = 0 to Ubound($aNodes)-1 ConsoleWrite("[" & $X & "]: " & $aNodes[$X] & @CRLF) Next Func _XMLUpdateField2($strXPath, $strData) If Not IsObj($objDoc) Then _XMLError("No object passed to function _XMLUpdateField") Return SetError(1, 9, -1) EndIf Local $objNodeList, $objNodeChild, $xmlerr $objNodeList = $objDoc.documentElement.selectNodes($strXPath) If $objNodeList.length > 0 Then _DebugWrite("GetValue list length:" & $objNodeList.length) For $objNode In $objNodeList If $objNode.hasChildNodes() = False Then ;??? Else For $objNodeChild In $objNode.childNodes() If $objNodeChild.nodetype = $NODE_TEXT Then $objNodeChild.Text = $strData $bUpdate = True ExitLoop EndIf Next EndIf Next If ($bXMLAUTOSAVE = True) Then $objDoc.save ($strFile) Return 1 Else $xmlerr = @CRLF & "No matching node(s)found!" Return SetError(1, 0, -1) EndIf _XMLError("Error Retrieving: " & $strXPath & $xmlerr) Return SetError(1, 0, -1) EndFunc ;==>_XMLUpdateField Also, I noticed at the top of your code that you refer to this UDF "_XMLDomWrapper2.au3" - do you guys have a version2 of this UDF? I did search the forums (and Google) but I couldn't find a v2 one? Don't know if this was a typo, I just amended it to remove the 2 on my one here and it worked fine?? Anyway, thanks so much for sharing your guru knowledge as always. Don't know where I'd be without access to a resource as great as this - I've said it before, but I'll say it again: you guys rock, no bull!!! Thanks, thanks, thanks!!!! Greg. Link to comment Share on other sites More sharing options...
weaponx Posted January 22, 2010 Share Posted January 22, 2010 No there is no version 2, I just use the older revision sometimes so I called the latest one 2. Link to comment Share on other sites More sharing options...
lgr Posted February 11, 2010 Share Posted February 11, 2010 Hi,I'm looking a way for using multiple documents with the wrapper.I saw a post in 2006 which tells about a hack in the wrapper to use an index on objdoc, but nothing is implemented in the up to date wrapper downloable in google.Here is the post :http://www.autoitscript.com/forum/index.php?showtopic=19848&st=40&p=155911&hl=xml%20wrapper%20multiple&fromsearch=1&#entry155911Ok, i found the solution, so i post it here.The XML Dom wrapper has been updated to a new UDF library called _MSXML.au3.It is located on the google source page found on the first post of this topic.You can manipulate multiple docs at once with this one.Hope it helps .Laurent. Link to comment Share on other sites More sharing options...
tupy8080 Posted March 9, 2010 Share Posted March 9, 2010 (edited) Try the following:expandcollapse popup#include "C:\Program Files\AutoIt3\include\_XMLDomWrapper.au3" _SetDebug (True);show debug messages via console write ;$sXmlFile = "C:\Program Files\AutoIt3\scripts\test.XML" $sXmlFile = FileOpenDialog("", @ProgramFilesDir & "\autoit\scrpits", "XML (*.xml)", 1) ;ConsoleWrite($sXmlFile&@lf) If @error Then MsgBox(4096, "File Open", "No file chosen") Exit Else $oOXml = "" $oOXml = _XMLFileOpen ($sXmlFile) EndIf Dim $aAttrName[1], $aAttrValue[1], $node $test = int(InputBox("Test","Enter test# to retrieve:")) if IsInt($test) Then ; get all attribs where tests = ???? $retval = _XMLGetAllAttrib("//testing/testsuite[@tests="&$test&"]",$aAttrName,$aAttrValue); get all attribs where tests = 5 if IsArray($aAttrName) Then _ArrayDisplay($aAttrName,"Attrib Names") _ArrayDisplay($aAttrValue,"Attrib Values") Else msgbox(0,"Error","Test "&$test&" not found.") Exit EndIf Dim $aAttrName[1], $aAttrValue[1] ;get all attribs where tests = ??? and classname attrib name = "testGetSessionParmLong" $retval = _XMLGetAllAttrib('//testing/testsuite[@tests='&$test&']/testcase[@name="testGetSessionParmLong"]',$aAttrName,$aAttrValue) if IsArray($aAttrName) Then _ArrayDisplay($aAttrName,"Attrib Names") _ArrayDisplay($aAttrValue,"Attrib Values") Else msgbox(0,"Error","Test "&$test&" not found.") Exit EndIf EndIf Exit #cs <?xml version="1.0" encoding="UTF-8"?> <testing> <testsuite errors="0" failures="0" name="test.com.test.1" tests="5" time="0.274"> <testcase classname="test.com.test.1" name="testGetSessionParmLong" time="0.0050" /> <testcase classname="test.com.test.1" name="testGetSessionParmString" time="0.0" /> <testcase classname="test.com.test.1" name="testChecked" time="0.0" /> <testcase classname="test.com.test.1" name="testParseBoolean" time="0.0" /> <testcase classname="test.com.test.1" name="testGetInitParam" time="0.0" /> <system-out /> <system-err /> </testsuite> <testsuite errors="0" failures="0" name="test.com.test.2" tests="3" time="0.274"> <testcase classname="test.com.test.2" name="testGetSessionParmLong" time="0.0050" /> <testcase classname="test.com.test.2" name="testGetSessionParmString" time="0.0" /> <testcase classname="test.com.test.2" name="testChecked" time="0.0" /> <system-out /> <system-err /> </testsuite> </testing> #ce Steve. Please help, I am trying to parse the an xml file. All I want to do is the get the value of PH03 and PH04. I have downloaded examples on this forum but could not get it to work correctly. Below is the xml file. <?xml version="1.0" ?> - <ROOT> - <REPAIRDATA TIMESTAMP="05.03.2010 12:05:05"> - <SERVICEVENDOR> <SV01>United States</SV01> <SV02>481024</SV02> <SV03 /> </SERVICEVENDOR> - <PHONE> <PH01>351975030339798</PH01> <PH02>RJN544446</PH02> <PH03>Nokia 6350</PH03> <PH04>RM-455</PH04> <PH05>0571152</PH05> <PH07>V 4.96</PH07> <PH09>1000</PH09> </PHONE> </REPAIRDATA> - <REPAIRDATA TIMESTAMP="05.03.2010 12:12:35"> - <SERVICEVENDOR> <SV01>United States</SV01> <SV02>481024</SV02> <SV03 /> </SERVICEVENDOR> - <PHONE> <PH01>351975030339798</PH01> <PH02>RJN544446</PH02> <PH03>Nokia 6350</PH03> <PH04>RM-455</PH04> <PH05>0571152</PH05> <PH07>V 4.96</PH07> <PH09>1000</PH09> </PHONE> </REPAIRDATA> </ROOT> Edited March 9, 2010 by tupy8080 Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 9, 2010 Share Posted March 9, 2010 Please help, I am trying to parse the an xml file. All I want to do is the get the value of PH03 and PH04. I have downloaded examples on this forum but could not get it to work correctly. Below is the xml file. This works: #include <_XMLDOMWrapper.au3> $sXML = @ScriptDir & "\Test1.xml" _XMLFileOpen($sXML) $iRepairs = _XMLGetNodeCount("/ROOT/REPAIRDATA") ConsoleWrite("$iRepairs = " & $iRepairs & @LF) For $n = 1 To $iRepairs $sTimeStamp = _XMLGetAttrib("/ROOT/REPAIRDATA[" & $n & "]", "TIMESTAMP") $aPH03 = _XMLGetValue("/ROOT/REPAIRDATA[" & $n & "]/PHONE/PH03") $aPH04 = _XMLGetValue("/ROOT/REPAIRDATA[" & $n & "]/PHONE/PH04") ConsoleWrite("Repair data timestamp = " & $sTimeStamp & "; PH03 = " & $aPH03[1] & "; PH04 = " & $aPH04[1] & @LF) Next Note that _XMLGetValue() returns an array with count in [0]. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
GregThompson Posted March 12, 2010 Share Posted March 12, 2010 I just used this example, and it doesn't work... am I missing something on my machine? I have the wrapper, latest version of AutoIT, his example, I tried other .XML files... always returns a -1??? Link to comment Share on other sites More sharing options...
GregThompson Posted March 12, 2010 Share Posted March 12, 2010 Got it.. his example has - before some things and that seems to break it. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 14, 2010 Share Posted March 14, 2010 Got it.. his example has - before some things and that seems to break it.Yeah, I copy/pasted that data into a test1.xml file, and sort of automatically cleaned that stuff up and "prettified" it. Should have pointed it out. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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