12 Replies Latest reply on Jul 19, 2007 7:03 AM by (fabien_gravier)

    Exporting XML

      Here's a simple question...I think.

      When you create a PHP recordset and then export it as XML, when you make changes to the mySQL table, will those changes show up in the XML? I had assumed, since recordsets change when the data changes in the table, the XML data would change too. But it doesn't appear to be doing this which is causing big problems for me.

      I like using the XML data because I like working with Spry - but my data is dynamic and is in a database. I thought this was my answer.

      Am I wrong?

      Thanks!
        • 1. Re: Exporting XML
          Günter Schenk Level 4
          somewhere in the Adobe Dreamweaver Developer Center there´s a tutorial on how to create a PHP file that´s generating the required XML based on a recordset, means dynamically & on the fly -- so it´s possible to do, but if I only could recall where it was ;-)

          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Exporting XML
            Level 1
            Hi Gunter,

            So you think that it is possible? I am using the ADDT "Export recordset as XML" so I thought that would do it. But it doesn't seem to be changing with the data changes. I'm sure it's something that I'm doing wrong.....it generally is!

            I'll hunt around for that - but I do find it hard to find those tutorials!

            Thanks.
            • 3. Re: Exporting XML
              Günter Schenk Level 4
              Hi James,

              guess I found the mentioned tutorial, it´s called "Converting Database queries to XML" and can be found here :: http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html

              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Exporting XML
                Level 1
                Thank you Gunter.

                Is the idea that each time a page loads that gets a dataset from this php page that is converting to XML, it will dynamically recreate the xml so the data is fresh? I'm able to create the xml page (using the tool included in the ADDT) and sometimes, it is working perfectly but I do have some pages that have not brought in new data. And I'm not sure what could be causing that.

                I just wanted to make sure that I've got the concept down correctly - each time the page loads and creates the dataset, the data is current.

                Thanks
                • 5. Re: Exporting XML
                  Günter Schenk Level 4
                  ADDT´s "Export recordset as XML" will help you create an XML file containing static data. As this file contains the correct XML format, the desired nodes and some sample data to start with, I´d use it as "temporary data source" for developing your SPRY stuff -- and later switch to using the "dynamic" XML as live feed.

                  >>
                  Is the idea that each time a page loads that gets a dataset from this php page that is converting to XML, it will dynamically recreate the xml so the data is fresh?
                  >>

                  indeed, it´s supposed to build the nodes and their contents from the query everytime the page gets loaded

                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: Exporting XML
                    Level 1
                    Hi Gunter,
                    I know you must think I'm incredibly stupid, but I'm trying to get my head around this. The ADDT "Export recordset as XML" creates static data? So how can I switch to using "dynamic" XML as live feed. I am keeping all my information in a mySQL database. I thought the "Export recordset as XML" was dynamic. I do need an xml file that reflects the changes in the table.

                    I'm sorry to be so dense.
                    • 7. Re: Exporting XML
                      Günter Schenk Level 4
                      Hi James,

                      >>
                      I know you must think I'm incredibly stupid
                      >>

                      by no means, this is indeed a tricky matter, and also I still feel like having to keep fighting it out, as this is a rather unknown territory to me as well.

                      However, the PHP file containing ADDT´s "Export Recordset as XML" behaviour can be previewed in a browser and will display the XML structure & exported data correctly -- but this alone won´t give you an instant "ready for consumption" result, because you´ll first need to use your browser to save the currently displayed page as an XML file and store it on your server for re-use with e.g. SPRY

                      Because of this required intermediate step you can´t expect *this* exported data to be "dynamic", means you´ll get static data after all, which would require a manual "save as..." update everytime you preview it in a browser

                      But :: what you *do* get in the same time, is a file containing the correct XML structure incl. the correctly named nodes and all -- and *this* structure is what you can use as basis for creating a truly dynamic XML file (can in fact be a .php file, as long the XML syntax is correct) using the steps explained in the Developer Center link I gave you.

                      Better now ? ;-)

                      Günter Schenk
                      Adobe Community Expert, Dreamweaver
                      • 8. Re: Exporting XML
                        Level 1
                        But, if you put the php file up with the exported xml in it - and you are creating the datafile from the php page, not from an xml page, why isn't that php page creating the xml page each time? It's not like you are using an xml page to create your dataset. And also, I could swear that I have some pages using datasets from from xml created from php pages that are keeping updated.

                        If I run the php page in the browser - by itself and not through the other page - is that recreating the xml data? Maybe that is what I am doing.

                        The link that you gave earlier - that is examples of the way to create a php page that will automatically update?

                        I'm sorry, I'm so confused at this point!! I think I need to call it a night and look at this again in the morning.

                        Thank you for your patience. I WILL understand this eventually. I always do....but it's always painful!
                        • 9. Re: Exporting XML
                          Level 1
                          Hi Gunter,

                          I've been playing around a bit and I think that the "export recordset as xml" tool in ADDT DOES create dynamic xml. I think my problem before was that I was having a problem with the spry table navigation so I wasn't seeing the new data.

                          But I just created a simple page that populated its dataset from a php page with a recordset and the "export recordset as xml" and viewed it. I then changed the data in the mySQL table....and it was reflected on the page!

                          So perhaps, because I didn't have the record navigation on the table, I thought it wasn't dynamic because I was seeing the same data - only 10 records.

                          I hope I'm right!

                          Thank you for all your patience and your help!
                          • 10. Re: Exporting XML
                            Hello guys,

                            I just want to clear out things for you.

                            So "Export Recordset As XML" IS generating dynamic XML content, because it is of course generated from a database Recordset, which fetches dynamic data.

                            The confusion Günter was probably making is that he did not know that you can actually set the URL to the php page (where "Export Recordset As XML" is applied) as source for your Spry XML Data Set.

                            regards,
                            Ionut
                            • 11. Re: Exporting XML
                              Level 1
                              I'm sure it was the clumsy way that I asked the question that made it confusing!

                              I was also wondering if you create a dataset, turn the XML caching off and then add a refresh rate, if there are changes in the data in the database between the refreshes, will this show up? I guess in other words, does it actually generate the XML data again?

                              Thanks!
                              • 12. Re: Exporting XML
                                Hi!<br /><br />please sorry for my english.<br /><br />I export with "export recordset as XML" , a great XML , but I must in the top of this file put a static portion of code before. How I can do that .<br /><br />I must have this portion of code: <simpleviewerGallery <br />maxImageWidth = "640" <br />maxImageHeight = "640" <br />textColor = "0xffffff" <br />frameColor = "0xffffff" <br />frameWidth = "20" <br />stagePadding = "40" <br />thumbnailColumns = "3" <br />thumbnailRows = "4" <br />navPosition = "left" <br />title = "SimpleViewer Title" <br />enableRightClickOpen = "false" <br />backgroundImagePath = "" <br />imagePath = "imagesuploader/" <br />thumbPath = ""><br /><br />Thanks a lot