Skip to main content
Inspiring
November 1, 2009
Question

Copy from XML.

  • November 1, 2009
  • 2 replies
  • 443 views

The point is that all I need is simply to copy text from the XML file from another server. I can copy whatever i want from the XML file on my server but when i try to copy from rss feed(news)  from another site i get an error message.

code:

<cffile action="read" file="C:\order-test.xml" variable="myxml">
<cfset mydoc = XmlParse(myxml)>

<cfset accountNum=#mydoc.order.customer.XmlAttributes.accountNum#>

<cfoutput>
   <b>Name=</b>#mydoc.order.customer.XmlAttributes.firstname#
        #mydoc.order.customer.XmlAttributes.lastname#
   <br>
   <b>Account=</b>#accountNum#
   <br>
   <cfset numItems = ArrayLen(mydoc.order.items.XmlChildren)>
   <b>Number of items ordered=</b> #numItems#
</cfoutput>

problem is here, in first line. if i change path to file="http://www.somesite.com/news1.xml" I get an error message.

note: xml (http://www.somesite.com/news1.xml) file can be loaded from the browser.

error message:

An error occurred when performing a file operation read on file
C:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\http://www.somesite.com/news1.xml.

The cause of this exception was: java.io.FileNotFoundException:
C:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\http://www.somesite.com/news1.xml
(The filename, directory name, or volume label syntax is incorrect).

what I do wrong?

    This topic has been closed for replies.

    2 replies

    pirula08Author
    Inspiring
    November 2, 2009

    Thanks

    Inspiring
    November 1, 2009

    <cffile action="read" file="C:\order-test.xml"

    problem is here, in first line. if i change path to

    file="http://www.somesite.com/news1.xml"

    CFFILE is for manipulating local files on your server. If you need to read a file from an external server use CFHTTP.

    http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_g-h_09.html