Solved

xmlparse - Premature end of file

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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 …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now