RE: [ACFUG Discuss] XML CF

2007-01-02 Thread Chris C. Cooper
What is a practical use for XML? What kind of situation would call for using
it?

 

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Powell
Sent: Monday, January 01, 2007 8:54 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] XML  CF

 

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
-

 

 




-
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
-



RE: [ACFUG Discuss] XML CF

2007-01-02 Thread Gerrey . Mary-Catherine
For this project, a) I'm learning it, b) figured it would be easier to 
deal with than creating a database and dealing with the ISP.  But for 
another project, I'm looking at using it for faking that a prototype is 
working for demo purposes - namely because the database is REALLY complex.

mcg





Chris C. Cooper [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
01/02/2007 08:40 AM
Please respond to
discussion@acfug.org


To
discussion@acfug.org
cc

Subject
RE: [ACFUG Discuss] XML  CF






What is a practical use for XML? What kind of situation would call for 
using it?
 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Powell
Sent: Monday, January 01, 2007 8:54 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] XML  CF
 
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
-
 
 

- 
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 FusionLink 
- 



-
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
-



Re: [ACFUG Discuss] XML CF

2007-01-02 Thread Andrew Powell
Data interchange between disparate systems is a key usage of XML.   
EDI is one of the sectors where XML really shines.


ap


On Jan 2, 2007, at 8:40 AM, Chris C. Cooper wrote:

What is a practical use for XML? What kind of situation would call  
for using it?




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew  
Powell

Sent: Monday, January 01, 2007 8:54 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] XML  CF



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
-






-
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 FusionLink
-




Re: [ACFUG Discuss] XML CF

2007-01-02 Thread Teddy Payne

XML is typicaly there for storage of information in a homogenous way.
John's suggestion of WDDX makes short hand of CFML constructs and is
adaptable to JS and XML format.

XML is used for configuration files, datasources and webservices just as a
couple of examples.

A lot of Flex examples use XML as a way to have a datasource for demo code
without needing a remote call.

If the test is for demo only, XML datasources work nicely.

Teddy


On 1/2/07, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:



For this project, a) I'm learning it, b) figured it would be easier to
deal with than creating a database and dealing with the ISP.  But for
another project, I'm looking at using it for faking that a prototype is
working for demo purposes - namely because the database is REALLY complex.

mcg




  *Chris C. Cooper [EMAIL PROTECTED]*
Sent by: [EMAIL PROTECTED]

01/02/2007 08:40 AM   Please respond to
discussion@acfug.org

   To
discussion@acfug.org  cc
  Subject
RE: [ACFUG Discuss] XML  CF




What is a practical use for XML? What kind of situation would call for
using it?

--

*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Andrew
Powell*
Sent:* Monday, January 01, 2007 8:54 PM*
To:* [EMAIL PROTECTED]
Subject:* Re: [ACFUG Discuss] XML  CF

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

*http://www.cafepress.com/protonarts.50984013*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][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*http://www.acfug.org/?fa=login.edituserform/

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




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

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


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

Re: [ACFUG Discuss] XML CF

2007-01-02 Thread Gerrey . Mary-Catherine
Like I said, for faking things for demo purposes (figured it would be 
quick and dirty) and mom's little website (not much data).  :)

mcg




Teddy Payne [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
01/02/2007 09:02 AM
Please respond to
discussion@acfug.org


To
discussion@acfug.org
cc

Subject
Re: [ACFUG Discuss] XML  CF






XML is typicaly there for storage of information in a homogenous way. 
John's suggestion of WDDX makes short hand of CFML constructs and is 
adaptable to JS and XML format. 
 
XML is used for configuration files, datasources and webservices just as a 
couple of examples.
 
A lot of Flex examples use XML as a way to have a datasource for demo code 
without needing a remote call.
 
If the test is for demo only, XML datasources work nicely.
 
Teddy

 
On 1/2/07, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote: 

For this project, a) I'm learning it, b) figured it would be easier to 
deal with than creating a database and dealing with the ISP.  But for 
another project, I'm looking at using it for faking that a prototype is 
working for demo purposes - namely because the database is REALLY complex. 


mcg 




Chris C. Cooper [EMAIL PROTECTED]  
Sent by: [EMAIL PROTECTED] 
01/02/2007 08:40 AM 

Please respond to
discussion@acfug.org



To
discussion@acfug.org 
cc

Subject
RE: [ACFUG Discuss] XML  CF









What is a practical use for XML? What kind of situation would call for 
using it? 
  



From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Andrew Powell
Sent: Monday, January 01, 2007 8:54 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] XML  CF 
  
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
- 
  
  

- 
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 FusionLink 
- 

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

For more info, see http

RE: [ACFUG Discuss] XML CF

