Solved

xmlparse - Premature end of file

Posted on 2007-04-04
4
2,739 Views
Last Modified: 2013-12-24
Hello Experts,

I'm building a page to send XML data using (<cfhttp method="post") and expecting a reply back to the same .cfm page, the sending part if working fine, it's the receiving part that is not working.  Here is my code to "wait for" and parse the reply:

<cfset x = GetHttpRequestData()>
<cfset xmldata = xmlparse(x.content)>

When I execute the .cfm page, I get the following error:

An error occured while Parsing an XML document.
Premature end of file.

Thanks,

Anthony
0
Comment
Question by:aescribens
  • 3
4 Comments
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 18857768
A quick search of Google shows that this is usually a misformatted XML document or one with special characters in it.  Can you dump x.content, make sure it's valid, and perhaps even dump into a text file that you could look at with an XML viewer (if even just your browser) to see what's up?
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 18857809
you might want to try


<cfif isxmldoc(x.content)>
<cfset xmldata = xmlparse(x.content)>
<cfelse>
Not ValidXML
</cfif>

to see if you are getting a proper xml doc back


0
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 18857834
also if you are building the xml doc, make sure any place there might be special characters (& is the most common offender) use CDATA of use the replace technique as outlined here http://www.w3schools.com/xml/xml_cdata.asp on your source xml file
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 18857837
err... use CDATA OR use
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question