473,886 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error:An unexpected end of file parsing CDATA has occurred.

I am creating a XML document which opens fine in IE. Implies MSXML
thinks it is a well formed document.
But when I try to load this document in VB.net using the following
code
Dim doc As New XmlDocument
doc.Load("C:\Pr ojects\SQLXML\c orc.xml")

I get the following error:

"System.Xml.Xml Exception: An unexpected end of file parsing CDATA has
occurred. Line 6, position 1.
at System.Xml.XmlS canner.ScanCDat a()
at System.Xml.XmlS canner.ScanMark up()
at System.Xml.XmlT extReader.Parse Tag()
at System.Xml.XmlT extReader.Parse BeginTagExpandC harEntities()
at System.Xml.XmlT extReader.Read( )
at System.Xml.XmlV alidatingReader .ReadNoCollectT extToken()
at System.Xml.XmlV alidatingReader .Read()
at System.Xml.XmlL oader.LoadChild ren(XmlNode parent)
at System.Xml.XmlL oader.LoadEleme ntNode()
at System.Xml.XmlL oader.LoadCurre ntNode()
at System.Xml.XmlL oader.LoadChild ren(XmlNode parent)
at System.Xml.XmlL oader.LoadEleme ntNode()
at System.Xml.XmlL oader.LoadCurre ntNode()
at System.Xml.XmlL oader.LoadCurre ntNode()
at System.Xml.XmlL oader.LoadChild ren(XmlNode parent)
at System.Xml.XmlL oader.LoadEleme ntNode()
at System.Xml.XmlL oader.LoadCurre ntNode()
at System.Xml.XmlL oader.LoadDocSe quence(XmlDocum ent parentDoc)
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at System.Xml.XmlD ocument.Load(St ring filename)
at SQLXML.Form1.Bu tton4_Click(Obj ect sender, EventArgs e) in
C:\Projects\SQL XML\Form1.vb:li ne 211"

Here is my document.

<?xml version="1.0" encoding="utf-8" ?>
- <corc xmlns:sql="urn: schemas-microsoft-com:xml-sql"
xmlns="http://tempuri.org/corc.xsd">
- <item projectID="1918 2">
<JIFNumber>97-545-0100-S</JIFNumber>
<Title>PULSAR MAX II brochure (Spanish)</Title>
<Group>Brady</Group>
<Category>Produ ct brochure</Category>
- <Description>
- <![CDATA[
{\rtf1\ansi\ans icpg1252\deff0{ \fonttbl{\f0\fs wiss\fprq2\fcha rset0
Tahoma;}{\f1\fn il\fcharset0 Tahoma;}}
{\colortbl ;\red153\green5 1\blue102;}
\viewkind4\uc1\ pard\lang1033\b \f0\fs21 PULSAR MAX II brochure\b0\fs1 7
(\cf1\b Spanish\cf0\b0\ f1\par
}
]]>
</Description>
<ImageFileName> 97-545-0100-S.jpg</ImageFileName>
<scoutFeaturedI tem>0</scoutFeaturedIt em>
- <Characterictic >
<Characteristic ID>2</CharacteristicI D>
<Characterictic Value>flying</CharactericticV alue>
</Characterictic>
</item>
- <item projectID="1918 3">
<JIFNumber>99-919-901</JIFNumber>
<Title>Guidan t Notepad (OBSOLETE 7/02 - REPLACED WITH
M9-002-00)</Title>
<Group>CRM</Group>
- <Description>
- <![CDATA[ Guidant Notepad (OBSOLETE 7/02 - REPLACED WITH M9-002-00)
]]>
</Description>
<scoutFeaturedI tem>0</scoutFeaturedIt em>
</item>
- <item projectID="1918 4">
<JIFNumber>97-718-1102</JIFNumber>
<Title>CONTAK RENEWAL CD ROM</Title>
<Group>Heart Failure</Group>
- <Description>
- <![CDATA[ CONTAK RENEWAL CD ROM
]]>
</Description>
<scoutFeaturedI tem>0</scoutFeaturedIt em>
</item>
- <item projectID="1918 6">
<JIFNumber>99-940-102</JIFNumber>
<Title>NASPE 2002 Allied Professional Invitations</Title>
<Group>CRM</Group>
- <Description>
- <![CDATA[ NASPE 2002 Allied Professional Invitations
]]>
</Description>
<scoutFeaturedI tem>0</scoutFeaturedIt em>
</item>
</corc>
Any help would be appreciated.

Thanks
Nov 12 '05 #1
4 12011
sunil wrote:
I am creating a XML document which opens fine in IE. Implies MSXML
thinks it is a well formed document.
But when I try to load this document in VB.net using the following
code
Dim doc As New XmlDocument
doc.Load("C:\Pr ojects\SQLXML\c orc.xml")

I get the following error:

"System.Xml.Xml Exception: An unexpected end of file parsing CDATA has
occurred. Line 6, position 1.

That means you've got 0 (character with code 0) in the document. XML
spec doesn't allow characters with code less than x20 (except x9, xA,
xD) to be used within XML documents.

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #2
Oleg

