XMLParser ?

Discuss about plugins that don't have a dedicated forum
Post Reply
Posts: 27
Joined: Sun Mar 22, 2015 8:24 pm

XMLParser ?

Post by Sheeva700 » Mon Apr 04, 2016 5:00 pm


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$))

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.


User avatar
Posts: 3286
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany

Re: XMLParser ?

Post by airsoftsoftwair » Mon Apr 04, 2016 10:19 pm

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.

Posts: 27
Joined: Sun Mar 22, 2015 8:24 pm

Re: XMLParser ?

Post by Sheeva700 » Thu Apr 07, 2016 11:34 am

Working Perfectly.


Post Reply