6 Replies Latest reply on Dec 17, 2009 6:34 AM by DaveWalsh

    Using XML with E4X

      Got through much of this lesson but have a problem that I cannot resolve with the Search. Hoped that debug would help but while I can see the failure point, it does not help me to resolve the problem.

      It would be good to have access to the Source Code at this point. Since I cannot resolve this issue and subsequent lessons will be based, in part, on this lesson, it makes sense to just replace what I have with working code.

        • 1. Re: Using XML with E4X
          SujitG Level 2
          Hi Ward,

          You mentioned that you found what was going wrong and fixed it in this post ( http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=833&threadid =1382988&enterthread=y).

          It will be great if you can share what was going wrong and how you got it fixed, so that others can learn from it.

          • 2. Re: Using XML with E4X
            wtbell3 Level 1
            Hi Sujit,

            I have not found out what is going wrong with the Search part of this exercise; in the other item you referenced, I did mention that I found a typo that was causing some problems (on line 41) but that did not solve all the problems.

            Since that early post, I've gone through the instructions a couple of times and have tried debugging, but I cannot find the problem.

            So, I can only wait until the team posts the source code so I can compare a working set of code with my attempts to find out what went wrong.

            If you can convince the Adobe folks to post source for each of the exercises, it would be extremely helpful!

            • 3. Re: Using XML with E4X
              Hi there. I had the same problem. The only way I can get the search to work is.....

              at point 58 in the PDF (in the AdobeODT.mxml file around line 76)

              instead of this:
              searchList.source = new XMLList(newXML.children());
              dg.dataProvider = searchList.source;

              just use:
              dg.dataProvider = newXML.children();

              the search now works fine. Hope this helps you too!
              • 4. Re: Using XML with E4X



                I have been struggling with the same issue. Originally, I had an issue with the bindings for the data Object not accepting the XML data, but I found a helpful thread elsewhere recommending a cast to XML - instead of text = "Capacity: {data.capacity}", I used text = "Capacity: {XML(data).capacity}"


                This removed my errors with the binding and I thought I might be good to go.


                Unfortunately, the Search button is still not working. Although it's only removing a little syntactic subterfuge, I made the changes recommended by "WickedChick":






                // searchList.source = new XMLList(newXML.children());



                // dg.dataProvider = searchList.source;

                dg.dataProvider =

                new XMLList(newXML.children());


                I get exactly the same result - nothing!


                Grrr. There *must* be something in error elsewhere in my code, despite it being created step-by-step from the lessons and working every prior time when asked to test it.


                Could someone please help??


                On a similar note, could someone explain why the searchList variable is even needed? It's used only in the lines of code commented out above and the declaration earlier in the same file. It doesn't appear to be of use, unless it is meant to be used in later lessons...


                Thanks for your help!



                • 5. Re: Using XML with E4X
                  JohnConn Level 1

                  Well folks, I figured out my problem and it may help you resolve yours.


                  I added an Alert to the dispatch function in Search.mxml to double-check whether the event was being properly dispatched.


                  Indeed it was!


                  So, after a *long* pause for the holiday, I realized it may be yet another typo on my part. D'oh!


                  When I set the value of the searchObjEvent in the search function of Search.mxml, I used "SearchEvent". However, the search function within the main file was looking for "searchEvent".


                  It took me a little while to discover the typo...the source of the addage: "never edit your own work!"


                  In case you missed it, as would not be surprising (like reading "GO" within a red octagon as "STOP") - the 's' in search was capitalized and should have been lower case.


                  I hope this helps with any issues you were having with this exercise.



                  • 6. Re: Using XML with E4X

                    I had the same issue but found that I was a little to quick when trying to work through all of the code and missed out the line of "dispatchEvent(searchObjEvent);" in the search function within the search component.


                    Silly me but maybe you have missed this out too.