473,605 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 10229
acoder
16,027 Recognized Expert Moderator MVP
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
1412
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: org.xml.sax.SAXParseException: Content is not allowed in prolog. The xml is: <?xml version="1.0"?> <message sender="sadasdssad" dateSent="Feb 26, 2004 3:55:24 PM CST">
5
2733
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 render as best as they can elements (and/or attribute too? can't remember) that they ignore. e.g.: I know that fieldset will be rendered as a block level element in NS 4.7+, almost just like div.
10
26191
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
3749
by: Hang Cheng | last post by:
I've been trying to parse the following XML file with the .NET XMLTextReader: <?xml version="1.0"?><level1><level2><level3>Test</level3><level3>Test2</level3></level2><level2><level3>Test</level3><level3>Test2</level3><level3><level4>TEST<level5>TEST5</level5>TESTP</level4><level4>Test4</level4></level3></level2></level1> However, the resulting output does not seem to make any sense: Start Element: level1 @ 0 Start Element: level2 @ 1...
1
2022
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. SQLSTATE=07006 DXXM001W A DB2 error occurred. DXXG001E An internal error occured in build "Jun 16 2004/20:55:58", file
3
1694
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() { try { javax.xml.transform.dom.DOMResult domresult=new
7
2605
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
3408
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 with moderate success using Saxon and <xsl:result-document>, but Saxon is throwing an error and I don't know how to resolve it. Maybe someone can offer some advice? This is a long question, for which I apologise... OS= Windows XP Pro, Saxon=8.8 XML...
3
7210
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
8428
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8423
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8076
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8290
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6749
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5446
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3960
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1546
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.