Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

XML parsing

Jarod Godel
Utilitarian
Join date: 6 Nov 2003
Posts: 729
05-07-2006 19:41
I opened up my XML parser thinking to fix a few bugs, but something is really starting to concern me. Is it possible to effectively parse XML without arrays (or even lists within lists)? When llHTTPRequest hits the grid, will/should we use simple, attribute-free XML?

Just, in general, what are you guys leaning toward?
_____________________
"All designers in SL need to be aware of the fact that there are now quite simple methods of complete texture theft in SL that are impossible to stop..." - Cristiano Midnight

Ad aspera per intelligentem prohibitus.
Adam Zaius
Deus
Join date: 9 Jan 2004
Posts: 1,483
05-08-2006 01:33
You could always use a strided list for multidimensional arrays.

For a multidimensional list, you could try a terminated strided list. (ie use a terminatror to seperate elements)
_____________________
Co-Founder / Lead Developer
GigasSecondServer
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
05-08-2006 07:08
I'm going to have my PHP script do the actual RSS parsing and then have it return a preformatted string/list to my object. Parsing RSS inside LSL is slick (and for some people, their only choice) but if you have your own webserver, parsing RSS in PHP will be more robust.
Kitten Lulu
Registered User
Join date: 8 Jul 2005
Posts: 114
05-08-2006 07:10
I was considering using YAML, or even a simpler protocol, and code a sax-style parser using link_messages.

I'd use an external server to parse XML, extract just what is needed and encode it in the simple protocol language I'd build.
_____________________
I've got a blog!

My products are available on SLExchange or in-world in my shops: Kitten Lulu's Emporium and Kitten&Co.
Jarod Godel
Utilitarian
Join date: 6 Nov 2003
Posts: 729
05-08-2006 07:44
Adam: I hadn't thought of using delimited strings like that. (More the fool I.) Good point. Good idea.

Harris, Kitten: I considered off-site parsing -- specifically for my WeatherPrim script, since the Weather Bug XML is likely more than 4k in size -- but wasn't sure if I was being too short-sighted or what. It's good to know other people are inclined toward this as well.

Thanks!
_____________________
"All designers in SL need to be aware of the fact that there are now quite simple methods of complete texture theft in SL that are impossible to stop..." - Cristiano Midnight

Ad aspera per intelligentem prohibitus.
MC Seattle
Registered User
Join date: 3 Apr 2006
Posts: 63
05-08-2006 16:33
I've been leaning towards off-site XML parsing. Having worked with XML parsers in my RL programming jobs fairly extensively, the complexity of the spec frightens me when I think about LSL. A basic value and attribute parser should be possible, but I'm wondering how much processing and memory it would take out of a script just to parse a basic RSS feed, before even doing anything with the data? I have an RSS feed reader using XyText and XML-RPC that does all the XML parsing in PHP, then sends raw preformatted text that can be sent straight to XyText. The LSL script is only listening for and relaying data.

I wonder how difficult a JSON encoder/decoder would be? http://www.json.org/
Jarod Godel
Utilitarian
Join date: 6 Nov 2003
Posts: 729
05-08-2006 18:48
From: MC Seattle
I wonder how difficult a JSON encoder/decoder would be? http://www.json.org/
Just looking at the diagrams, I'm leaning toward somewhere between difficult and impossible. JSON looks like it depends on arrays and objects (which, technically can be emulated with delimited strings in lists, as Adam pointed out).

Thanks for the link, though. This bears investigation.
_____________________
"All designers in SL need to be aware of the fact that there are now quite simple methods of complete texture theft in SL that are impossible to stop..." - Cristiano Midnight

Ad aspera per intelligentem prohibitus.