Thanks for your response Oleg. But that doesn't seem to answer my
question. If there is a invalid character why doen't IE give me an
error.
Here is the query that I am using to create this doc. How do I fix
this error?
The data I am enclosing in the CData sections is RTF data.

Thanks
<?xml version="1.0" encoding="utf-8" ?>
<corc xmlns:sql="urn: schemas-microsoft-com:xml-sql"
xmlns="http://tempuri.org/corc.xsd">
<sql:query>
SELECT 1 as tag,
null as parent,
projectID as [item!1!projectI D],
JIFRANumber as [item!1!JIFNumbe r!element],
Title as [item!1!Title!el ement],
[Group] as [item!1!Group!el ement],
Category as [item!1!Category !element],
'&lt;![CDATA['+scoutDescript ion+']]&gt;' as [item!1!Descript ion!xml],
scoutImageFileN ame as [item!1!ImageFil eName!element],
scoutFeaturedIt em as [item!1!scoutFea turedItem!eleme nt],
null as [Audience!2!Audi enceID!element],
null as [Audience!2!Audi enceValue!eleme nt],
null as [Characterictic! 3!Characteristi cID!element],
null as [Characterictic! 3!Charactericti cValue!element]
FROM vwScoutCORCItem s

UNION ALL

SELECT 2,
1,
vwScoutCORCItem s.projectID,
vwScoutCORCItem s.JIFRANumber,
vwScoutCORCItem s.Title,
vwScoutCORCItem s.[Group],
vwScoutCORCItem s.Category,
'&lt;![CDATA[' + vwScoutCORCItem s.scoutDescript ion+']]&gt;' ,
vwScoutCORCItem s.scoutImageFil eName,
vwScoutCORCItem s.scoutFeatured Item,
SCOUT_ITEM_AUDI ENCE.AudienceID ,
SCOUT_AUDIENCE. AudienceValue,
null,
null
FROM SCOUT_ITEM_AUDI ENCE
INNER JOIN SCOUT_AUDIENCE ON SCOUT_ITEM_AUDI ENCE.AudienceID =
SCOUT_AUDIENCE. AudienceID
INNER JOIN vwScoutCORCItem s ON SCOUT_ITEM_AUDI ENCE.ItemID =
vwScoutCORCItem s.projectID

UNION ALL

