473,406 Members | 2,343 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,406 software developers and data experts.

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:\Projects\SQLXML\corc.xml")

I get the following error:

"System.Xml.XmlException: An unexpected end of file parsing CDATA has
occurred. Line 6, position 1.
at System.Xml.XmlScanner.ScanCData()
at System.Xml.XmlScanner.ScanMarkup()
at System.Xml.XmlTextReader.ParseTag()
at System.Xml.XmlTextReader.ParseBeginTagExpandCharEn tities()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlValidatingReader.ReadNoCollectTextTo ken()
at System.Xml.XmlValidatingReader.Read()
at System.Xml.XmlLoader.LoadChildren(XmlNode parent)
at System.Xml.XmlLoader.LoadElementNode()
at System.Xml.XmlLoader.LoadCurrentNode()
at System.Xml.XmlLoader.LoadChildren(XmlNode parent)
at System.Xml.XmlLoader.LoadElementNode()
at System.Xml.XmlLoader.LoadCurrentNode()
at System.Xml.XmlLoader.LoadCurrentNode()
at System.Xml.XmlLoader.LoadChildren(XmlNode parent)
at System.Xml.XmlLoader.LoadElementNode()
at System.Xml.XmlLoader.LoadCurrentNode()
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 SQLXML.Form1.Button4_Click(Object sender, EventArgs e) in
C:\Projects\SQLXML\Form1.vb:line 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="19182">
<JIFNumber>97-545-0100-S</JIFNumber>
<Title>PULSAR MAX II brochure (Spanish)</Title>
<Group>Brady</Group>
<Category>Product brochure</Category>
- <Description>
- <![CDATA[
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\ fprq2\fcharset0
Tahoma;}{\f1\fnil\fcharset0 Tahoma;}}
{\colortbl ;\red153\green51\blue102;}
\viewkind4\uc1\pard\lang1033\b\f0\fs21 PULSAR MAX II brochure\b0\fs17
(\cf1\b Spanish\cf0\b0\f1\par
}
]]>
</Description>
<ImageFileName>97-545-0100-S.jpg</ImageFileName>
<scoutFeaturedItem>0</scoutFeaturedItem>
- <Characterictic>
<CharacteristicID>2</CharacteristicID>
<CharactericticValue>flying</CharactericticValue>
</Characterictic>
</item>
- <item projectID="19183">
<JIFNumber>99-919-901</JIFNumber>
<Title>Guidant 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>
<scoutFeaturedItem>0</scoutFeaturedItem>
</item>
- <item projectID="19184">
<JIFNumber>97-718-1102</JIFNumber>
<Title>CONTAK RENEWAL CD ROM</Title>
<Group>Heart Failure</Group>
- <Description>
- <![CDATA[ CONTAK RENEWAL CD ROM
]]>
</Description>
<scoutFeaturedItem>0</scoutFeaturedItem>
</item>
- <item projectID="19186">
<JIFNumber>99-940-102</JIFNumber>
<Title>NASPE 2002 Allied Professional Invitations</Title>
<Group>CRM</Group>
- <Description>
- <![CDATA[ NASPE 2002 Allied Professional Invitations
]]>
</Description>
<scoutFeaturedItem>0</scoutFeaturedItem>
</item>
</corc>
Any help would be appreciated.

Thanks
Nov 12 '05 #1
4 11949
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:\Projects\SQLXML\corc.xml")

I get the following error:

"System.Xml.XmlException: 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!projectID],
JIFRANumber as [item!1!JIFNumber!element],
Title as [item!1!Title!element],
[Group] as [item!1!Group!element],
Category as [item!1!Category!element],
'&lt;![CDATA['+scoutDescription+']]&gt;' as [item!1!Description!xml],
scoutImageFileName as [item!1!ImageFileName!element],
scoutFeaturedItem as [item!1!scoutFeaturedItem!element],
null as [Audience!2!AudienceID!element],
null as [Audience!2!AudienceValue!element],
null as [Characterictic!3!CharacteristicID!element],
null as [Characterictic!3!CharactericticValue!element]
FROM vwScoutCORCItems

UNION ALL