2007-01-02 Thread Charlie Arehart
MCG, your initial explorations with XML and CF are not unusual. You've
gotten some good tips here so far. I'd like to offer a couple more--and not
just for Mary-Catherine but for anyone learning to deal with XML in CF. It's
one of those topics where--especially if you're new to XML in general--I'd
argue one would NOT be well-served by just looking at/copying code snippets.
You really need to get it first or you'll end up chasing your tail.
Further, there are often many ways to do something (even more than what' s
been proposed here).
 
The best resource I ever found, and which really sparked an Aha! moment for
me when I first read it a few years ago, is Nate Weiss's 30-page article:
 
http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf
 
It's a real page-turner. Seriously. :-) Don't let the 30 pages scare you
off. You'll come out of it after an hour or so with tremendous appreciation
for what XML processing in CFML is about, including tips and techniques that
you might have struggled with to learn on your own. It was actually a
chapter in the original CFMX version of the WACK book which he was permitted
to release online. A wonderful resource, and as timely now as when it was
first released.
 
To address the why would I want to bother that Chris raised, in addition
to Teddy's point about Flex, another is that Spry and indeed many Ajax
solutions also leverage XML. Also, often one is given a file to read,
whether for data interchange as Andy indicated or for reading a file already
on your computer, since so many tools (including CF) now use XML files for
configuration.
 
/Charlie
http://www.carehart.org/blog/  

 

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, January 02, 2007 10:04 AM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] XML  CF



I will be using CF to get things in and out, just not sure of the best
logic.  I'm been looking at the docs plus some other sites out there and
copying code snippets.  Hoping it will set up some of the page flow for
later on.  Come on, trying to learn stuff here. :) 

mcg 





Steven Ross [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED] 


01/02/2007 09:23 AM 


Please respond to
discussion@acfug.org



To
discussion@acfug.org 

cc

Subject
Re: [ACFUG Discuss] XML  CF






If you are faking something for demo data use WDDX, it will be a whole
lot easier to use in CF.

On 1/2/07, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 Like I said, for faking things for demo purposes (figured it would be
quick
 and dirty) and mom's little website (not much data).  :)

 mcg






 Teddy Payne [EMAIL PROTECTED]
 Sent by: [EMAIL PROTECTED]

 01/02/2007 09:02 AM

 Please respond to
  discussion@acfug.org


 To discussion@acfug.org

 cc

 Subject
  Re: [ACFUG Discuss] XML  CF





 XML is typicaly there for storage of information in a homogenous way.
  John's suggestion of WDDX makes short hand of CFML constructs and is
 adaptable to JS and XML format.

 XML is used for configuration files, datasources and webservices just as a
 couple of examples.

 A lot of Flex examples use XML as a way to have a datasource for demo code
 without needing a remote call.

 If the test is for demo only, XML datasources work nicely.

 Teddy


 On 1/2/07, [EMAIL PROTECTED] 
 [EMAIL PROTECTED] wrote:

  For this project, a) I'm learning it, b) figured it would be easier to
deal
 with than creating a database and dealing with the ISP.  But for another
 project, I'm looking at using it for faking that a prototype is working
for
 demo purposes - namely because the database is REALLY complex.

  mcg








 Chris C. Cooper [EMAIL PROTECTED] 
  Sent by: [EMAIL PROTECTED]

 01/02/2007 08:40 AM


 Please respond to
  discussion@acfug.org




 To discussion@acfug.org

 cc

 Subject RE: [ACFUG Discuss] XML  CF








  What is a practical use for XML? What kind of situation would call for
 using it?



  


  From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Andrew
Powell
  Sent: Monday, January 01, 2007 8:54 PM
  To: discussion@acfug.org
  Subject: Re: [ACFUG Discuss] XML  CF

  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

Re: [ACFUG Discuss] XML CF

2007-01-02 Thread Teddy Payne

I need to chime in here.  Charlie has given me this PDF in the past and I
have used the sample code in it more than once now.  It is a great and quick
read.  The types of examples are exactly what you need half the time.

Teddy


On 1/2/07, Charlie Arehart [EMAIL PROTECTED] wrote:


 MCG, your initial explorations with XML and CF are not unusual. You've
gotten some good tips here so far. I'd like to offer a couple more--and not
just for Mary-Catherine but for anyone learning to deal with XML in CF. It's
one of those topics where--especially if you're new to XML in general--I'd
argue one would NOT be well-served by just looking at/copying code snippets.
You really need to get it first or you'll end up chasing your tail.
Further, there are often many ways to do something (even more than what' s
been proposed here).

The best resource I ever found, and which really sparked an Aha! moment
for me when I first read it a few years ago, is Nate Weiss's 30-page
article:

