[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xmltf parser question



glarkins@xxxxxxxxxxx wrote:
> I am working on a webservice where a great deal  of data is returned.
> Due to the amount of data, I have now opted to use http_post_xmltf so
> a stream file will first contain the data.  I know the stream file is
> getting the data and the data is correct.

the http_post_xmltf() routine was created to dispel the confusion that 
can result from calling the original http_url_post_xml() routine.  You 
see, with http_url_post_xml(), the XML parser reads the data directly 
from the network connection.  The problem with that paradigm is that 
it's a little hard to tell what the errors are.  If the network 
connection gets cut off in the middle, the XML parser says "document not 
well-formed" because it didn't get all of the XML elements. Then people 
start thinking "gee, they're sending a bad XML document", or "stupid XML 
parser doesn't have a clue" because they don't understand that there was 
a network/communications error.

So the xmltf functions download the XML first -- and report any network 
errors -- then they parse it separately, and report any XML errors. 
Consequently, there's no confusion.

Later, I did some fixup work that saves network errors to temporary 
variables, and gives them priority over the XML parser errors -- thus 
making the xmltf functions much less useful.

It really has nothing to do with the size of the document.  Either one 
should be able to handle any size document.   The tradeoff is between 
clarity vs. performance.

If it's your intention to archive the original XML document, I don't 
recommend using the xmltf functions since it will discard the document 
when it's done.  Instead, use http_url_post() to download the XML 
document to the IFS, and call http_parse_xml_Stmf() to parse it.  That 
way, the file isn't deleted until you delete it deliberately with the 
unlink() API, or the RMVLNK CL command.

EXAMPLE15 demonstrates this technique (Though, you might have to change 
the http_url_get() to be http_url_post() instead).

> I am stuck trying to figure out where the parser is putting the data
> prior to calling the start procedure that I wrote.  I don't know how
> I am supposed to retrieve the parsed data from within my procedure.


Where does the parser put the data prior to calling the start procedure? 
  It saves it into a variable inside the programs memory. (Is that what 
you're asking?)

You say you don't know how you're supposed to retrieve it --- well, it's 
passed as a parameter to your procedure.  There isn't really any 
"retrieval" involved, you just read the parameter that you're passed...

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------