Re: Problem reading in XML

2008-12-05 Thread daniel kessler
May I ask why you are ditching the xml declaration before parsing the
xml? Ie. these lines:

cfset nodeToReplace = mid(XMLText, 1, evaluate(find(?, XMLText) + 1))
cfset XMLText = replaceNoCase(XMLText, nodeToReplace, , ALL)

I only had those lines in because I had copied the code from another batch that 
had them.  I'm unfamiliar with this area.  Since I can leave them out, I will.

However, the problem is still there.  I still get the error.  Did you get it?  
It's pretty consistent for me across browsers and platforms.  When I refresh, 
it doesn't occur.
Here's an example of the URL it's using:
http://sphumd.blogspot.com/feeds/posts/default/6200705617846171475

When I paste that into Firefox, instead of viewing the file, it asks to 
download it and displays it as type application/atom+xml.  Is that some 
indicator of the problem?  As I said, I'm unfamiliar with this area, so I'm not 
sure which information is useful here for debugging.
When I request information from this address, it just displays in firefox 
(http://www.blogger.com/feeds/1550840680584738668/posts/default?published-min=2008-11-21T00:00:00published-max=2008-12-05T23:5:59).

Maybe I need the information to not come back application/atom+rss?  I dunno.

Any additional help is much appreciated.

daniel 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316323
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Problem reading in XML

2008-12-05 Thread daniel kessler
Additionally, the file comes in with no file extension.  If I save out the file 
and copy it to my server, view it with firefox, it shows the internal data no 
problem.  Is this a mime-type issue?  And if so, is there anything I can do 
about that?  Yeah, I'm reaching at this point.

Here's the saved-out-to-my-server file:
http://sph.umd.edu/news/6200705617846171475

It might not be the exact same file but it's the same issue.

Oh also, I tried setting getAsBinary to 'no' but that didn't do it.


daniel 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316325
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Problem reading in XML

2008-12-05 Thread Dominic Watson
Hm, it certainly sounds like it could be a mime-type issue. However,
the following works for me without hitch (using CF8.1 on Windows
Server 2003 w/ IIS 6):

cfset parsed =
XmlParse(http://sphumd.blogspot.com/feeds/posts/default/6200705617846171475;)
/
cfdump var=#parsed#

Are you on CF7?

Dominic

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316327
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Problem reading in XML

2008-12-05 Thread daniel kessler
sorry if this comes through multiple times, I had problems posting.

Are you on CF7?

I'm on CF 7.02.  I don't know if that'd be the difference.

 cfset parsed =
XmlParse(http://sphumd.blogspot.com/feeds/posts/default/6200705617846171475;)
/
 cfdump var=#parsed#

yeah, that worked fine for me too the first time.
ok, wait, hmm - I think I have it!  I noticed that you weren't doing the cfhttp 
at all.  I didn't realize that at first.  I didn't realize that xmlParse can 
read in the document too.  I thought it only parsed it into an xml document.

I eliminated the cfhttp and I've not been able to reproduce the error since.  
yy!  However (dangit), I notice that now the text is coming in with 
characters no longer interpreted that were previously fine with cfhttp.
The quotes are no longer working fine for this
http://sph.umd.edu/news/blog2.cfm?postID=9205167574356286735
Check out all the question marks for unknown characters.  I suppose I can 
understand why, though not really.

Is this expected?

And thank you.

daniel


daniel 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316331
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Problem reading in XML

2008-12-05 Thread Dominic Watson
How frustrating, there's clearly a character encoding issue with using
XmlParse in this way (I see it too in CF8). I have no problems using
cfhttp with CF8 though.

Here's a long shot - revert back to cfhttp and try writing to file
before parsing (clearly horrid but may be it'll work):

cfhttp url=http://sphumd.blogspot.com/feeds/posts/default/9205167574356286735;
resolveurl=no timeout=120 /
cffile action=write file=#ExpandPath('temp.xml')#
output=#cfhttp.filecontent# /
cfset parsed = XmlParse( ExpandPath('temp.xml') ) /

The original trouble may be that application/atom+xml mime type... and
yeh, you can pass in a full file path to XmlParse too :)

Dominic

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316332
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Problem reading in XML

2008-12-05 Thread daniel kessler
Here's a long shot - revert back to cfhttp and try writing to file
before parsing (clearly horrid but may be it'll work):

No, not sure why but that didn't test out.  Looked good at first, but  I 
started receiving the original error again on several posts.  sigh  It looks 
like what is suggested here:
http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funca125.htm#wp4280051

I tried this next bit of code, but it was telling me that the file wasn't found 
on the cffile(read).  I dunno why cause I could go to it.  It looks like I'm 
referencing it correctly:

cfhttp url=#the_id_post# resolveurl=no timeout=120 /
cffile action=write file=#ExpandPath('temp.xml')# 
output=#cfhttp.filecontent# /
cffile action=read file=#ExpandPath('tmp.xml')# variable=XMLFileText
 cfset parsed = XmlParse(XMLFileText) /

Maybe I can clean up the text somehow.  Is it that the file isn't read in as 
utf-8?

daniel 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316339
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Problem reading in XML

2008-12-05 Thread daniel kessler
Here's a long shot - revert back to cfhttp and try writing to file
before parsing (clearly horrid but may be it'll work):

No, not sure why but that didn't test out.  Looked good at first, but  I 
started receiving the original error again on several posts.  sigh  It looks 
like what is suggested here:
http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funca125.htm#wp4280051

I tried this next bit of code, but it was telling me that the file wasn't found 
on the cffile(read).  I dunno why cause I could go to it.  It looks like I'm 
referencing it correctly:

cfhttp url=#the_id_post# resolveurl=no timeout=120 /
cffile action=write file=#ExpandPath('temp.xml')# 
output=#cfhttp.filecontent# /
cffile action=read file=#ExpandPath('tmp.xml')# variable=XMLFileText
 cfset parsed = XmlParse(XMLFileText) /

Maybe I can clean up the text somehow.  Is it that the file isn't read in as 
utf-8?

daniel 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316340
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Problem reading in XML

2008-12-05 Thread daniel kessler
Weird thing to me is that the cfhttp/xmlparse combo works on an external file 
cffunction of someone else's that I'm using.

http://sph.umd.edu/includes/feedToQuery.txt

This is the original code that I used as an example.   I use it to read in all 
my other feeds just fine.

daniel 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316345
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Problem reading in XML

2008-12-04 Thread Daniel Kessler
http://sph.umd.edu/news/blog2.cfm

I am recreating a blog.  I am able to read in several xml files and  
populate the content.  To do this, I copied code from other  
functionality and it's using CFHTTP.   In the blog's functionality,  
I'm supposed to be able to click on the title of a posting to bring  
it up by itself, instead of with all the other posts.  I am having a  
problem only for that bit of functionality.  When I load a page the  
first  time and click on a posting, I receive the error:
Error An error occured while Parsing an XML document.  Content is  
not allowed in prolog.

If I then refresh the page that gave the error, it then loads fine -  
just not the first time.  The other times that I read in content,  
this doesn't happen.   I can go to other pages to find this error too  
by clicking on one of the archive months to the right.  That allows  
me to reproduce the error more often.

Here's the code that I'm using

cfhttp url=http://sphumd.blogspot.com/feeds/posts/default/ 
#url.postID# resolveurl=no timeout=120 /
cfset XMLText = cfhttp.fileContent /
cfset nodeToReplace = mid(XMLText, 1, evaluate(find(?, XMLText) +  
1))
cfset XMLText = replaceNoCase(XMLText, nodeToReplace, , ALL)
cfset parsed = XMLParse(XMLText)

The error is stating that it's having problems with the last line.   
This code is the same code that works on all the other times that I  
read in the data.

-- 

Daniel Kessler

University of Maryland College Park
School of Public Health
3302E SPH Building
College Park, MD  20742-2611
Phone: 301-405-2545
http://sph.umd.edu





~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316285
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Problem reading in XML

2008-12-04 Thread Dominic Watson
May I ask why you are ditching the xml declaration before parsing the
xml? Ie. these lines:

cfset nodeToReplace = mid(XMLText, 1, evaluate(find(?, XMLText) + 1))
cfset XMLText = replaceNoCase(XMLText, nodeToReplace, , ALL)

If you are on CF7 or greater, and there isn't a good reason to parse
out the xml declaration, you can do this:

cfset parsed= 
XmlParse(http://sphumd.blogspot.com/feeds/posts/default/#url.postId#;)
/

This never generates an error for me.

HTH

Dominic

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316290
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4