Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Copy from XML.

Explorer ,
Nov 01, 2009 Nov 01, 2009

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?

415
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 01, 2009 Nov 01, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2009 Nov 02, 2009
LATEST

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources