6 Replies Latest reply on Oct 11, 2012 10:56 AM by resdesign

    Help?! XML file insert

    Comfunex Level 2

      hoy!

       

      I was wondering if I can use a simple method such as $.getXML (works for json) to import data from xml, I used a very complicated method using ajax and I am looking for a simpler path

       

      thank you,

       

      Elijahu.

        • 1. Re: Help?! XML file insert
          Jerry Witt Level 2

          Hi,

           

          I found this tutorial about importing JSON data very good:

          http://www.gotoandlearn.com/play.php?id=168

           

          It sounds like XML is just another data type and can be identified as such.

          Take a look at this page:

          http://www.riccardobianconi.it/en/news/adobe-edge-tutorial-dynamic-content-using-ajax.html

           

          I hope those links help.

          • 2. Re: Help?! XML file insert
            roti62 Level 1

            Hi,

             

            I am not firm with JSON, but certainly you can import XML files into Animate. Create an XMLHttpRequest to load your XML and write a functional logic to extract the information. It should not be complicated.

             

            Worth to test the jQuery function parseXML (I have not done this yet), too...

            • 3. Re: Help?! XML file insert
              resdesign Adobe Community Professional & MVP

              When is it better to use external data rather than internal data? What I mean by that is, is it a matter of amount of data or a matter of sturcture or both?

               

              I create simple animations for an online curriculum. I generally insert my data in the composition ready area. The amount of data is not enormous (range is 5 to 50). If I need to edit the data, I can edit the edge action.js file in any editor (I do not need to open the html file in Edge so anyone in my department could take care of that.)

               

              Here is a sample of the structure I use:

               

              myData = [];

               

              myData[0] = {

              explanation: "explanation data here ",

              info:"info data here",

              strip0: "strip info here",

              strip1: "strip infor here",

              wire: "wire info here",

              formula0: "formula info here",

              formula1: "formula info here"

              };

              myData[1] = {

              explanation: "explanation data here ",

              info:"info date here",

              strip0: "strip info here",

              strip1: "strip infor here",

              wire: "wire info here",

              formula0: "formula info here",

              formula1: "formula info here"

              };

               

              etc...

              • 4. Re: Help?! XML file insert
                roti62 Level 1

                Hi redesign,

                 

                it might be a matter of preference. However, following best practice advices in all major languages it might not. One fundamental programming rule is:

                 

                Keep your logic away from your views.

                 

                You may argue that having the logic in your action.js file meets this law. Well, no it does not. Think about more complex projects when editing the complex external JS is no fun, but editing a well-formed XML file still is. Be aware that there is a same-origin-policy on loading external stuff into your runtimes, so put your XML's on the same server directory.

                 

                It is up to you, but I never include logic in my aninmations (as I never did in Flash/AIR). I miss AS 3 and its xmlObject:XML like hell, but Edge's jQuery allows you to handle XML quite well. Even plain JS let you extract your data from the XML notes into say arrays.

                • 5. Re: Help?! XML file insert
                  resdesign Adobe Community Professional & MVP

                  roti62

                  Thank you for your input. That makes sense tough I will probably never have large amounts of data. I actually used external files to load data in Flash but that was a few years ago. Then I changed job to work on print (InDesign). I moved back to interactivity (my prefered field) a few months ago and am re-learning everything. It's amazing how much you forget when you do not use it on a regular basis!

                  • 6. Re: Help?! XML file insert
                    resdesign Adobe Community Professional & MVP

                    By the way, I also keep everything in Composition ready rather than scattering everything over the Edge timeline(s).