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

problem with xmltextreader and stream with &

Hi

I have an xml stream that I would like to read with xmltextreader.
Problem is that there are some & inside the xml stream.
Parse is not working on them.
Can someone show me sample code for reading a stream like this?

Thanks,
Cindy
Jun 27 '08 #1
2 1589
* CindyH wrote in microsoft.public.dotnet.xml:
>I have an xml stream that I would like to read with xmltextreader.
Problem is that there are some & inside the xml stream.
Parse is not working on them.
Can someone show me sample code for reading a stream like this?
If you mean it has, for example,

<example>You & me</example>

or

<example example=' a && b '></example>

then those are not XML documents, the & must be escaped using &amp; or
some equivalent form. Whoever created the documents must fix them be-
fore you can process them as XML documents.
--
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/
Jun 27 '08 #2
Well, he claims it's a well formed xml and I doubt he will remove them or
replace them.
The only thing I can think of is using replace function, but was wondering
if there was a better or more standard way.

"Bjoern Hoehrmann" <bj****@hoehrmann.dewrote in message
news:gd********************************@hive.bjoer n.hoehrmann.de...
>* CindyH wrote in microsoft.public.dotnet.xml:
>>I have an xml stream that I would like to read with xmltextreader.
Problem is that there are some & inside the xml stream.
Parse is not working on them.
Can someone show me sample code for reading a stream like this?

If you mean it has, for example,

<example>You & me</example>

or

<example example=' a && b '></example>

then those are not XML documents, the & must be escaped using &amp; or
some equivalent form. Whoever created the documents must fix them be-
fore you can process them as XML documents.
--
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/

Jun 27 '08 #3

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

Similar topics

3
by: prasad | last post by:
Hi, I am using XMLTextReader class to read the xml files. In some cases xml declaration tag might start after space/tab charecters. These kind of files are supported by the browsers and xml dom's...
3
by: Kjeld | last post by:
My scenario: I'm using an XmlTextReader to Deserialize serveral classes from a single xml document. Every class i pass the source stream, containing the xml. Each class subsequently creates an...
1
by: Borgbjerg | last post by:
I've got a multi-threaded server (we are very early in the project, trying to uncover some risks), and I want to send data using XML. The class ServerAdapter is supposed to connect to the server...
3
by: CindyH | last post by:
Hi I have an xml stream that I would like to read with xmltextreader. Problem is that there are some & inside the xml stream. Parse is not working on them. Can someone show me sample code for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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.