shaqan Posted May 11, 2010 Share Posted May 11, 2010 (edited) Can you help me out by showing how to read value (bold) into array.partial XML example<!-- Exported on: 2010-05-07 22:25:51 --><!-- Type: SkillData --><!-- Version: 0.4a --><Data Version="0.4a" CitizenshipID="F714-874F"> <PersonalData>....Using _XMLDOMWrapper.au3 UDF and managed to find out how to parse and read into array something like <Gender>Male</Gender> but CitizenshipID problem refuses to yield. Thank you in advance Edited May 11, 2010 by shaqan Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 11, 2010 Share Posted May 11, 2010 #include <Array.au3> $re = StringRegExp(ClipGet(), 'CitizenshipID="(.+)"', 3) _ArrayDisplay($re) Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
shaqan Posted May 11, 2010 Author Share Posted May 11, 2010 Thank you Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 11, 2010 Share Posted May 11, 2010 As for using the _XMLDOMWrapper.au3 UDF to access this: Your source XML is invalid, so it won't load. I corrected it to this for Test1.xml: <?xml version="1.0" encoding="UTF-8"?> <!-- Exported on: 2010-05-07 22:25:51 --> <!-- Type: SkillData --> <!-- Version: 0.4a --> <PersonalData> <Data Version="0.4a" CitizenshipID="F714-874F"/> </PersonalData> Note the valid XML header, root element ("PersonalData"), and "/" closing the "Data" element, since it has no separate closing tag ("</Data>"). This script works correctly with the XML file above: #include <_XMLDOMWrapper.au3> #include <Array.au3> Global $sXML_File = @ScriptDir & "\Test1.xml" Global $iRET, $sRET $iRET = _XMLFileOpen($sXML_File) ConsoleWrite("Open: $iRET = " & $iRET & "; @error = " & @error & "; @extended = " & @extended & @LF) $sRET = _XMLGetAttrib("/PersonalData/Data", "Version") ConsoleWrite("Version: $sRET = " & $sRET & "; @error = " & @error & "; @extended = " & @extended & @LF) $sRET = _XMLGetAttrib("/PersonalData/Data", "CitizenshipID") ConsoleWrite("CitizenshipID: $sRET = " & $sRET & "; @error = " & @error & "; @extended = " & @extended & @LF) Output: Open: $iRET = 1; @error = 0; @extended = 0 Version: $sRET = 0.4a; @error = 0; @extended = 0 CitizenshipID: $sRET = F714-874F; @error = 0; @extended = 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...
shaqan Posted May 13, 2010 Author Share Posted May 13, 2010 Thank you. I posted only first few rows of the xml file since I didnt expect working samples, just guide lines:) Much appreciated:) 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