XML, XMLHttpRequest

I have borrowed the technique from one of the sample. He generated to JSON output but I generated in XML outputI have an agent that generate the xml on the fly. Here is the problem. If the agent produces the large volume of data, xml output is trancated and generates incompleted format. It will work fine for small volume of data. I am not sure what causes of the problem. Is it the print statement (Print “[” + XMLOutput + “]”) that can not output a large string?

This is also a problem whether I generate in JSON format.

Anyone has suggestion,

thanks in advance,

Pat

Here is the code:

XMLOutput = “<?xml version='1.0' encoding='UTF-8'?>”

Set rcol = dbview.GetAllDocumentsByKey(key)

If rcol.count > 0 Then

For i = 1 To rcol.count 			

   Set rdoc = rco.GetNthDocument(i)

  XMLOutput = XMLOutput + |<document id=| + Cstr(i) +   |><name>| + Cstr(Ucase(rdoc.LName(0)) + " " + Ucase(rdoc.MName(0))  + " " + Ucase(rdoc.FName(0))) + |</name>| +_            

   |<phone>|  + Cstr(rdoc.Phone(0)) + |</phone>| +_

   |<fax>|  + Cstr(rdoc.Fax(0)) + |</fax>| +_

   |<ext>|  + Cstr(rdoc.Ext(0)) + |</ext></document>|

Next						

End If

XMLOutput = XMLOutput + “”

Print “Content-type: text/plain”

Print “[” + XMLOutput + “]”

Subject: XML, XMLHttpRequest

I think you are running into the same issue discussed in this thread → http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/d6ca6b0af6da6c9485257435007b8d5a?OpenDocument

Try printing the xml from inside your loop (btw GetNextDocument instead of GetNthDocument is better).

Subject: XML, XMLHttpRequest

Just a stab at it, but you may be running into a length problem with your output due to using text/plain as your content-type. Since you are returning xml, you should use a Content-Type of xml. Also, generally, when using JSON, the content type is text/javascript. I don’t know if this has an impact on your code or not, but try changing the content type line to:

Print |Content-Type:text/xml|

Subject: XML, XMLHttpRequest

There is a limit to the length of a string. Designer Help indicates that it’s only literals that have a 32KB limit, but it applies in practice to string variables created the way you are creating the string as well. Why not print the output as you create it rather than trying to build a long string first?