4.1 XML vs simple procedure

Just starting out? Need help? Post your questions and find answers here.
mrjiles
Enthusiast
Enthusiast
Posts: 238
Joined: Fri Aug 18, 2006 7:21 pm
Location: IL

4.1 XML vs simple procedure

Post by mrjiles »

Hi everybody. I have began working on an application for posting items on eBay (probably the only one written in PB -- will definitely be the fastest!).

I have figured out the communication aspect and eBay returns an XML file with each query to their server. I have written a very simple XML parsing procedure so should I switch to the PB one? Any ideas on speed, reliability, etc..?

Basically grabs data between the <tags>:

Code: Select all

Procedure.s GetXMLData(XMLTag$, String$)
     XMLTag_Open$ = "<" + XMLTag$ + ">"
     XMLTag_Close$ = "</" + XMLTag$ + ">"
     XMLTag_StartPosition = findstring(String$, XMLTag_Open$, 1)
     XMLTag_Open_Length = len(XMLTag_Open$)
     XMLTag_Open_EndPoint = XMLTag_StartPosition + XMLTag_Open_Length
     XMLTag_Close_StartPosition = findstring(String$, XMLTag_Close$, XMLTag_StartPosition)
     ReturnData_Length = XMLTag_Close_StartPosition - XMLTag_Open_EndPoint
     ReturnData$ = mid(String$, XMLTag_Open_EndPoint, ReturnData_Length)
     ProcedureReturn ReturnData$
EndProcedure
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Hi,

the PB XML library seems solid enough and is certainly easy to use.

However, if you already have working code, then why change it?
I may look like a mule, but I'm not a complete ass.
mrjiles
Enthusiast
Enthusiast
Posts: 238
Joined: Fri Aug 18, 2006 7:21 pm
Location: IL

Post by mrjiles »

Some of the eBay responses have 100+ XML tags to parse and I didn't know how things would compare speed or reliability wise.

This also works great for reading from a simple settings file.
Post Reply