Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default XML File creation

    I am generating xml output from a cfquery.
    <cfxml variable="Contact" casesensitive="yes">
    <Contact>
    <cfoutput query="GetName">
    <phonenum phone="#Phone#">
    <first>#FirstName#</first>
    <last>#LastName#</last>
    </phonenum>
    </cfoutput>
    </Contact>
    </cfxml>
    <cfoutput>#Contact#</cfoutput>
    When I use cfdump on the variable contact everythings seems perfect.
    However <cfoutput>#Contact#</cfoutput> returns
    coldfusion.xml.XmlNodeList@1497dd2 and that is about all.
    There should be a nice xml file with about 15 entries and there is nothing at
    all?
    Writing the file to the server returns exactly the same thing. What am I doing
    wrong.

    javman Guest

  2. Similar Questions and Discussions

    1. File creation problems
      Hi, I'm pretty new at writing extensions so I'm quite certain my problem is a mistake on my part. I've written a piece of code that takes a data...
    2. STC file creation automation
      Is there a way to automate the creation of STC files? We find creating connection keys for our clients to be too much work, and it would be nice to...
    3. Automated CAR file creation?
      Is their a way to automate CAR file creation? Thanks, ==Sci
    4. file creation & variables
      I have a .cfm page that uses cffile to copy itself with the dynamic form content to create the new .cfm file. It works fine and creates the file....
    5. Waiting file creation
      Looking for insight on how I can wait until a file is created until I redirect to it...
  3. #2

    Default Re: XML File creation

    "Contact" is an xml document variable, not a simple string. Use 'toString' to get the string representation.

    <cfoutput>#toString(Contact)#</cfoutput>
    BSterner Guest

  4. #3

    Default Re: XML File creation

    I appreciate the reply and suggestion but that did not make any difference at all. the output is the same as before.
    javman Guest

  5. #4

    Default Re: XML File creation

    The output to what, the screen, the file or both? Your cffile output should
    look like...

    <cffile file="#GetDirectoryFromPath(ExpandPath("*.*"))#\de lete.xml"
    output="#toString(Contact)#" action="write" />

    Can you post the exact code you are using. I tried this several times and it
    worked fine. What version of CF r u using?

    BSterner Guest

  6. #5

    Default Re: XML File creation

    I kept working on this and you did have the answer. Many thanks.
    I think the old failing results must have been cached by my browser.
    I changed the code a little bit to
    <cfset XMLContact=ToString(Contact)>
    and reloaded the page, closed my browser and went online again and everything
    worked fine.

    javman Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139