eben80 Posted March 15, 2010 Share Posted March 15, 2010 Hi all, I have searched high and low on the forum but I have not been able to fix the problem I have with reading a value from an xml file. I think it is because I don't know how the whole namespace setup works. The xml file: expandcollapse popup<?xml version="1.0" standalone="yes"?> <AppConfig xmlns="http://tempuri.org/AppConfig.xsd"> <AppDetails> <AppName>W:\Projects\Avaya-Softconsole_5.05.5_B2.0\Avaya-Softconsole_5.05.5_B2.0</AppName> <MSIName><msi_name></MSIName> <AppGroup>d-APP-AVAYA-SOFTCONSOLE</AppGroup> </AppDetails> <ACLSettings> <ObjectId>1</ObjectId> <ObjectType>Registry Keys</ObjectType> <ObjectPath>CLASSES_ROOT\Interface\{6BDF9F08-BCA8-11D1-A46D-444553540000}</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>1</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>1</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>1</ObjectId> <Type>A</Type> <Flag>CIIO</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>1</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>CCDCLCSWRPRC</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>1</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>1</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> <ACLSettings> <ObjectId>2</ObjectId> <ObjectType>Registry Keys</ObjectType> <ObjectPath>CLASSES_ROOT\Interface\{6BDF9F07-BCA8-11D1-A46D-444553540000}</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>2</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>2</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>2</ObjectId> <Type>A</Type> <Flag>CIIO</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>2</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>CCDCLCSWRPRC</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>2</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>2</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> <ACLSettings> <ObjectId>3</ObjectId> <ObjectType>Registry Keys</ObjectType> <ObjectPath>CLASSES_ROOT\PhlineX.PhoneLineXCtrl.1</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>3</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>3</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>3</ObjectId> <Type>A</Type> <Flag>CIIO</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>3</ObjectId> <Type>A</Type> <Flag /> <Permission>CCDCLC</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>3</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>3</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>3</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> <ACLSettings> <ObjectId>4</ObjectId> <ObjectType>Registry Keys</ObjectType> <ObjectPath>CLASSES_ROOT\TypeLib</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>4</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>4</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>4</ObjectId> <Type>A</Type> <Flag>CIIO</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>4</ObjectId> <Type>A</Type> <Flag /> <Permission>CCDCLC</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>4</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>4</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>4</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> <ACLSettings> <ObjectId>5</ObjectId> <ObjectType>Registry Keys</ObjectType> <ObjectPath>CLASSES_ROOT\CLSID\{6BDF9F09-BCA8-11D1-A46D-444553540000}</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>5</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>5</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>5</ObjectId> <Type>A</Type> <Flag>CIIO</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>5</ObjectId> <Type>A</Type> <Flag /> <Permission>CCDCLC</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>5</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>5</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>5</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> <ACLSettings> <ObjectId>6</ObjectId> <ObjectType>Registry Keys</ObjectType> <ObjectPath>CLASSES_ROOT\CLSID\{6BDF9F0A-BCA8-11D1-A46D-444553540000}</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>6</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>6</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>6</ObjectId> <Type>A</Type> <Flag>CIIO</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>6</ObjectId> <Type>A</Type> <Flag /> <Permission>CCDCLC</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>6</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>6</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>6</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> <ACLSettings> <ObjectId>7</ObjectId> <ObjectType>Registry Keys</ObjectType> <ObjectPath>MACHINE\SOFTWARE\Avaya</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>7</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>7</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>7</ObjectId> <Type>A</Type> <Flag>CIIO</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>7</ObjectId> <Type>A</Type> <Flag /> <Permission>CCDCLC</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>7</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>7</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>7</ObjectId> <Type>A</Type> <Flag>CI</Flag> <Permission>KR</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> <ACLSettings> <ObjectId>8</ObjectId> <ObjectType>File Security</ObjectType> <ObjectPath>%ProgramFiles%\Avaya\Avaya Softconsole</ObjectPath> <PropagateACL>0</PropagateACL> <DescriptorControlFlags> <ObjectId>8</ObjectId> <Protected>true</Protected> <AutoInheritReqd>true</AutoInheritReqd> <AutoInherited>false</AutoInherited> </DescriptorControlFlags> <ACEEntry> <ObjectId>8</ObjectId> <Type>A</Type> <Flag>OICI</Flag> <Permission>FA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BA</Trustee> </ACEEntry> <ACEEntry> <ObjectId>8</ObjectId> <Type>A</Type> <Flag>OICIIO</Flag> <Permission>FA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>CO</Trustee> </ACEEntry> <ACEEntry> <ObjectId>8</ObjectId> <Type>A</Type> <Flag>OICI</Flag> <Permission>0x1201bf</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>d-APP-AVAYA-SOFTCONSOLE</Trustee> </ACEEntry> <ACEEntry> <ObjectId>8</ObjectId> <Type>A</Type> <Flag>OICI</Flag> <Permission>FA</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>SY</Trustee> </ACEEntry> <ACEEntry> <ObjectId>8</ObjectId> <Type>A</Type> <Flag>OICI</Flag> <Permission>0x1200a9</Permission> <ObjectType /> <InheritedObjectType /> <Trustee>BU</Trustee> </ACEEntry> </ACLSettings> </AppConfig> How I am trying to read it....: #include <GuiConstantsEx.au3> #include <adfunctions.au3> #include <Array.au3> #include <_XMLDomWrapper.au3> ; #include <_MSXML.au3> ; $FileList = _FileListToArray("C:\SUPPORT\SecXML\", "*.xml", 1) ; If @error = 1 Then ; MsgBox(0, "", "No Files\Folders Found.") ; Exit ; EndIf Local $sFile = "C:\SUPPORT\SecXML\Avaya-Softconsole_5.05.5_B2.0.xml" $xmlns = 'xmlns="http://tempuri.org/AppConfig.xsd"' If FileExists($sFile) Then $ret = _XMLFileOpen($sFile) if $ret =0 then Exit $desc = _XMLGetValue("/AppConfig/AppDetails/AppGroup") _ArrayDisplay($desc, "$desc as a 2D array") MsgBox(4096, $desc[0], $desc[1]) EndIf I am getting an error when I try to return the value of AppGroup. If I take out the namespace value from the xml then it works but obviously I don't want to do that. Can anyone please show the error of my ways? Link to comment Share on other sites More sharing options...
IONCom Posted April 8, 2010 Share Posted April 8, 2010 How can i get the infos (q3:name, q3:State) from c.xml When i use _XMLGetAllAttrib i get a errorfor more information hava a lock on the picturethank'sWas anyone able to figure out how to parse a Windows GPO XML file for import into a CSV or Excel file? Link to comment Share on other sites More sharing options...
kcartman Posted April 13, 2010 Share Posted April 13, 2010 Hi guys, i'm new in working with autoit. Reading .csv-Files works fine. Now i have the challenge to read a XML-File. So far i have no idea how to do this. Maybe somebody can help me with a Code-Snippet or something. This is the source i need to read. expandcollapse popup<?xml version="1.0" encoding="ISO-8859-1"?> <IMDaten> <Item Name = "Adressen" nTyp = "14"> <Item Name = "_Benutzer" nTyp = "4">#:##</Item> <Item Name = "_ObjId" nTyp = "4">#####:######</Item> <Item Name = "_Zeitstempel" nTyp = "13">07.07.2009 00:04:04,69</Item> <Item Name = "Adresskennung" nTyp = "9">Some Name</Item> <Item Name = "Anrede" nTyp = "9">Herr</Item> <Item Name = "ArtID" nTyp = "9">AdressePerson</Item> <Item Name = "FamStand" nTyp = "0" /> <Item Name = "GebDatum" nTyp = "11">30.11.1939</Item> <Item Name = "Geschlecht" nTyp = "9">männlich</Item> <Item Name = "Kategorien" nTyp = "9">Data1; Data2; Data3; Data4</Item> <Item Name = "KategorienAp" nTyp = "0" /> <Item Name = "MailAp" nTyp = "0" /> <Item Name = "Nachname" nTyp = "9">Last Name</Item> <Item Name = "Strasse" nTyp = "9">Some Street 8</Item> <Item Name = "StrOrt" nTyp = "9">Wallershausen</Item> <Item Name = "StrPLZ" nTyp = "9">12345</Item> <Item Name = "TelefonAp" nTyp = "0" /> <Item Name = "TelefonMobil" nTyp = "0" /> <Item Name = "TelefonPrivat" nTyp = "9">####/####-#</Item> <Item Name = "Titel" nTyp = "9">Dipl.Ing.</Item> <Item Name = "Vorname" nTyp = "9">First Name</Item> <Item Name = "WebAdresse" nTyp = "0" /> </Item> <Item Name = "Adressen" nTyp = "14"> <Item Name = "_Benutzer" nTyp = "4">#:##</Item> <Item Name = "_ObjId" nTyp = "4">#####:#####</Item> <Item Name = "_Zeitstempel" nTyp = "13">07.07.2009 00:04:04,71</Item> <Item Name = "Adresskennung" nTyp = "9">Some Name too</Item> <Item Name = "Anrede" nTyp = "9">Frau</Item> <Item Name = "ArtID" nTyp = "9">AdressePerson</Item> <Item Name = "FamStand" nTyp = "0" /> <Item Name = "GebDatum" nTyp = "0" /> <Item Name = "Geschlecht" nTyp = "0" /> <Item Name = "Kategorien" nTyp = "9">Data1; Data2; Data3; Data4</Item> <Item Name = "KategorienAp" nTyp = "0" /> <Item Name = "MailAp" nTyp = "0" /> <Item Name = "Nachname" nTyp = "9">Last Name too</Item> <Item Name = "Strasse" nTyp = "9">Some Road 17</Item> <Item Name = "StrOrt" nTyp = "9">Somecity</Item> <Item Name = "StrPLZ" nTyp = "9">12345</Item> <Item Name = "TelefonAp" nTyp = "0" /> <Item Name = "TelefonMobil" nTyp = "0" /> <Item Name = "TelefonPrivat" nTyp = "9">####/#####</Item> <Item Name = "Titel" nTyp = "0" /> <Item Name = "Vorname" nTyp = "9">First Name too</Item> <Item Name = "WebAdresse" nTyp = "0" /> </Item> </IMDaten> Thanks in advance, Kai Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 14, 2010 Share Posted April 14, 2010 This forum does not write scripts for you. Have you downloaded AutoIt, the full SciTE4AutoIt3 editor, and the _XMLDOMWrapper.au3 UDF? If so, what did you try? Have you looked at the other examples posted in this topic? 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...
ptrex Posted April 14, 2010 Share Posted April 14, 2010 @kcartman This will get you started. $objDoc = ObjCreate("Msxml2.DOMdocument.3.0") With $objDoc .async = 0 .load("C:\Test.XML") $xmlRoot = .documentElement For $xmlNode In $xmlRoot.childNodes ConsoleWrite($xmlNode.nodeName & @CRLF & $xmlNode.text & @CRLF) ;MsgBox(0,"XML Test",$xmlNode.text & @Lf) Next EndWith rgds ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
kcartman Posted April 15, 2010 Share Posted April 15, 2010 @ptrex Thanks for helping with my problem. Link to comment Share on other sites More sharing options...
TheCuz Posted May 19, 2010 Share Posted May 19, 2010 Good work on the XML UDF! The example link from the first post is broken. Can you please fix that? Thanks!! [font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 20, 2010 Share Posted May 20, 2010 Good work on the XML UDF!The example link from the first post is broken. Can you please fix that?Thanks!!If eltorro posts it, that would be cool, but it appears he means the examples in this forum topic to be the examples for the UDF: Various examples can be found in the AutoIt forum under the _XMLDomWrapper topic. 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...
tsvety Posted June 23, 2010 Share Posted June 23, 2010 Hi guys!I'm having troubles with this UDF...Just getting the following error:ERROR: can't open include file <_XMLDomWrapper.au3>#include <_XMLDomWrapper.au3>while trying to run this example:#include <_XMLDomWrapper.au3> #include <File.au3> Global $oXML = ObjCreate("Microsoft.XMLHTTP") $oXML.Open("GET", "http://www.wowarmory.com/character-sheet.xml?r=Anub%27arak&n=Lovepenguin", 0) $oXML.Send Global $sFile = _TempFile(@TempDir, '~', '.xml') FileWrite($sFile, $oXML.responseText) If _XMLFileOpen($sFile) Then Local $sLvl = _XMLGetAttrib('./characterInfo/character', 'level') ConsoleWrite($sLvl & @LF) EndIf FileDelete($sFile) Link to comment Share on other sites More sharing options...
oldfashonedpgmr Posted July 2, 2010 Share Posted July 2, 2010 I'm new to both AutoIt and somewhat new to XML. I've got a client/server type application that talks via sockets using XML, but doesn't require an actual file. (think web services) I can parse the XML using the xmlLoadXml to load the XML from a string, but I also need something like an xmlUNloadXML function to return it back to a string before returning my response. Again, I don't want to have to build an actual xml file, just return a string. Thanks in advance. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 2, 2010 Share Posted July 2, 2010 Hi guys!I'm having troubles with this UDF...Just getting the following error:ERROR: can't open include file <_XMLDomWrapper.au3>#include <_XMLDomWrapper.au3>This UDF is not packaged with AutoIt. You have to download it to your Include directory to use 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...
PsaltyDS Posted July 2, 2010 Share Posted July 2, 2010 I'm new to both AutoIt and somewhat new to XML. I've got a client/server type application that talks via sockets using XML, but doesn't require an actual file. (think web services) I can parse the XML using the xmlLoadXml to load the XML from a string, but I also need something like an xmlUNloadXML function to return it back to a string before returning my response. Again, I don't want to have to build an actual xml file, just return a string. It's just $objDoc.xml: #include <_XMLDOMWrapper.au3> Global $sXML = "<colors><name>Black</name><name>Brown</name><name>Red</name>" & _ "<name>Orange</name><name>Yellow</name><name>Green</name><name>Blue</name>" & _ "<name>Violet</name><name>Gray</name><name>White</name></colors>" Global $iRET, $sOutput $iRET = _XMLLoadXML($sXML) ConsoleWrite("$iRET = " & $iRET & "; @error = " & @error & @LF) $iRET = _XMLGetXML($sOutput) ConsoleWrite("$iRET = " & $iRET & "; @error = " & @error & @LF & @TAB & "$sOutput = " & $sOutput & @LF) Func _XMLGetXML(ByRef $strOut) If Not IsObj($objDoc) Then _XMLError("Error: MSXML not found. This object is required to use this program.") SetError(2) Return -1 EndIf $strOut = $objDoc.Xml Return 1 EndFunc ;==>_XMLGetXML 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...
oldfashonedpgmr Posted July 2, 2010 Share Posted July 2, 2010 It's just $objDoc.xml: #include <_XMLDOMWrapper.au3> Global $sXML = "<colors><name>Black</name><name>Brown</name><name>Red</name>" & _ "<name>Orange</name><name>Yellow</name><name>Green</name><name>Blue</name>" & _ "<name>Violet</name><name>Gray</name><name>White</name></colors>" Global $iRET, $sOutput $iRET = _XMLLoadXML($sXML) ConsoleWrite("$iRET = " & $iRET & "; @error = " & @error & @LF) $iRET = _XMLGetXML($sOutput) ConsoleWrite("$iRET = " & $iRET & "; @error = " & @error & @LF & @TAB & "$sOutput = " & $sOutput & @LF) Func _XMLGetXML(ByRef $strOut) If Not IsObj($objDoc) Then _XMLError("Error: MSXML not found. This object is required to use this program.") SetError(2) Return -1 EndIf $strOut = $objDoc.Xml Return 1 EndFunc ;==>_XMLGetXML Thanks PsaltyDS, I knew it had to be simple, I just couldn't see an example of it. Link to comment Share on other sites More sharing options...
anks Posted July 7, 2010 Share Posted July 7, 2010 Hi All, I am trying to use XML Dom Wrapper Function, and i had written the following snippet code: #include <_XMLDomWrapper.au3> #Include <Array.au3> Dim $aAttr[50], $aVal[50], $node,$node1 $node = "logicalpage" $returnval = _XMLCreateFile("D:\UMS\AUTOMATION\Performance\sample.xml", $node) $node1 = "folders" $ret = _XMLCreateRootChild($node1) MsgBox(0, "Error:", $ret, 2) ;~ $returnchildnode = _XMLCreateChildNode("//logicalpage", "child") In the above code i am able to create the XML Sample with root mode as "Logical Page", but i am not able to use " _XMLCreateRootChild" and also use "_XMLCreateChildNode" functions. Can any body please help me with it. Thanks. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 7, 2010 Share Posted July 7, 2010 You have to do _XMLFileOpen("D:\UMS\AUTOMATION\Performance\sample.xml") after creating the file. If you look at the _XMLCreateFile() function inside the UDF, you see it uses only an LOCAL $objDoc while creating the file, and it is never saved to the GLOBAL $objDOC. Using the same name for both the Global and Local causes a little confusion there. Just understand it creates the xml file on disk but it is not opened. 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...
anks Posted July 8, 2010 Share Posted July 8, 2010 You have to do _XMLFileOpen("D:\UMS\AUTOMATION\Performance\sample.xml") after creating the file. If you look at the _XMLCreateFile() function inside the UDF, you see it uses only an LOCAL $objDoc while creating the file, and it is never saved to the GLOBAL $objDOC. Using the same name for both the Global and Local causes a little confusion there. Just understand it creates the xml file on disk but it is not opened.Hey thanks..... Its works....... Link to comment Share on other sites More sharing options...
MikeRerick Posted July 14, 2010 Share Posted July 14, 2010 Here is a function that I wrote and find useful in my project. I wrote this for use in version 1.0.3.87. Feel free to add it to the file in SVN if you think it will be useful to others. expandcollapse popup;=============================================================================== ; Function Name: _XMLGetParent ; Description: Gets the parent node name of the node pointed to by the XPath ; Parameter(s): $strXPath ; Requirement(s): ; Return Value(s): parent node name ; User CallTip: ; Author(s): Mike Rerick <mrerick@iwsinc.com> ; Note(s): Returns empty string if the XPath is not valid ;=============================================================================== Func _XMLGetParent($strXPath) Local $objNodeList, $arrResponse[1], $objNodeChild, $xmlerr, $nodepath, $ns Local $parentName = "" If not IsObj($objDoc) then _XMLError("No object passed to function _XMLGetParent") Return SetError(1,24,-1) EndIf If $DOMVERSION < 4 Then _XMLError("Error DOM Version: " & "MSXML Version 4 or greater required for this function") Return SetError(1,0,-1) EndIf $objNodeList = $objDoc.selectNodes ($strXPath) If $objNodeList.length > 0 Then _DebugWrite("GetPath list length:" & $objNodeList.length) For $objNode In $objNodeList Local $objNode1 = $objNode $nodepath = "" $nodepathtag = "" If $objNode.nodeType <> $NODE_DOCUMENT Then $ns = $objNode.namespaceURI () If $ns <> "" Then $ns = StringRight($ns, StringLen($ns) - StringInStr($ns, "/", 0, -1)) & ":" EndIf if $ns =0 then $ns ="" $nodepath = "/" & $ns & $objNode.nodeName () & $nodepath EndIf $objParent = $objNode1.parentNode () _DebugWrite("parent " & $objParent.nodeName () & @LF) If $objParent.nodeType <> $NODE_DOCUMENT Then $ns = $objParent.namespaceURI () If $ns <> "" Then $ns &=":" EndIf if $ns =0 then $ns= "" $nodepath = "/" &$ns & $objParent.nodeName ()& $nodepath $objNode1 = $objParent $parentName = $objParent.nodeName() Else $objNode1 = 0 EndIf $objParent = 0 _DebugWrite("Path node> " & $nodepath & @LF) _XMLArrayAdd($arrResponse, $nodepath) Next $arrResponse[0] = UBound($arrResponse) - 1 Return $parentName EndIf $xmlerr = @CRLF & "No matching node(s)found!" _XMLError("Error Retrieving: " & $strXPath & $xmlerr) SetError(1,0,-1) Return $parentName EndFunc ;==>_XMLGetParent Link to comment Share on other sites More sharing options...
Vee Posted August 10, 2010 Share Posted August 10, 2010 Hey guys, im having really a bad time trying to read this xml file <ROWSET> <DATE VALUE="10/08/2010 09:39:27" /> <ROW A="MAR" B="DEF" C="37" D="2" E="6" F="0" G="1" H="0" I="0" L="12" M="-120" N="126" O="126" /> <ROW A="MAR" B="PER" C="0" D="0" E="0" F="0" G="0" H="0" I="0" L="0" M="0" N="18" O="18" /> <ROW A="SI" B="PER" C="0" D="0" E="1" F="0" G="0" H="0" I="0" L="0" M="100" N="15" O="15" /> </ROWSET> I'm trying to get the N attribute of the ROW containing the attributes A="MAR" B="PER". I really cant figure out the XPath syntax of this file because there are all this ROW elements named the same way. Link to comment Share on other sites More sharing options...
Vee Posted August 10, 2010 Share Posted August 10, 2010 Hey guys, im having really a bad time trying to read this xml file <ROWSET> <DATE VALUE="10/08/2010 09:39:27" /> <ROW A="MAR" B="DEF" C="37" D="2" E="6" F="0" G="1" H="0" I="0" L="12" M="-120" N="126" O="126" /> <ROW A="MAR" B="PER" C="0" D="0" E="0" F="0" G="0" H="0" I="0" L="0" M="0" N="18" O="18" /> <ROW A="SI" B="PER" C="0" D="0" E="1" F="0" G="0" H="0" I="0" L="0" M="100" N="15" O="15" /> </ROWSET> I'm trying to get the N attribute of the ROW containing the attributes A="MAR" B="PER". I really cant figure out the XPath syntax of this file because there are all this ROW elements named the same way. Ok i found a working solution. _XMLGetAttrib('(//ROW[@A="MAR"][@B="PER"])', 'N') Thanks for the wrapper!!! Link to comment Share on other sites More sharing options...
lordmikkel Posted August 13, 2010 Share Posted August 13, 2010 (edited) hi, i am having some problems using this udf, iam tryin to read a xml see below to get the serial Number and value for both drives, can anyone help me please <page Title="Storage Devices" H1="Property" H2="Value" __type__="2" > <item Property="Disk -1" > <item Property="Manufacturer" Value="Maxtor" > </item> <item Property="Model" Value="MAXTOR STM3320613AS" > </item> <item Property="Size" Value="320.0 GB" > </item> <item Property="Firmware Version" Value="MC1H" > </item> <item Property="Serial Number" Value="9SZ2WH47" > </item> <item Property="Rotational Speed" Value="7200 RPM" > </item> <item Property="Interface" Value="Serial ATA" > </item> <item Property="Standard" Value="ATA8-ACS | ATA8-ACS version 4" > </item> <item Property="Transfer Mode (Current / Max)" Value="SATA-300 / SATA-300" > </item> <item Property="Features" Value="S.M.A.R.T., 48bit LBA, NCQ, AAM" > </item> <item Property="Temperature" Value="44 C (111 F)" > </item> <item Property="Controller Buffer Size on Drive" Value="16384 KB" > </item> <item Property="Queue Depth" Value="32" > </item> <item Property="Removable" Value="No" > </item> <item Property="Manufacturer" Value="Western Digital" > </item> <item Property="Model" Value="WDC WD3200AAKS-75SBA0" > </item> <item Property="Size" Value="320.0 GB" > </item> <item Property="Firmware Version" Value="12.01B01" > </item> <item Property="Serial Number" Value="WD-WCAPZ2972895" > </item> <item Property="Interface" Value="Serial ATA" > </item> <item Property="Standard" Value="ATA/ATAPI-7 | ----" > </item> <item Property="Transfer Mode (Current / Max)" Value="SATA-300 / SATA-300" > </item> <item Property="Features" Value="S.M.A.R.T., 48bit LBA, NCQ, AAM" > </item> <item Property="Temperature" Value="37 C (98 F)" > </item> <item Property="Controller Buffer Size on Drive" Value="16384 KB" > </item> <item Property="Queue Depth" Value="32" > </item> <item Property="Removable" Value="No" > </item> Edited August 13, 2010 by lordmikkel 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