SELECT 2,
1,
vwScoutCORCItems.projectID,
vwScoutCORCItems.JIFRANumber,
vwScoutCORCItems.Title,
vwScoutCORCItems.[Group],
vwScoutCORCItems.Category,
'&lt;![CDATA[' + vwScoutCORCItems.scoutDescription+']]&gt;' ,
vwScoutCORCItems.scoutImageFileName,
vwScoutCORCItems.scoutFeaturedItem,
SCOUT_ITEM_AUDIENCE.AudienceID,
SCOUT_AUDIENCE.AudienceValue,
null,
null
FROM SCOUT_ITEM_AUDIENCE
INNER JOIN SCOUT_AUDIENCE ON SCOUT_ITEM_AUDIENCE.AudienceID =
SCOUT_AUDIENCE.AudienceID
INNER JOIN vwScoutCORCItems ON SCOUT_ITEM_AUDIENCE.ItemID =
vwScoutCORCItems.projectID

UNION ALL

SELECT 3,
1,
vwScoutCORCItems.projectID,
vwScoutCORCItems.JIFRANumber,
vwScoutCORCItems.Title,
vwScoutCORCItems.[Group],
vwScoutCORCItems.Category,
'&lt;![CDATA['+vwScoutCORCItems.scoutDescription+']]&gt;' ,
vwScoutCORCItems.scoutImageFileName,
vwScoutCORCItems.scoutFeaturedItem,
NULL,
NULL,
SCOUT_WORD.ScoutWordID,
SCOUT_WORD.Word
FROM SCOUT_ITEMCHARACTERISTIC
INNER JOIN vwScoutCORCItems ON SCOUT_ITEMCHARACTERISTIC.ItemID =
vwScoutCORCItems.projectID
INNER JOIN SCOUT_WORD ON
SCOUT_ITEMCHARACTERISTIC.ScoutCharacteristicID =
SCOUT_WORD.ScoutWordID

Order by [item!1!projectID],[Audience!2!AudienceID!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!projectID],
JIFRANumber as [item!1!JIFNumber!element],
Title as [item!1!Title!element],
[Group] as [item!1!Group!element],
Category as [item!1!Category!element],
'&lt;![CDATA['+scoutDescription+']]&gt;' as [item!1!Description!xml],
scoutImageFileName as [item!1!ImageFileName!element],
scoutFeaturedItem as [item!1!scoutFeaturedItem!element],
null as [Audience!2!AudienceID!element],
null as [Audience!2!AudienceValue!element],
null as [Characterictic!3!CharacteristicID!element],
null as [Characterictic!3!CharactericticValue!element]
FROM vwScoutCORCItems

UNION ALL

SELECT 2,
1,
vwScoutCORCItems.projectID,
vwScoutCORCItems.JIFRANumber,
vwScoutCORCItems.Title,
vwScoutCORCItems.[Group],
vwScoutCORCItems.Category,
'&lt;![CDATA[' + vwScoutCORCItems.scoutDescription+']]&gt;' ,
vwScoutCORCItems.scoutImageFileName,
vwScoutCORCItems.scoutFeaturedItem,
SCOUT_ITEM_AUDIENCE.AudienceID,
SCOUT_AUDIENCE.AudienceValue,
null,
null
FROM SCOUT_ITEM_AUDIENCE
INNER JOIN SCOUT_AUDIENCE ON SCOUT_ITEM_AUDIENCE.AudienceID =
SCOUT_AUDIENCE.AudienceID
INNER JOIN vwScoutCORCItems ON SCOUT_ITEM_AUDIENCE.ItemID =
vwScoutCORCItems.projectID

UNION ALL

SELECT 3,
1,
vwScoutCORCItems.projectID,
vwScoutCORCItems.JIFRANumber,
vwScoutCORCItems.Title,
vwScoutCORCItems.[Group],
vwScoutCORCItems.Category,
'&lt;![CDATA['+vwScoutCORCItems.scoutDescription+']]&gt;' ,
vwScoutCORCItems.scoutImageFileName,
vwScoutCORCItems.scoutFeaturedItem,
NULL,
NULL,
SCOUT_WORD.ScoutWordID,
SCOUT_WORD.Word
FROM SCOUT_ITEMCHARACTERISTIC
INNER JOIN vwScoutCORCItems ON SCOUT_ITEMCHARACTERISTIC.ItemID =
vwScoutCORCItems.projectID
INNER JOIN SCOUT_WORD ON
SCOUT_ITEMCHARACTERISTIC.ScoutCharacteristicID =
SCOUT_WORD.ScoutWordID

Order by [item!1!projectID],[Audience!2!AudienceID!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
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...
0
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...
0
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...
5
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...
6
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: ...
0
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...
1
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...
0
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...
1
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)...
7
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 =...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...
0
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,...
0
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...

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.