Sinisterly
[AutoIt]Read XML Elements from file - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: [AutoIt]Read XML Elements from file (/Thread-AutoIt-Read-XML-Elements-from-file)



[AutoIt]Read XML Elements from file - 1234hotmaster - 11-26-2011

Code:
Func ReadXML($Path,$Element) ;by 1234hotmaster Local $aRet = StringRegExp(FileRead($Path), '<' & $Element & '>([^:]*?)</' & $Element & '>', 3) If IsArray($aRet) Then Return $aRet Else Return SetError(-1) EndIf EndFunc

i was bored so i thought i make this Tongue
credits to Malkey for the regex Smile

This function will return an array of all element's values found in that file.


RE: [AutoIt]Read XML Elements from file - ReaperX - 11-27-2011

Cool. How do You Make Stuff Like That? Did That Function Already Exist and You Just Changed It? :epic:


RE: [AutoIt]Read XML Elements from file - ArkPhaze - 11-27-2011

No, he's just returning a regex to check for possible elements in the full string, and moving to next

Code:
'>([^:]*?)</'



RE: [AutoIt]Read XML Elements from file - ReaperX - 11-27-2011

(11-27-2011, 11:27 PM)Infinity Wrote: No, he's just returning a regex to check for possible elements in the full string, and moving to next

Code:
'>([^:]*?)</'

Oh Ok.


RE: [AutoIt]Read XML Elements from file - 1234hotmaster - 11-28-2011

No i just saw an example for the RegEx and builded my own function. I thought this can be used for extracting XML elements Smile

Keep in mind i ain't a leecher Wink


RE: [AutoIt]Read XML Elements from file - ArkPhaze - 11-28-2011

I'm not too good with regex either, unfortunately I know how to use regex in my scripts, so once I screw around and finally find a regex that works through trial and error, I can use it lol. I know basic regex, it's really just a memory language, not much to it if you know the rules.


RE: [AutoIt]Read XML Elements from file - ArkPhaze - 11-28-2011

I'm not too good with regex either, unfortunately I know how to use regex in my scripts, so once I screw around and finally find a regex that works through trial and error, I can use it lol. I know basic regex, it's really just a memory language, not much to it if you know the rules.