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

Extra white-space after page proccess

Guest
Nov 04, 2006 Nov 04, 2006

Copy link to clipboard

Copied

I am trying to suppress white-spaces after the page is processed.
Usually it doesn't bother me, but it does bother javascript.

Explanation:
1. I am sending an xmlhttp request to coldfusion to process.
2. Coldfusion runs a stored procedure on an oracle database that returns the results as XML.
3. Coldfusion returns the XML back to the client: <cfoutput>#XmlParse(ajaxXML)#</cfoutput>.
4. The client (Javascript) runs the function that handle the data and returns an error because: " xml declaration not at start of external entity".

I have tried using cfsetting with the attribute: enablecfoutputonly="yes", but still the result is the same.

Any idea or lead in the right direction would be greatly appreciated.
TOPICS
Advanced techniques

Views

373

Translate

Translate

Report

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

correct answers 1 Correct answer

Advisor , Nov 06, 2006 Nov 06, 2006
If that really is the content of ajaxXML, then the code above and cfcontent should fix the problem.

Like so:

<CFCONTENT reset="yes">
<CFOUTPUT>#Trim (ajaxXML)#</CFOUTPUT>
<CFABORT> <!--- Display nothing else. --->


Votes

Translate

Translate
Advisor ,
Nov 04, 2006 Nov 04, 2006

Copy link to clipboard

Copied

It sound like the javascript wants XML, not a parsed data structure. Don't use XmlParse here.

Use: <cfoutput>#Trim (ajaxXML)#</cfoutput>

You can additionally use CFContent to wipe previous output but it is better not to output anything extra in the first place.

Votes

Translate

Translate

Report

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
Guest
Nov 05, 2006 Nov 05, 2006

Copy link to clipboard

Copied

Ive tried that, I am trying everything I can think of, but still did not get the result I am aiming for.
I'm sure there is something I am missing here.

Any idea would be greatly appreciated.

Thanks again.

Votes

Translate

Translate

Report

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
Advisor ,
Nov 05, 2006 Nov 05, 2006

Copy link to clipboard

Copied

You are going to have to supply more details.

For starters, post the xml exactly as the stored procedure returns it.

Votes

Translate

Translate

Report

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
Guest
Nov 06, 2006 Nov 06, 2006

Copy link to clipboard

Copied

The XML that the DB returns, looks like this:

<?xml version="1.0"?>
<rowset>
<row>
<column_name>value</column_name>
<column_name>value</column_name>
....
</row>
</rowset>

After playing with code for a while now, I believe that the problem is not with the returned XML.
The page that runs the SP is the page that call the SP. What means that the white-spaces are the code that the Coldfusion engine has already processed (although, the condition that checks whether the form variable that Ajax request, exist. Is the first thing on the page). to my understanding, the returned XML should be at the top of the page.

I hope that I was clear enough.
Thank you.

Votes

Translate

Translate

Report

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
Advisor ,
Nov 06, 2006 Nov 06, 2006

Copy link to clipboard

Copied

If that really is the content of ajaxXML, then the code above and cfcontent should fix the problem.

Like so:

<CFCONTENT reset="yes">
<CFOUTPUT>#Trim (ajaxXML)#</CFOUTPUT>
<CFABORT> <!--- Display nothing else. --->


Votes

Translate

Translate

Report

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
Guest
Nov 07, 2006 Nov 07, 2006

Copy link to clipboard

Copied

LATEST
Thank you very much :)
Works great.

Votes

Translate

Translate

Report

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
Documentation