5 Replies Latest reply on Jan 6, 2007 2:51 AM by newman_

    large external XML file

      I have XML file which is large (about 8MB). I imported it and put data from XML into DataGrid. It works...
      ....BUT when I try to manipulate on data (show details, find something etc.) each Query takes 5-8 seconds.

      Could you give me some TIPs or solutions how to speed up data manipulations on large XML file???

        • 1. Re: large external XML file
          FlightGuy Level 1
          Hard to tell without seeing more detail of what you're doing. Try putting the data relevant to the grid into an ArrayCollection of objects and then convert back to XML when you're ready to send it back to the server.

          • 2. Re: large external XML file
            newman_ Level 1
            I'm just using DataGrid to show data from external XML. I imported XML file and then put it into DataGrid. I didn't convert data from XML to ArrayCollection.
            I didn't send it back to the server.

            Few main lines from my code:
            // var
            public var XMLmyData : XML;
            // load XML
            // handle after load
            XMLmyData = XML(xmlFileMyData.lastResult);
            // in DataGrid

            • 3. Re: large external XML file
              ntsiii Level 3
              It won't do anything for speed, but don't use lastResult in a handler function. INstead, pass the event object to the handler: result="onResult(event)", and in the handler:
              private function onResult(event:ResultEvent):void
              XMLmyData = XML(event.result);

              Also, how are you manipulating the data? Are you using e4x expressions?

              • 4. large external XML file
                newman_ Level 1
                Here is my code with more details. I deleted not important parts.
                It's not full original code. I'm using e4x expressions.

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="{applicationStart()}" >
                <mx:HTTPService id="xmlFileMyData" url="test.xml" resultFormat="e4x" result="handleLoad()" fault="handleFail()" useProxy="false" showBusyCursor="true"/>


                import mx.messaging.management.Attribute;
                import flash.utils.*;
                import mx.collections.ArrayCollection;
                import mx.controls.dataGridClasses.DataGridColumn;
                import mx.controls.TextArea;

                public var XMLmyData:XML;
                private var ExpDays:String;
                private var SumServ:String;
                private var wService:String;

                private var myProp: String;
                private var loadCount:Number = 0;
                private var initDG:Array;
                private var k:Number;
                private var ExplorationsL:String;

                private function applicationStart():void {
                private function runApp():void {
                private function loadXML():void {
                private function handleLoad():void {

                XMLmyData = XML(xmlFileMyData.lastResult);

                private function handleFail():void {
                // failed


                <mx:Panel name="mainpanel" width="800" height="450" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10" layout="absolute" x="10" y="75" title="Analizy" alpha="1.0">
                <mx:DataGrid selectedIndex="0" tabChildren="true" x="20" y="20" id="dgData" width="740" height="250" dataProvider="{XMLmyData.nodes.singlenode}">
                <mx:DataGridColumn width="130" headerText="header" dataField="" >
                <mx:VBox clipContent="false">
                <mx:Text text="{data.myid[data.myid.length()-1].toString()}"/>

                I'm using handlers because in original code I import few XML files.
                My XML structure looks like:

                I created names special for this post.

                • 5. large external XML file
                  newman_ Level 1
                  Tracy: why you suggest NOT to use lastResult in a handler function ??
                  I actually test it (I added onResult(oEvent:ResultEvent)) and still getItemAt in my itemRenderer (in DataGrid) doesn't show data.
                  Maybe I make some syntax error...?
                  I tested this too:
                  ...and nothing, no data in DataGrid :/