5 Replies Latest reply on Oct 27, 2006 8:15 AM by Stefan_K.

    CF inside XML

    BeniRose Level 1
      I've been running into walls with a similar problem of executing CF from a database recordset for years, and now I'm trying to do something similar with XML. What I have is an XML file with CFML inside the CDATA of my tag. There is also some html I want to be displayed. I can't seem to get the CFML executed it. I was thinking of using evaluate() but that will try to execute all my html as variables or something. Is there some sort of executeCF() function or something I could use to only process the CF in a variable. Or is there some attribute of the XML object that will switch on CF interpretation? All I'm trying to do is set some variables in my XML, so it's not any heavy duty stuff. I could possibly write a RE, but I was wondering if there was a cover all solution. Thanks in advance!

        • 1. Re: CF inside XML
          Stefan_K. Level 1
          Write query-data to a file on HD.
          Include file.
          Delete file.
          • 2. Re: CF inside XML
            BeniRose Level 1
            I think that was a solution I had come up with about 4 years ago when I was trying to do the same thing with database queries, but I comepletely forgot about it. Is that gonna make my server extremely vulnerable using CFFile everytime do anything involving a query. Forget vulnerable, how much will that slow things down if I have a loop of queries? Luckily, I only have one per page this time, but what about future situations? Either way, thank you very much for your reply. Whenever I have a problem that's got me banging my head on my desk, I always goto you guys!
            • 3. Re: CF inside XML
              Stefan_K. Level 1
              Overall it is a sub-ideal way.

              - No file (compiled-code) caching by CF.
              - File-writing can be rather slow on VirtualMachine-servers.

              Better write the files to disc from start and only save the file-name/path in DB.
              <cfinclude template="#myQuery.myFile#">
              • 4. Re: CF inside XML
                BeniRose Level 1
                I'm suprised Ben Forta's never gone "hmm, I wonder if we can create a tag so we can execute cf code from a variable". I mean we have evaluate, but that will treat every word in my variable as a variable itself. We need like an "execute()" or something. Maybe I can take a month off and develop it or something =D
                • 5. Re: CF inside XML
                  Stefan_K. Level 1
                  Creating a tag or UDF-function that does the write-File -> include file -> delete-file is rather simple, a matter of 15 minutes or so!

                  But as mentioned I'd consider it bad practice ...