473,320 Members | 1,535 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,320 software developers and data experts.

blank lines screwing up XMLDocument object

I have an XMLDocument object that is attempting to parse an xml document
generated by a cold fusion page. The problem is that for some reason the cold
fusion page is generating a number of carriage returns preceding the XML
declaration. This is causing the following error:

System.Xml.XmlException: The XML declaration is unexpected. Line 80,
position 3. at System.Xml.XmlTextReader.ParseTag() at
System.Xml.XmlTextReader.ParseRoot() at System.Xml.XmlTextReader.Read() at
System.Xml.XmlValidatingReader.ReadWithCollectText Token() at
System.Xml.XmlValidatingReader.Read() at
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at
System.Xml.XmlDocument.Load(String filename) at
ASP.MessageBuilder_aspx.Page_Load(Object Sender, EventArgs E) in
C:\Inetpub\wwwroot\printmanager\helpercomponents\m essagebuilder.aspx:line 32

Is there any way to make the XmlDocument object ignore these carriage
returns? I've tried (to no avail) to make coldfusion suppress them. I've
tried setting "preservewhitespace" to true but it doesn't recognize carriage
returns. Line of code generating the error is:

objMessageToSend.Load("http://192.168.1.13/SCR4/PrintManagerGateWay.cfm?AgreementId=1152074")
Mar 15 '06 #1
2 4296


Glenn Venzke wrote:
I have an XMLDocument object that is attempting to parse an xml document
generated by a cold fusion page. The problem is that for some reason the cold
fusion page is generating a number of carriage returns preceding the XML
declaration. This is causing the following error:

System.Xml.XmlException: The XML declaration is unexpected. Line 80,
Is there any way to make the XmlDocument object ignore these carriage
returns?


I don't think so, there are no line breaks allowed before the XML
declaration, otherwise the markup is not well-formed XML at all and any
XML parser has to reject it.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 16 '06 #2
Glenn Venzke wrote:
I have an XMLDocument object that is attempting to parse an xml document
generated by a cold fusion page. The problem is that for some reason the cold
fusion page is generating a number of carriage returns preceding the XML
declaration. This is causing the following error:
Indeed it would. White-space before the XML Declaration is prohibited
by the Spec.

[snip] Is there any way to make the XmlDocument object ignore these carriage
returns? I've tried (to no avail) to make coldfusion suppress them.


Sounds like CF has a bug. The temporary way round it would be to pass
the document through a little script that eats all white-space before
the first <?

///Peter
Mar 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Melissa | last post by:
Does anyone have a generic procedure for adding blank lines to reports like Sales details, PO details and/or Orders details. The procedure would need to count the number of line items, determine...
5
by: Tom | last post by:
How can I find the first blank control on a form by looking at the controls in the order of their tab order? Thanks! Tom
5
by: Hareth | last post by:
How can I read lines from an XML file. & add them to a counter. If possible, words between <page> <\page> is considered as +1 to my counter. if it isnt possible, I would atlest like to read...
5
by: Bob P | last post by:
I have an example below that is not working correctly. I have a web application that passes a System.Xml.XmlDocument object "oInputDoc" around to functions byval. I do not want the "oInputDoc"...
2
by: John Smith | last post by:
I'm writing webervice client using .Net 2.0. I have this class: public class MyWebService : SoapHttpClientProtocol { public XmlDocument validate(string url, XmlDocument xmlDocument) {...
0
by: Ewan Fairweather | last post by:
Hi, I'm generating the below XML in c# for an asp.net application When i've generated this XML the <LaboratoryDetails xmlns=""> element has a blank xmlns set. How do i either a) remove this...
1
by: Ewan Fairweather | last post by:
Hi, I'm generating the below XML in c# for an asp.net application When i've generated this XML the <LaboratoryDetails xmlns=""> element has a blank xmlns set. How do i either a) remove this...
2
by: Lore Leunoeg | last post by:
Hello I'm using c# XmlDocument class to add new XHTML-Nodes to my website. Unfortunately XmlDocument always adds an unwanted empty namespace attribute xmlns="" to every new Element. These empty...
25
by: tmallen | last post by:
I'm parsing some text files, and I want to strip blank lines in the process. Is there a simpler way to do this than what I have here? lines = filter(lambda line: len(line.strip()) 0, lines) ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.