SELECT 3,
1,
vwScoutCORCItem s.projectID,
vwScoutCORCItem s.JIFRANumber,
vwScoutCORCItem s.Title,
vwScoutCORCItem s.[Group],
vwScoutCORCItem s.Category,
'&lt;![CDATA['+vwScoutCORCIt ems.scoutDescri ption+']]&gt;' ,
vwScoutCORCItem s.scoutImageFil eName,
vwScoutCORCItem s.scoutFeatured Item,
NULL,
NULL,
SCOUT_WORD.Scou tWordID,
SCOUT_WORD.Word
FROM SCOUT_ITEMCHARA CTERISTIC
INNER JOIN vwScoutCORCItem s ON SCOUT_ITEMCHARA CTERISTIC.ItemI D =
vwScoutCORCItem s.projectID
INNER JOIN SCOUT_WORD ON
SCOUT_ITEMCHARA CTERISTIC.Scout CharacteristicI D =
SCOUT_WORD.Scou tWordID

Order by [item!1!projectI D],[Audience!2!Audi enceID!element]

for xml explicit

</sql:query>

</corc>

That means you've got 0 (character with code 0) in the document. XML
spec doesn't allow characters with code less than x20 (except x9, xA,
xD) to be used within XML documents.

Nov 12 '05 #3
Oleg

Thanks for your response Oleg. But that doesn't seem to answer my
question. If there is a invalid character why doen't IE give me an
error.
Here is the query that I am using to create this doc. How do I fix
this error?
The data I am enclosing in the CData sections is RTF data.

Thanks
<?xml version="1.0" encoding="utf-8" ?>
<corc xmlns:sql="urn: schemas-microsoft-com:xml-sql"
xmlns="http://tempuri.org/corc.xsd">
<sql:query>
SELECT 1 as tag,
null as parent,
projectID as [item!1!projectI D],
JIFRANumber as [item!1!JIFNumbe r!element],
Title as [item!1!Title!el ement],
[Group] as [item!1!Group!el ement],
Category as [item!1!Category !element],
'&lt;![CDATA['+scoutDescript ion+']]&gt;' as [item!1!Descript ion!xml],
scoutImageFileN ame as [item!1!ImageFil eName!element],
scoutFeaturedIt em as [item!1!scoutFea turedItem!eleme nt],
null as [Audience!2!Audi enceID!element],
null as [Audience!2!Audi enceValue!eleme nt],
null as [Characterictic! 3!Characteristi cID!element],
null as [Characterictic! 3!Charactericti cValue!element]
FROM vwScoutCORCItem s

UNION ALL

SELECT 2,
1,
vwScoutCORCItem s.projectID,
vwScoutCORCItem s.JIFRANumber,
vwScoutCORCItem s.Title,
vwScoutCORCItem s.[Group],
vwScoutCORCItem s.Category,
'&lt;![CDATA[' + vwScoutCORCItem s.scoutDescript ion+']]&gt;' ,
vwScoutCORCItem s.scoutImageFil eName,
vwScoutCORCItem s.scoutFeatured Item,
SCOUT_ITEM_AUDI ENCE.AudienceID ,
SCOUT_AUDIENCE. AudienceValue,
null,
null
FROM SCOUT_ITEM_AUDI ENCE
INNER JOIN SCOUT_AUDIENCE ON SCOUT_ITEM_AUDI ENCE.AudienceID =
SCOUT_AUDIENCE. AudienceID
INNER JOIN vwScoutCORCItem s ON SCOUT_ITEM_AUDI ENCE.ItemID =
vwScoutCORCItem s.projectID

UNION ALL

SELECT 3,
1,
vwScoutCORCItem s.projectID,
vwScoutCORCItem s.JIFRANumber,
vwScoutCORCItem s.Title,
vwScoutCORCItem s.[Group],
vwScoutCORCItem s.Category,
'&lt;![CDATA['+vwScoutCORCIt ems.scoutDescri ption+']]&gt;' ,
vwScoutCORCItem s.scoutImageFil eName,
vwScoutCORCItem s.scoutFeatured Item,
NULL,
NULL,
SCOUT_WORD.Scou tWordID,
SCOUT_WORD.Word
FROM SCOUT_ITEMCHARA CTERISTIC
INNER JOIN vwScoutCORCItem s ON SCOUT_ITEMCHARA CTERISTIC.ItemI D =
vwScoutCORCItem s.projectID
INNER JOIN SCOUT_WORD ON
SCOUT_ITEMCHARA CTERISTIC.Scout CharacteristicI D =
SCOUT_WORD.Scou tWordID

