4 Replies Latest reply on Aug 25, 2009 2:04 PM by sreeflex

    Read XLIM File in flex

    sreeflex Level 1

      Hi,

              Can anybody show me a way to read a xlim or xsl-fo file in flex.  Appreciate your help.

       

      Thanks in advance

       

      Sree

        • 1. Re: Read XLIM File in flex
          nagasreekrishna Level 1

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="load()">

          <mx:Script>
                  <![CDATA[

           

                  public var xmlLoader:URLLoader=new URLLoader();

           

          function load():void{
                      var xmlString:URLRequest = new URLRequest("items.xml");
                    xmlLoader.load(xmlString);
                  xmlLoader.addEventListener(Event.COMPLETE,init);
             }

           


             function init(event:Event):void{
                
                 var xDoc:XMLDocument = new XMLDocument();
              xDoc.ignoreWhite = true;
             var  myXML:XML=XML(xmlLoader.data);  

             var fr:String=myXML.items.item[0].Value.toString();

          }

           

          ]]>
              </mx:Script>
                
          </mx:Application>

           

           

           

          Suppose this is ur items.xml file

          <items>

            <item>

              <name>jk</name>

              <Value>high</Value>

            </item>

            <item>

              <name>coat</name>

          <Value>medium</Value>

            </item>

           

             <item>

          <name>milk</name>

          <Value>low</Value>

             </item>

          </items>

           

          May be u need some imports

           

          Then the output will be :high(becoz items is  a xml list containing many xml nodes...item[0] is first xml node and Value is the element..toString methods converts it into a string)

          1 person found this helpful
          • 2. Re: Read XLIM File in flex
            sreeflex Level 1

            Thanks for the reply. But i want to read data from XLIM  or XSL-FO  file. Not from the XML file. Appreaciate your responce.

            • 3. Re: Read XLIM File in flex
              Barna Biro Level 3

              Same thing. If my memory is not playing tricks on me then XLIM and XLS-FO are also XML structures but with different formatting ( XLS-FO using some namespaces ). Since that's the case, you can always read in any text file ( the format doesn't really matter - what only would matter is the data structure... you'll be easier off with XML-like structures because Flash/Flex can handle that quite well, but if you would be trying to parse plain text... well, that wouldn't be a piece of cake ) and decide to do whatever you want with the content afterward.

               

              So, just simply try to load the XLS-FO file as you'd load an XML file. You should be able to parse it as any other XML file ( just pay attention to the namespaces when parsing the structure ).

              • 4. Re: Read XLIM File in flex
                sreeflex Level 1

                Thank you very much.I will try this way