I am returning some XML to the browser using print from a LotusScript agent. The rendered XML gets truncated between 19000 and 27000 characters. Since this figure is not conistent, possibly its a problem between the server and the browser, rather than an output problem. Possibly the browser (IE6) is rendering the XML before the stream is complete. However, the request only takes a second or so, so it should not be related to timeout. Breaking the print into smaller chunks does not help.
Since there is more data than I expected I will probably do this a different way, but I would still like to know what the problem is. Thanks.
Subject: Max length for web agent print?
I had an exact problem and then I did this:
Const MAX_CHAR = 10000
response = xml.responseText
While Len(response)>0
If Len(response)>MAX_CHAR Then
Print Left(response, MAX_CHAR)
response = Right(response, Len(response)-MAX_CHAR)
Else
Print response
response = ""
End If
Wend
HTH
Sai
Subject: RE: Max length for web agent print?
I did pretty much the same thing and it didn’t seem to help. I will give it another try. Thanks for the reply.
UPDATE: Unfortunately, even copying that code exactly, I still have the same problem. Dammit…
Subject: Max length for web agent print?
There is probably more than one issue at fault here.
There is a limit on the length of text allowed in the print statement. I think it is 32k but I could be wrong. The real problem is that when you attempt to break the output up into smaller chunks (1k, 10k, 32k, take your pick) the print statement appends a carriage return (or linefeed) to the end of each chunk.
This causes problems if your chunk happens to end in the middle of an XML element name or otherwise messes up the XML formatting.
The Help for the print statement says you can control carriage returns with semi-colons, but this does not work when generating output to the browser.
Breaking up the output into chunks does work but you need to be smart about how you go about it. If possible try to split it up between a closing angle bracket “>” and an opening one “<”.
I brought this issue up in the developer’s lab at Lotusphere. They took my name and wrote the issue down, but so far I haven’t heard anything.
Hope that helps.
Brent Henry
Enter Infosystems Inc.