search for regular expression in text and put the results into an array
jimaultwins at yahoo.com
Wed Nov 4 22:46:00 CST 2009
I don't use the xml library to do the simple tag processing for three
types of tags
Chunk expressions are so fast that I get better speed and control of
the data parsing.
------- Use these steps to get started----
replace cr with empty in xmlBlock
replace quote with "'" in xmlBlock --(apostrophe ' char)
--now you can use quote expressions without worries
-- such as in the next line
replace "<statuses type='array'>" with (cr & "<statuses
type='array'>") in xmlBlock
filter xmlBlock with "<statuses type='array'>*"
put 0 into statusCount
repeat for each line statusArrLine in xmlBlock
replace "<status>" with (cr & "<status>") in statusArrLine
replace "</status>" with ("</status>" & cr) in statusArrLine
filter statusArrLine with "<status>*"
repeat for each line statusTag in statusArrLine
replace "<status>" with empty in statusTag
replace "</status>" with empty in statusTag
--now we have the data only, and on a single line
add 1 to statusCount
put statusTag into storArray[statusCount]
--> statusCount = total
--> storArray[num] = strings storage
Hope this helps.
On Nov 4, 2009, at 4:06 PM, runrev260805 at m-r-d.de wrote:
> I am absolutely new to XML, so please forgive me for this question.
> I have an XML file which looks similar like this.
> <?xml version="1.0" encoding="UTF-8"?>
> <statuses type="array">
> <status>blah blah bla
> <some other>blah blah blah
> <and so on></status>
> The <status>...</status> part is repeating many times, but with
> different content.
> i want to put the <status>...</status>part into an array. So i get
> to know how often this part is in the xml file. I then want to
> extract some text of each of this <status>....</status> section. My
> main problem is how to seperate each <Status...> </status> section.
> Do i have to use the XML library? Or is there another way?
More information about the use-livecode