Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / What's the best way to parse an XML string?

Author
Message
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Jan 2013 17:36
The title is self explanatory.

What's the most efficient way to parse an XML string in DBP stored in memory, not on disk?

Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 3rd Jan 2013 17:50
load to a bank, parse at character level and avoid using DBpro native string commands.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Jan 2013 18:41
Isn't there an XML plugin somewhere? That would be the most efficient.

If you're asking what the most efficient way to do this in DBP is, I suppose just scanning through every character using matrix1's fast left and fast right commands.

TheComet

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Jan 2013 19:23
My library works pretty well for me. Uses all native DB commands.
http://forum.thegamecreators.com/?m=forum_view&t=179871&b=6

How big is the XML you're trying to load?

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Jan 2013 20:18
Thanks everyone.

In most cases the XML will be generated outside of DBP; as you know its XML plugins only deal with files. In some cases the XML will arrive from over the internet; in other cases via local windows components.

The reason I want this feature is because the logic needs to be read back; serializable logic. I could generate LUA, but could not easily read it back to authorize or produce logic dynamically. XML is easy to read and write on either side of the database.

I briefly looked at your library Phaelax, it seems like the most complete solution available; I'll try it out; and will add memblock/bank functions as suggested by Kevin.

It's a question of finding out what boolean conditions are fastest. I know a fixed length Mid$ expression is quite fast compared to Fast Left$ etc, but the XML would need to be rigidly structured which would not very well formed and too memory intensive.

Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 4th Jan 2013 04:59
For XML I would definitely go with a library. If Phaelax could add functionality that would handle individual string variables instead of requiring a file on disk that would be ideal. I know that I ended up using Xerces for my XML handling in C++ because it was the only library I could find that could serialize XML relatively easily.

Login to post a reply

Server time is: 2026-07-07 09:04:46
Your offset time is: 2026-07-07 09:04:46