Alvar Posted September 13, 2017 Posted September 13, 2017 Hi! Can someone help me with the code to read a string in the xml file. What I want to read is <version value = "3.57.1"> </ version>. The file looks like this. <?xml version="1.0" encoding="UTF-8" standalone="no"?> <vaka-manifest> <modules> <module dependencies="" md5="d3c63388a1153f3cb74686718bfe3a47" name="pico.run.jar" signature="93ad368f811ec7fa19039f51a9f248d3" size="73898"></module> <module dependencies="" md5="6c93343819f3f6a9edb597def1099708" name="i18n.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="74650"></module> <module dependencies="" md5="de668c7b299862cb6904f0824e554143" name="i18n_sv.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="94290"></module> <module dependencies="" md5="94a7e8b867f0ee35ef3b44ca06ff1e3c" name="i18n_nl.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="77702"></module> <module dependencies="" md5="8e221a8705f395be662e5151eb68f199" name="i18n_fr.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="1123"></module> <module dependencies="" md5="0013f7899e42803cc7a031b47a89d86a" name="i18n_de.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="1122"></module> <module dependencies="" md5="f94d995767e62ab8e38eb96dc13e3ef2" name="i18n_fi.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="93903"></module> <module dependencies="" md5="f01a6199b5f34c67897a1fc34bc93fa0" name="i18n_no.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="1122"></module> <module dependencies="" md5="40f80869a54780d1e336a6a73134c6a1" name="i18n_da.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="1121"></module> <module dependencies="" md5="16782c531da4ab779dfd33017fb36eac" name="i18n_is.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="1124"></module> <module dependencies="" md5="55ebe0a352fffe348eb8a216bb50824f" name="pico.uix.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="537974"></module> <module dependencies="" md5="587e173a3e71eebe6e4756c4670a0d2f" name="pico.ws.jar" signature="2b88c16fa84ac2c321e1910e2354dda7" size="10691"></module> <module dependencies="" md5="9980c5cbb13040eae07800c44cc5d3b6" name="pico.com.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="153507"></module> <module dependencies="" md5="34457781dfd120f03ec80850ddd804e4" name="pico.lib.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="71350"></module> <module dependencies="pico.com.jar,pico.lib.jar" md5="63530862699bf341ea317d4b115cf423" name="pico.db.jar" signature="1f2ee812e60e893dbf60f0cbf2696af8" size="1239481"></module> <module class="pico.application.PicoApplicationModule" dependencies="pico.core.jar, pico.com.jar, pico.uix.jar" interface="PicoApplication" md5="6e8d311a346e326b311306fcc11c6747" name="pico.app.jar" signature="589558547c223dbbe3f72181e5e5659c" size="2041523"></module> </modules> <version value="3.57.1"></version> </vaka-manifest>
Moderators JLogan3o13 Posted September 13, 2017 Moderators Posted September 13, 2017 Moved to the appropriate forum as the Technical Discussion forum very clearly states: Quote Do not post general support questions here, instead use the AutoIt Help and Support forums. @Alvar have you tried a forum or Google search? We have a number of threads on reading an XML file. https://www.google.com/search?q=site%3Aautoitscript.com+read+xml&rlz=1C1GGRV_enUS752US752&oq=site%3Aautoitscript.com+read+xml&aqs=chrome..69i57j69i58.6053j0j8&sourceid=chrome&ie=UTF-8 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
youtuber Posted September 13, 2017 Posted September 13, 2017 maybe work $site = "https://www.autoitscript.com/forum/topic/190353-read-a-string-from-xml-file/" $aUrlread = BinaryToString(InetRead($site,0), 4) $aExtract = StringRegExp($aUrlread,'(?:\d{1,2}\.){2}\d{1,3}',3);;3.57.1 For $i = 0 To UBound($aExtract) - 1 If IsArray($aExtract) Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aExtract = ' & $aExtract[$i] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndIf Next or #include <String.au3> $site = "https://www.autoitscript.com/forum/topic/190353-read-a-string-from-xml-file/" $aUrlread = BinaryToString(InetRead($site,0), 4) $aExtract = _StringBetween($aUrlread, 'version value = "','"> <') If IsArray($aExtract) Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aExtract = ' & $aExtract[0] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndIf
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