XMLParser ?

General questions that have to do with plugins go here

XMLParser ?

Postby Sheeva700 » Mon Apr 04, 2016 5:00 pm

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.
Sheeva700
 
Posts: 27
Joined: Sun Mar 22, 2015 9:24 pm

Re: XMLParser ?

Postby 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.
User avatar
airsoftsoftwair
 
Posts: 2233
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: XMLParser ?

Postby Sheeva700 » Thu Apr 07, 2016 11:34 am

Working Perfectly.

Thanks.
Sheeva700
 
Posts: 27
Joined: Sun Mar 22, 2015 9:24 pm


Return to General plugin questions

Who is online

Users browsing this forum: No registered users and 2 guests