1 Reply Latest reply on Feb 7, 2007 7:10 PM by beckerb4

    Size limit on string passed to new XML(str)

      I have noticed what I think is a hard limit on the size of strings passed as an argument to the constructor of a new XML variable in actionScript3. I noticed it while trying to pass a large string from javascript to a method in AS3. Everything works fine as long as the string is less than about 330,000 characters, but as soon as the string I pass gets a little bigger than that (say 360,0000 or more) I always get a js error somewhere in the ExternalInterface and a ActionScript error when the data is recieved. I am running on IE.
      Here is what I am doing:
      In javascript I have:


      Where text is some large string of serialized valid xml.

      Then in AS3, I have
      ExternalInterface.addCallback("generateFromXml", generateFromXml); (called in initialize handler)

      public function generateFromXml(serializedXml:String):void
      var x:XML = new XML(serializedXml);

      Everything works fine until the string exceeds about 340,000 characters, then I get this js error at this line in adobe code:
      function __flash__addCallback(instance, name) {
      instance[name] = function () {
      return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>")); //<<<<<--- line with breakpoint in js debugger
      The ActionScript error I get is the following. I believe it happens on the line "var x:XML = new XML(serializedXml);"
      (I think this because if I remove that line, I do not get the error.)

      TypeError: Error #1090: XML parser failure: element is malformed.
      at generator/generateFromXml()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at ()
      at flash.external::ExternalInterface$/flash.external:ExternalInterface::_callIn()
      at ()