Re-2: search for regular expression in text and put the results into an array

runrev260805 at m-r-d.de runrev260805 at m-r-d.de
Thu Nov 5 17:16:52 EST 2009


Hi,

first thanks to all for the suggestions. As i am unfamiliar with the offset function and i was a little in a hurry i used Jim´s script and extended it to my needs.

@Jim

Line 8 of your example should be

filter xmlBlock without "<statuses type='array'>*"

shouldn´t it. 

Thanks again.

Matthias



-------- Original Message --------
Subject: Re: search for regular expression in text and put the results into an array (05-Nov-2009 6:41)
From:    Jim Ault <jimaultwins at yahoo.com>
To:      runrev260805 at m-r-d.de

> 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----
> 
> on test
>     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]
> 
>        end repeat
>     end repeat
> 
>     --> statusCount = total
>     --> storArray[num] = strings storage
> end test
> 
> Hope this helps.
> 
> Jim Ault
> Las Vegas
> 
> On Nov 4, 2009, at 4:06 PM, runrev260805 at m-r-d.de wrote:
> 
> > Hi,
> >
> > 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?
> >
> > Regards,
> >
> > Matthias
> 
> 
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 
> 
> 
> To: use-revolution at lists.runrev.com





More information about the use-livecode mailing list