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

MS XML Parser error in CData section

!NoItAll
297 100+
The MSXML parser is choking on a single character that often appears in my data within a CDATA section.

Try this:

Expand|Select|Wrap|Line Numbers
  1. Dim bRet As Boolean
  2. Dim lRet as long 
  3. Dim xmlDoc As MSXML2.DOMDocument
  4. Set xmlDoc = New MSXML2.DOMDocument
  5.  
  6. bRet = xmlDoc.Load("d:\test.xml")
  7.  
  8. lRet = xmlDoc.parseError.filepos   'returns the position of the A9 (copyright symbol)
  9.  
  10.  
The file I'm loading looks like this:

<NRCS_2NEWARC RECORDNUMBER= "1844">
<TreeStructure Data="19930121"/>
<![CDATA[NEWSS © 1993 All Rights Reserved ]]>
</NRCS_2NEWARC>

Which I saved as d:\test.xml. See the A9 (copyright symbol) inside the CData section - MSXML chokes on it every time - If I remove the copyright symbol everything works as expected. Why? I thought a CDATA section was supposed to be passed intact! The only thing you're not supposed to put into a CDATA section is ]]> which terminates it.
This is frustrating!
I've tried it with MSXML 4, 5, and 6.
Mar 8 '09 #1
1 4069
!NoItAll
297 100+
ok - I see the problem. That character, standing alone, makes for improper UTF8, which XML is expecting. The correct thing to do is make sure I convert the data to UTF8 first - but that seems stupid to me. Again - I thought CDATA was supposed to go completely uninterpreted so you could put any old garbage in there. Apparently not - it has to be proper garbage....
Mar 9 '09 #2

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

Similar topics

5
by: Rutger Claes | last post by:
I'm having troubles getting the euro sign through an XML parser. With the following test code: <?php $string = "<root><test>€</test></root>"; $parser = xml_parser_create();...
16
by: Mike | last post by:
Does anyone know of a minimal/mini/tiny/small xml parser in c? I'm looking for something small that accepts a stream or string, builds a c structure, and then returns an opaque pointer to that...
3
by: cr88192 | last post by:
for various reasons, I added an imo ugly hack to my xml parser. basically, I wanted the ability to have binary payload within the xml parse trees. this was partly because I came up with a binary...
8
by: Xah Lee | last post by:
what does it mean when a style tag gives something like the following? <style type="text/css" media="screen,projection">/*<!]>*/</style> is this standard? Xah xah@xahlee.org ∑...
6
by: Cade Perkins | last post by:
How can the CDATA ending delimiter "]]>" be represented within a CDATA section itself? Consider an XML document that is intended to contain an embedded, uninterpreted XML example. Generally,...
2
by: Steveino | last post by:
Hello, Just wondering if anyone could shed any light on this, it's probably me just being silly... I have a dataset that I've used to create an XmlDataDocument, in order to apply XSL. The XSL...
1
by: onewaylife | last post by:
Hi all I am novice in XML. I have just started to creating PHP parser for XML files. I am using SAX. the file is : - <html> <head> <basefont face="Arial"> </head> <body> <?php
2
by: Pugi! | last post by:
Using AJAX I want to send some information from the server (php-page) as XML to the client. The contents can be very divers so I have to use XML instead of text. On one occasion the contents is...
2
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
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...
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
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,...
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.