Page 1 of 1

XMLParser ?

Posted: Mon Apr 04, 2016 5:00 pm
by Sheeva700
Hi,

I'm trying to use XMLParser (amiga) and i'm a bit confused.
I'm using example included in the archive, I have read the Docs but... :?

I can achieve some usefull parsing stuffs following "testsimple.hws"
but i can't parse some very basics stuffs like get the value between 2 markers

Code: Select all

<test>hello world</test>
StartElement and EndElement return "test" correctly but i need the value inside.
no success. :cry: :shock:

i have write a function to handle that

Code: Select all

Function String_get_Between(src$,start$,stop$)
    Local StartPointer, Stop ,Result
    StartPointer = FindStr(src$,start$)+StrLen(start$)
    Result = MidStr(src$,StartPointer,FindStr(MidStr(src$,Startpointer,StrLen(src$)),stop$))
    Return(result)
EndFunction  

Degugprint(String_get_Between("<test>hello world</test>","<test>","</test>"))

of course, i want to use the Plugin.

To be honnest, bouncing XMLParser doc to Luaexpat example is even more confusing.

Which callback can we use with this Plugins ? it is only startelement,endelement,comment
or can i use all described in luaexpat ? excluding default which is recognised as a Native keyword by hollywood.

Dominique.

Re: XMLParser ?

Posted: Mon Apr 04, 2016 10:19 pm
by airsoftsoftwair
You need to use a "CharacterData" callback to get a tag's content. "StartElement" will only give you the tag's attributes but there are none in your case. To get the contents of a tag, use the "CharacterData" callback.

Re: XMLParser ?

Posted: Thu Apr 07, 2016 11:34 am
by Sheeva700
Working Perfectly.

Thanks.