Skip to main content
November 11, 2008
Answered

XmlValidate() - Content is not allowed in prolog

  • November 11, 2008
  • 1 reply
  • 1557 views
I posted in another thread but I believe the issue described there is resolved so I am starting a new thread with this new issue.

XmlValidate always returns "Content is not allowed in prolog" I searched this forum and google and I did see where this problem was resolved for some. It appears that the most common cause was a hidden character (BOP I believe) in the file. However, I have verified that my xml does not have that in it.
I am at a loos as to how to proceed. I am hoping someone out there has seen this and fixed it. I need some serious help.
This topic has been closed for replies.
Correct answer
quote:

Originally posted by: Newsgroup User
How did you verify this?



I ran some very helpful code from Ben Nadel at http://www.bennadel.com/index.cfm?dax=blog:1206.view that basically gets the first few characters of the parsed xml and outputs them with Asc(). After running that code I had no extra characters in there.

I did sort out this issue though. I had quotes around the first parameter:
<CFSET errorStructure = XmlValidate("xmlObject", " http://www.myserver.com/MyXsd.xsd")>. When I removed the quotes the "Content is not allowed in prolog" error went away but I came back to the original problem I reported about in another thread. Namely, the code would run for about 30 seconds and then a JRun Servlet Error is returned with "500 null" on the page.
It turns out THAT issue was because I had <xs:include schemaLocation="DocumentCommon.xsd"/> in the xsd file being called in XmlValidate. Once I copied and pasted the code in DocumentCommon.xsd into the called xsd, replacing the <xs:include schemaLocation>, it worked.

Very frustrating.


1 reply

Inspiring
November 12, 2008
> It
> appears that the most common cause was a hidden character (BOP I believe) in
> the file. However, I have verified that my xml does not have that in it.

How did you verify this?

--
Adam
Correct answer
November 12, 2008
quote:

Originally posted by: Newsgroup User
How did you verify this?



I ran some very helpful code from Ben Nadel at http://www.bennadel.com/index.cfm?dax=blog:1206.view that basically gets the first few characters of the parsed xml and outputs them with Asc(). After running that code I had no extra characters in there.

I did sort out this issue though. I had quotes around the first parameter:
<CFSET errorStructure = XmlValidate("xmlObject", " http://www.myserver.com/MyXsd.xsd")>. When I removed the quotes the "Content is not allowed in prolog" error went away but I came back to the original problem I reported about in another thread. Namely, the code would run for about 30 seconds and then a JRun Servlet Error is returned with "500 null" on the page.
It turns out THAT issue was because I had <xs:include schemaLocation="DocumentCommon.xsd"/> in the xsd file being called in XmlValidate. Once I copied and pasted the code in DocumentCommon.xsd into the called xsd, replacing the <xs:include schemaLocation>, it worked.

Very frustrating.