On 09/02/2012 20:24, Klaus on-rev wrote:
in my current project I need to deal with VERY small XML files
with maybe up to 20 entries.

Wait, didn't we just hear that you can't parse html (or XML) with regexps? *grin*

function mk_getXMLdata tText, tTag
    get matchText(tText,"(?s)<"&  tTag&  ">(.*?)</"&  tTag&  ">",tValue)
    return tValue
end mk_getXMLdata

Throwing caution to the winds, this probably does something similar to what you want without further regexp voodoo:

function mk_replaceXMLdata tText, tTag, tNewText
   put tText into tValue
   if matchText(tText,"(?s)<"&  tTag&  ">(.*?)</"&  tTag&  ">",tValue) then
      put replaceText(tText, \
            "<"&tTag&">"&tValue&"</"&tTag&">",\
      "<"&tTag&">"&tNewText&"</"&tTag&">") into tValue
   end if
   return tValue
end mk_replaceXMLdata

And remember: zalgo is tony the pony! He's a comin!

-Ken

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to