http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf

It's a real page-turner. Seriously. :-) Don't let the 30 pages scare you
off. You'll come out of it after an hour or so with tremendous appreciation
for what XML processing in CFML is about, including tips and techniques that
you might have struggled with to learn on your own. It was actually a
chapter in the original CFMX version of the WACK book which he was permitted
to release online. A wonderful resource, and as timely now as when it was
first released.

To address the why would I want to bother that Chris raised, in addition
to Teddy's point about Flex, another is that Spry and indeed many Ajax
solutions also leverage XML. Also, often one is given a file to read,
whether for data interchange as Andy indicated or for reading a file already
on your computer, since so many tools (including CF) now use XML files for
configuration.

/Charlie
http://www.carehart.org/blog/



 --
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *
[EMAIL PROTECTED]
*Sent:* Tuesday, January 02, 2007 10:04 AM
*To:* discussion@acfug.org
*Subject:* Re: [ACFUG Discuss] XML  CF



I will be using CF to get things in and out, just not sure of the best
logic.  I'm been looking at the docs plus some other sites out there and
copying code snippets.  Hoping it will set up some of the page flow for
later on.  Come on, trying to learn stuff here. :)

mcg




  *Steven Ross [EMAIL PROTECTED]*
Sent by: [EMAIL PROTECTED]

01/02/2007 09:23 AM   Please respond to
discussion@acfug.org

   To
discussion@acfug.org  cc
  Subject
Re: [ACFUG Discuss] XML  CF




If you are faking something for demo data use WDDX, it will be a whole
lot easier to use in CF.

On 1/2/07, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 Like I said, for faking things for demo purposes (figured it would be
quick
 and dirty) and mom's little website (not much data).  :)

 mcg






 Teddy Payne [EMAIL PROTECTED]
 Sent by: [EMAIL PROTECTED]

 01/02/2007 09:02 AM

 Please respond to
  discussion@acfug.org


 To discussion@acfug.org

 cc

 Subject
  Re: [ACFUG Discuss] XML  CF





 XML is typicaly there for storage of information in a homogenous way.
  John's suggestion of WDDX makes short hand of CFML constructs and is
 adaptable to JS and XML format.

 XML is used for configuration files, datasources and webservices just as
a
 couple of examples.

 A lot of Flex examples use XML as a way to have a datasource for demo
code
 without needing a remote call.

 If the test is for demo only, XML datasources work nicely.

 Teddy


 On 1/2/07, [EMAIL PROTECTED] 
 [EMAIL PROTECTED] wrote:

  For this project, a) I'm learning it, b) figured it would be easier to
deal
 with than creating a database and dealing with the ISP.  But for another
 project, I'm looking at using it for faking that a prototype is working
for
 demo purposes - namely because the database is REALLY complex.

  mcg








 Chris C. Cooper [EMAIL PROTECTED] 
  Sent by: [EMAIL PROTECTED]

 01/02/2007 08:40 AM


 Please respond to
  discussion@acfug.org




 To discussion@acfug.org

 cc

 Subject RE: [ACFUG Discuss] XML  CF








  What is a practical use for XML? What kind of situation would call for
 using it?



  


  From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Andrew
Powell
  Sent: Monday, January 01, 2007 8:54 PM
  To: discussion@acfug.org
  Subject: Re: [ACFUG Discuss] XML  CF

  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

RE: [ACFUG Discuss] XML CF

2007-01-02 Thread Chris C. Cooper
Thanks for this, I'll spend some time reading..

 

 

 

 

 http://www.cooperebusiness.com/ 
-

Chris C. Cooper

Cooper e.Business Solutions

Atlanta, Georgia 
404.691.4816

 

Cooper e.business Solutions - http://www.cooperebusiness.com
http://www.cooperebusiness.com/ 

 

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charlie Arehart
Sent: Tuesday, January 02, 2007 10:37 AM
To: discussion@acfug.org
Subject: RE: [ACFUG Discuss] XML  CF

 

MCG, your initial explorations with XML and CF are not unusual. You've
gotten some good tips here so far. I'd like to offer a couple more--and not
just for Mary-Catherine but for anyone learning to deal with XML in CF. It's
one of those topics where--especially if you're new to XML in general--I'd
argue one would NOT be well-served by just looking at/copying code snippets.
You really need to get it first or you'll end up chasing your tail.
Further, there are often many ways to do something (even more than what' s
been proposed here).

 

The best resource I ever found, and which really sparked an Aha! moment for
me when I first read it a few years ago, is Nate Weiss's 30-page article:

 

http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf

 

