Page 1 of 1

4.1 XML vs simple procedure

Posted: Sat Nov 10, 2007 9:47 pm
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

Posted: Sat Nov 10, 2007 11:19 pm
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?

Posted: Sun Nov 11, 2007 5:03 am
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.