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

Invalid charachters in a XML Doc

I'm new to XML, so this is a newbie question. I'm reading in XML docs via a
VB.NET application and extracting node data and I find that one of my blocks
or lines has a copyright character in it. I'm using the .NET XMLTextReader
class and the Reader won't parse this character at all; just throws an
exception and boom the application quits. The character always appears in
the same place in the document so I thought to detect the node and skip over
it using the skip function. Nope, it still blows up.

Here's the node. Notice the copyright char shows up as a block. Can anyone
point me in the right direction? TIA...
<body.end>

<tagline>Copyright ? 2005 </tagline> the cp

</body.end>


Nov 12 '05 #1
2 2031
* Glen wrote in microsoft.public.dotnet.xml:
I'm new to XML, so this is a newbie question. I'm reading in XML docs via a
VB.NET application and extracting node data and I find that one of my blocks
or lines has a copyright character in it. I'm using the .NET XMLTextReader
class and the Reader won't parse this character at all; just throws an
exception and boom the application quits. The character always appears in
the same place in the document so I thought to detect the node and skip over
it using the skip function. Nope, it still blows up.

Here's the node. Notice the copyright char shows up as a block. Can anyone
point me in the right direction? TIA...


If you do not declare a different encoding, all XML processors assume
that XML documents are UTF-8 encoded, if that causes any trouble it
would seem that the document is actually encoded in a different
encoding. You can solve your problem either by fixing the document
before passing it to the XML processor (by declaring the right encoding)
or by transcoding the document to UTF-8 (see System.Text.Encoding for
routines that could do that). I suspect the documents are actually in
the Windows-1252 encoding, so declaring the encoding would like like

<?xml version="1.0" encoding="windows-1252"?>
<x>...</x>
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Nov 12 '05 #2
Thanks for the heads-up. Turns out the encoding is actually
ISO 8859-1.
"Bjoern Hoehrmann" <bj****@hoehrmann.de> wrote in message
news:41****************@news.bjoern.hoehrmann.de.. .
* Glen wrote in microsoft.public.dotnet.xml:
I'm new to XML, so this is a newbie question. I'm reading in XML docs via aVB.NET application and extracting node data and I find that one of my blocksor lines has a copyright character in it. I'm using the .NET XMLTextReaderclass and the Reader won't parse this character at all; just throws an
exception and boom the application quits. The character always appears in
the same place in the document so I thought to detect the node and skip overit using the skip function. Nope, it still blows up.

Here's the node. Notice the copyright char shows up as a block. Can anyonepoint me in the right direction? TIA...


If you do not declare a different encoding, all XML processors assume
that XML documents are UTF-8 encoded, if that causes any trouble it
would seem that the document is actually encoded in a different
encoding. You can solve your problem either by fixing the document
before passing it to the XML processor (by declaring the right encoding)
or by transcoding the document to UTF-8 (see System.Text.Encoding for
routines that could do that). I suspect the documents are actually in
the Windows-1252 encoding, so declaring the encoding would like like

<?xml version="1.0" encoding="windows-1252"?>
<x>...</x>
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

Nov 12 '05 #3

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

Similar topics

20
by: John Doe | last post by:
I write code as long as 250+ columns sometimes (when the code refers to a single concept), and I don't understand why people complain about that. Just use the word wrap, right? People who write...
20
by: John Doe | last post by:
I write code as long as 250+ columns sometimes (when the code refers to a single concept), and I don't understand why people complain about that. Just use the word wrap, right? People who write...
3
by: Nightcrawler | last post by:
I have a website that does the following: 1. it accepts a keyword through a textbox in the UI 2. once the submit button is clicked it goes out and spiders a few websites using the keyword...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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...

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.