It's a real page-turner. Seriously. :-) Don't let the 30 pages scare you
off. You'll come out of it after an hour or so with tremendous appreciation
for what XML processing in CFML is about, including tips and techniques that
you might have struggled with to learn on your own. It was actually a
chapter in the original CFMX version of the WACK book which he was permitted
to release online. A wonderful resource, and as timely now as when it was
first released.

 

To address the why would I want to bother that Chris raised, in addition
to Teddy's point about Flex, another is that Spry and indeed many Ajax
solutions also leverage XML. Also, often one is given a file to read,
whether for data interchange as Andy indicated or for reading a file already
on your computer, since so many tools (including CF) now use XML files for
configuration.

 

/Charlie
http://www.carehart.org/blog/  

 

 

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, January 02, 2007 10:04 AM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] XML  CF


I will be using CF to get things in and out, just not sure of the best
logic.  I'm been looking at the docs plus some other sites out there and
copying code snippets.  Hoping it will set up some of the page flow for
later on.  Come on, trying to learn stuff here. :) 

mcg 






Steven Ross [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED] 

01/02/2007 09:23 AM 


Please respond to
discussion@acfug.org


To

discussion@acfug.org 


cc

 


Subject

Re: [ACFUG Discuss] XML  CF

 


 

 




If you are faking something for demo data use WDDX, it will be a whole
lot easier to use in CF.

On 1/2/07, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 Like I said, for faking things for demo purposes (figured it would be
quick
 and dirty) and mom's little website (not much data).  :)

 mcg






 Teddy Payne [EMAIL PROTECTED]
 Sent by: [EMAIL PROTECTED]

 01/02/2007 09:02 AM

 Please respond to
  discussion@acfug.org


 To discussion@acfug.org

 cc

 Subject
  Re: [ACFUG Discuss] XML  CF





 XML is typicaly there for storage of information in a homogenous way.
  John's suggestion of WDDX makes short hand of CFML constructs and is
 adaptable to JS and XML format.

 XML is used for configuration files, datasources and webservices just as a
 couple of examples.

 A lot of Flex examples use XML as a way to have a datasource for demo code
 without needing a remote call.

 If the test is for demo only, XML datasources work nicely.

 Teddy


 On 1/2/07, [EMAIL PROTECTED] 
 [EMAIL PROTECTED] wrote:

  For this project, a) I'm learning it, b) figured it would be easier to
deal
 with than creating a database and dealing with the ISP.  But for another
 project, I'm looking at using it for faking that a prototype is working
for
 demo purposes - namely because the database is REALLY complex.

  mcg








 Chris C. Cooper [EMAIL PROTECTED] 
  Sent by: [EMAIL PROTECTED]

 01/02/2007 08:40 AM


 Please respond to
  discussion@acfug.org




 To discussion@acfug.org

 cc

 Subject RE: [ACFUG Discuss] XML  CF








  What is a practical use for XML? What kind of situation would call for
 using it?



  


  From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Andrew
Powell
  Sent: Monday, January 01, 2007 8:54 PM
  To: discussion@acfug.org
  Subject: Re: [ACFUG Discuss] XML  CF

  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

RE: [ACFUG Discuss] XML CF

2007-01-02 Thread Charlie Arehart
Well, like I said, don't let the 30 pages scare you off. If you need (or
want) to work with XML in CFML, just start reading the first few pages. That
will give you great insight in and of itself. I just can't say enough about
it. (Thanks, Teddy, for chiming in. And Chris, I wish you well with it
also.)
 
/Charlie
http://www.carehart.org/blog/  

 


  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, January 04, 2007 12:56 PM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] XML  CF



Good to hear.  Already printed out and plan on reading it in my 'spare'
time.  Hmmm, maybe I should just put a meeting with myself in Notes.. 

mcg 




-
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
-

attachment: image002.jpg


RE: [ACFUG Discuss] XML CF

2007-01-01 Thread John Mason
If you have control over the xml format, I would suggest just using the wddx
tags to save and call up query info in a xml format that wddx uses.
 
John
[EMAIL PROTECTED]
 
 

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, January 01, 2007 8:13 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] XML  CF


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=gin.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
-




-
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
-



smime.p7s
Description: S/MIME cryptographic signature


RE: [ACFUG Discuss] XML CF

2007-01-01 Thread John Mason
If you have control over the xml format, I would suggest just using the wddx
tags to save and call up query info in a xml format that wddx uses.
 
John
[EMAIL PROTECTED] blocked::mailto:[EMAIL PROTECTED] 

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, January 01, 2007 8:13 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] XML  CF


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=gin.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
-




-
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
-



Re: [ACFUG Discuss] XML CF

2007-01-01 Thread Andrew Powell

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
-




Re: [ACFUG Discuss] XML CF

2007-01-01 Thread Andrew Powell

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
-