Also, I would suggest Jeff Peters' book on the CF XML Object:

http://www.cafepress.com/protonarts.50984013

ap


On Jan 1, 2007, at 8:31 PM, Andrew Powell wrote:

1.  Read the XML file with CFFILE
2.  Parse the xml string with xmlParse()
--optional, but recommended-- narrow your XML document down to an array of of your data elements using xmlSearch() and the xPath to your data 3. loop over data and do what you will with it (conditionals to check, etc.) 4. write it back to the server or whatever storage space you are using (database, etc.)

As far as writing back the whole XML doc, that may be a matter of not using xmlSearch() and working with the whole document instead. I'm not sure if xmlSearch() returns its array by reference or by value. Someone else may be able to clear this up. In the livedocs someone says that searches on the same XML doc are NOT thread-safe within a shared scope. This leads me to think that the array returned by xmlSearch() is returned is a reference to the original xml doc. If that is the case, then you can just manipulate that data in the array that xmlsearch() returns and then write the original xml back to a string with changes intact. I would not write it to an array of structs or a query if you're going to write back as XML to the server or database. Just manipulate the original XML doc and save the processing of conversion.

To write it back to the server, you just toString(myXMLObj) within your CFFILE action="write" tag.




On Jan 1, 2007, at 8:12 PM, [EMAIL PROTECTED] wrote:

I've not really worked with XML and CF. I've gotten some basics down, and have looked, but am iffy on my logic.

-You read the XML file
-Read the length of the data from the XmlChildren array
-Loop over the parsed XML to put things into a query
-Output data or whatever

-Now to get a specific 'record', you do the same above, except putting an if statement in your loop to add things your query (or select the specific item in the query)

-To add/ modify/ delete things, you do whatever to the query, convert it to XML (or modify the XML object itself) and then rewrite the XML file

This sounds cludgy to me, I've got to be missing something. What if you have a large dataset (which I won't in this case)?

Thanks,

mcg
(Yes it's New Year's Day, but working on mom's website, and the USC - MICH game isn't terribly interesting)








-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------


Reply via email to