Login Register


[AutoIt]Read XML Elements from file filter_list
Author
Message
[AutoIt]Read XML Elements from file #1
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.
(This post was last modified: 11-28-2011, 10:10 PM by Skullmeat.)
Pierce the life fibers with your drill.

Reply

RE: [AutoIt]Read XML Elements from file #2
Cool. How do You Make Stuff Like That? Did That Function Already Exist and You Just Changed It? :epic:
(This post was last modified: 11-27-2011, 11:26 PM by doojan.)

Reply

RE: [AutoIt]Read XML Elements from file #3
No, he's just returning a regex to check for possible elements in the full string, and moving to next

Code:
'>([^:]*?)</'
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: [AutoIt]Read XML Elements from file #4
(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.

Reply

RE: [AutoIt]Read XML Elements from file #5
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
Pierce the life fibers with your drill.

Reply

RE: [AutoIt]Read XML Elements from file #6
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.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: [AutoIt]Read XML Elements from file #7
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.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply







Users browsing this thread: