Author Topic: some xmltag problems ..  (Read 1422 times)

0 Members and 1 Guest are viewing this topic.

Herodes

  • Guest
some xmltag problems ..
« on: 04 September, 2004, 15:54:48 »
Say I have this xml layout ...
How can I get the respective contents of the two '' tags ..?
Code: [Select]


hahahaha
lalalala


hihhihihi
lililili


I am using this atm .. .
* str is the file in which the above xml is lying streamed in the script in a string...

Code: [Select]
tag =gsub(gsub(str, "\r\n", ""), "\t", "") --- removing the line breaks and the tabs ...
--- hahahahalalalalahihhihihilililili
if strsub(tag ,1,1) == "<" then
s,e,tagname = strfind(tag, "<([^>]*)")
print(tagname)
--- output : ALevel
s,e,internal = strfind(tag, "<"..tagname..">(.*)")
print(internal.." this is inside the "..tagname)
--- output : hahahahalalalalahihhihihilililili this is inside the ALevel
s,e,inttag = strfind(internal, "<([^>]*)")
s,e,intcontents,resttag = strfind(internal, "<"..inttag..">(.*)(.*)")
if resttag == "" then
resttag = "nil"
end
print("the tag "..inttag.." has "..intcontents.." and the remaining string is "..resttag)
--- output : the tag Second has hahahahalalalala
hihhihihilililili and the remaining string is nil
end
« Last Edit: 04 September, 2004, 15:55:59 by Herodes »

PtokaX forum

some xmltag problems ..
« on: 04 September, 2004, 15:54:48 »

Offline NotRabidWombat

  • Lord
  • ***
  • Posts: 384
  • Karma: +2/-0
(No subject)
« Reply #1 on: 04 September, 2004, 16:21:21 »


I like childish behavior. Maybe this post will be deleted next.

Herodes

  • Guest
(No subject)
« Reply #2 on: 04 September, 2004, 17:45:31 »
I played so much with it that I forgot its virtues ...
thanks NotRambitWombat ..

PtokaX forum

(No subject)
« Reply #2 on: 04 September, 2004, 17:45:31 »