473,387 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

An error occured while Parsing an XML document: Content is not allowed in prolog

2
I need to retrieve some data from an xml document using a web server, it's not working so I took out everything that was not necessary and put everything back line by line until I hit the problem, I found out which line was causing the problem and so I've created a cfm to test it and it gets the error " Content is not allowed in prolog." Here's the test file:

Expand|Select|Wrap|Line Numbers
  1. <cfsilent>
  2.     <cfset xmlFileAddress = Expandpath("XMLcoursework.xml")>
  3.     <cffile action="READ" file="#xmlFileAddress#" variable="xmlObject">    
  4.     <cfset xmlDOM = "XMLParse(#xmlObject#)">
  5.  
  6.     <cfset goalsForEXP = "//team[@id='1']/gf">
  7.     <cfset goalsFor = XmlSearch(#xmlDOM#, #goalsForExp#)>
  8.  
  9. </cfsilent>
  10.  
  11. <html>
  12.     <head></head>
  13.     <body>
  14.         <cfoutput>#goalsFor#</cfoutput>
  15.     </body>
  16. </html>
This line is causing the problem and I'm not sure why:

Expand|Select|Wrap|Line Numbers
  1. <cfset goalsFor = XmlSearch(#xmlDOM#, #goalsForExp#)>
I have opened the xml file and its accompanying xsd file in a hex editor and there are no characters before

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
The xml and xsd files are both valid, I have tried dumping my xml onto the screen and that works fine, tried various different encodings, I have tried with diferent xpath expressions incase it was that, still the same error, I am new to this and completely stumped at this point, please somebody help me before I go crazy!
Dec 18 '07 #1
1 10210
acoder
16,027 Expert Mod 8TB
Try
Expand|Select|Wrap|Line Numbers
  1. <cfset xmlDOM = "XMLParse(ToString(xmlObject))">
If that doesn't work, try saving using an editor with no formatting, e.g. Notepad.
Dec 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dan | last post by:
Hi, I've just installed Xerces 2.5 to try and use SAX to parse some xml (was having problems before). Now every time I attempt to parse, I'm getting the following:...
5
by: DU | last post by:
Hi! I really need to understand what is so-called browser error correction mechanisms. Can you explain this? I read somewhere (and I no longer can find where I read that) that browsers try to...
10
by: Richard R Plourde | last post by:
Well, the error message... "Please, validate your XML document first! Line 1 Column 1 Content is not allowed in prolog." comes up when I try to verify my CSS...
1
by: Hang Cheng | last post by:
I've been trying to parse the following XML file with the .NET XMLTextReader: <?xml...
1
by: Silke Stuehler | last post by:
I have a problem while colling the dxxGenXML() method. I got the following error: SQL0301N The value of input host variable or parameter number "1" cannot be used because of its data type. ...
3
by: moralbarometer | last post by:
Please i intend to make an XML document from a string using tranformer as shown below. It returns an error which trace is given below as well. please help. public org.w3c.dom.Node getTextXML()...
7
by: Daniel | last post by:
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document?
5
by: jhurrell | last post by:
I have been having some trouble getting my XSL style sheet to parse correctly. I have some XML outputted from an SQL-Server, that I then need to turn into multiple HTML files. This I have done...
3
by: gadour | last post by:
do you have a solution to this problem <cfset monxml=xmlparse(tempfile)> An error occured while Parsing an XML document.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.