Will-
Wouldn't that cause a problem if there are quoted strings containing < or > characters? That's why I went character by character in my XML routine. As someone else pointed out, handling truly large strings efficiently usually comes down to not loading the entire thing into memory at once. The underlying string routines are quite efficient, but everything suffers if memory gets too crowded and the system starts swapping.


Best,
David Beahm


[EMAIL PROTECTED] wrote:

"I've got a subroutine that takes an XML string and tries to convert it
into a dynamic array.  It does it byte by byte, and I'm just looking for
a faster way to parse the XML."

Nick, someone already alluded to this but you can probably make it faster by extracting information 
FIELD by FIELD instead of char by char.  XML is a delimited language, delimited by <tag> 
whatever "tag" might be.

So you do an INDEX on "<" and it returns the char position where the "<" is.  You can then INDEX on 
">" and it returns the char position where the ">" is.  Now you know what the tag starts and stops.

*C.DELIM is a counter to how many delims I've already run through
START.POS = INDEX(mystring,"<",C.DELIM)
STOP.POS = INDEX(mystring,">",C.DELIM)
THIS.TAG = mystring[START.POS+1,STOP.POS-START.POS-1]

You can do a similiar thing to find the fields of data between the tags.  Using index 
and sub-string extraction should be faster than extracting and testing every single 
char.

Will Johnson
Fast Forward
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to