Solved

xmlparse - Premature end of file

Posted on 2007-04-04
4
2,715 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unsearchable in Google,Yahoo and Bing. 6 60
Asp.net plan security, reliable, stable 2 119
listing all functions in JavaScript 19 201
change time in cron 4 78
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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