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 / TPC on Parsing XML file

Author
Message
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 23rd Aug 2003 20:53
Hmm... is there any TPC DLL out there that does XML parsing? If it isn't, I am gonna write one, as I realize using XML to describe the objects in my game is great! Any comments?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 23rd Aug 2003 21:39
I was doing one, but the DLL I was interfacing with was too much of a pain... So go ahead...


swdave
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United States
Posted: 24th Aug 2003 03:44
I hope you were considering using the XML parser library and making a TPC wrapper for it.

Expat XML Parser
http://www.jclark.com/xml/expat.html
http://expat.sourceforge.net/

I think the BIG problem is that dbp cant handle complex types like the DOM object, which is what the parser returns.

That would force you to create functions and tokenizers to return the info you want from the DOM object.

In reality XML has alot of overhead, consumes alot of bandwidth, and wouldnt exist without fast PCs and HS Net.

MyVal$ = "<MyValue>1</MyValue>"
MyVal = XML_Parse(MyVal$,"MyValue")

Why not just

Rem Put value in MyVal
MyVal=1

When I say alot I mean MyVal uses 1 byte and MyVal$ uses 20 bytes plus a function call to convert it.

My tests so far on U5 TPC show returning strings from TPC is working good.

After saying all that I bet Rob K. can pop the msXML_Parser in by Monday.

Dave...
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Aug 2003 05:00
No he can't ...

He's gone on holiday again
swdave
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United States
Posted: 24th Aug 2003 05:12
u need a holiday 2
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Aug 2003 05:19
Nope. What I need right now is to go to bed
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 24th Aug 2003 09:03
I checked out Expat, it is simple but I don't know how fast it is, esp. when comes to huge XML file, say 1MB?

I plan to use MSXML or Xerces using DOM. What do you guys think?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 24th Aug 2003 09:21
swdave:

To answer your question on those XML overhead, actually you are right, but it is there for a reason, that's to increase the robustness of the XML parser, i.e. avoid syntax error.

XML might be overkill you use it to describe a simple set of data, for example just a name-value pair like you mentioned.

The power of XML comes when you deal with parent child relationship object descriptions, and attributes, for example



I know that you might argue that you can convert all these into the form of name-value pair. The way above looks more cleaner logical, and also more extensible (if you can see it how). In terms of performance, XML parser actually had done a lot of research into optimizing their parsing engine. If you take a look at MSXML, it can load a DOM structure from an XML file at around 6MB / second. Can you imagine that?? That will read around 110,000 XML nodes per second. [Refer to MSDN].

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/

Login to post a reply

Server time is: 2026-07-23 15:49:36
Your offset time is: 2026-07-23 15:49:36