Skip to main content
April 20, 2007
Question

How to dynamically SAVE Recordset as XML?

  • April 20, 2007
  • 1 reply
  • 708 views
Does anyone know how to SAVE an exported recordset as a xml file on the server? (php MySQL)

I'm using the developer toolbox to 'export recordset as XML' and it loads the xml data dynamically, but it's slow. I'm hoping that there is a way i could have the xml file generated and saved on the server so that i dont' have to query the database every time.

I saw this article on how to do it, but i can't get it to work with the 'export recordset' feature
http://articles.techrepublic.com.com/5100-3513_11-6141415.html

any help is appreciated.
This topic has been closed for replies.

1 reply

Inspiring
April 21, 2007
dz101 wrote:
> Does anyone know how to SAVE an exported recordset as a xml file on the server?
> (php MySQL)
>
> I'm using the developer toolbox to 'export recordset as XML' and it loads the
> xml data dynamically, but it's slow. I'm hoping that there is a way i could
> have the xml file generated and saved on the server so that i dont' have to
> query the database every time.

A very simple way of doing it is to load the PHP file that generates the
XML into a browser. Right-click and view the source code. Select the
source, copy it, and paste it into a new file. Save it as XML.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
April 23, 2007
dz101 wrote:
> What i'm looking for is a way for the XML file to be
> autimatically written to the server rather than dynamically generated because
> it seems to be painfully slow that way.

If you find the dynamic generation to be painfully slow, it suggests
there's something wrong with your server.

If you want to write it to a file, it's simply a question of generating
a recordset, using a loop to generate the XML and save it to a string,
and finally using PHP to write the string to a file. It's a relatively
trivial procedure for anyone with intermediate PHP skills. However, I
don't know of an off-the-shelf way of automating it for you. Sorry.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
April 23, 2007
thanks for your feedback. Unfortunately, it's a bit over my head to write the php code to convert the string to a file, which is pretty much the reason i use Dreamweaver so that i won't have to write PHP if at all possible. i'm just a visual type and don't really have the brain for programming.

in terms of a server issue, i've experimented with a few different processes to acheive the same results.
1. i've created a php page to generate a recordset directly from the database. this is very fast, but unfortunately i can't work with spry objects this way since it requires an XML string
2. i've createt the page using the spry framework calling a static XML file. this too is very fast (but requres me to manually save an XML file everytime I update the DB
3. I've used the XML transformation command from the Dreamweaver Developer Toolbox in conjunciton with the Spry recordset and this very, very slow in comparison to the previous methods.

I'm not an Apache expert, but i really dont' think it's a server issue. it seems that it is just a slower process to transform a db request into an xml string and output to a page. but, maybe i'm wrong. I've tested it on a few different servers and i've also run it under MAMP pro default config (php 5, MySQL 5) and still a slower process.

by the way, i have your book on PHP web development with dreamweaver. great book! really learned a lot.