Order by [item!1!projectI D],[Audience!2!Audi enceID!element]

for xml explicit

</sql:query>

</corc>

That means you've got 0 (character with code 0) in the document. XML
spec doesn't allow characters with code less than x20 (except x9, xA,
xD) to be used within XML documents.

Nov 12 '05 #4
sunil wrote:
Thanks for your response Oleg. But that doesn't seem to answer my
question. If there is a invalid character why doen't IE give me an
error.

IE is kinda lax on this stuff. Try mozilla to see where you've got
forbidden chracters.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #5

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

Similar topics

1
2987
by: Angel | last post by:
I'm trying to connect to a fixed IP address (eg. http://10.60.903.50/TempFile) in order to retrieve one accii line of text in TempFile. I try to read the information with this code: string fullpath = " http://10.60.93.51/TempFile "; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(fullpath); //req.KeepAlive = false; HttpWebResponse res; StreamReader sr; string strResult = "";
0
2385
by: Edo | last post by:
Hi all, We're developing an .NET intranet webapp which relies on a .NET webservice. Some batch processes take a long time, and on our testserver always return an error: The underlying connection was closed: An unexpected error occurred on a receive. Googling for this problem showed some tips. One adviced us to set KeepAlive to false, but, since it's an intranet app, we reply on integrated security, which _needs_ KeepAlive
0
605
by: AndyG | last post by:
I am calling a webservice from a web page. I was getting this error "The underlying connection was closed: An unexpected error occurred on a receive." When I run it in debug mode, it works fine. To help me debug this, I have the webservice write lines to a text file to determine how far it gets. I determined the browser returns the error page, and the webservice is still running. The webservice finishes shortly after. It seems to me like I...
5
24784
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred on a receive. We are using .NET v1.1.
6
5488
by: Yoel | last post by:
Hi, I'm trying consuming web services over SSL by an ASP .Net client without success. System Architecture: My Server side contains the following layers, starting from the client side: (Client side) WSD firewall
0
1447
by: tharika | last post by:
Hi, We have an ASP.NET web application hosted on a development server, that invokes web services hosted on an offshore server in India, both being on the same intranet domain. The default page of the application makes a call to a service and is painted successfully. Navigation to any other application page, which invokes the same service throws the error, "Underlying connection was closed. An unexpected error occurred on receive"....
1
6772
by: matt | last post by:
hello, i am using a .NET 1.1 winform to perform webrequests via the System.Net.WebClient class (not a webservice, actually). It uploads values via a POST command & a URL, then receives the html back. nothing too complicated there. except, i am frequently getting the dreaded error: The underlying connection was closed: an unexpected error occurred
0
1594
by: pinky | last post by:
Hi all I am having one web service where in at a time of calling one webmethod through client application i am continuously getting following error :- The underlying connection was closed: An unexpected error occurred on a
1
8859
by: Mrozik | last post by:
Hi! I have a problem - after deploying application in client environment, on some client machines occured error. Environment: App server: ASP.NET WebService/Win 2003/ secured SSL (.NET 2.0) Client app: SmartClient - WinForms (.NET 2.0) I trust all server cetrificates - at the start of client application I call:
7
14154
by: Ramk | last post by:
Hi all I am using C#/.Net2.0 I am connecting to a remote shared folder from my C# code using WNetAddConnection2A without mapping to the local drive. A code snippet is: NetResource netRes = new NetResource(); netRes.scope = RESOURCE_GLOBALNET;
0
9956
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9799
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10429
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
9592
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...
1
7987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7139
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();...
1
4627
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
2
4235
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.