473,394 Members | 1,828 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,394 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
3 1342
Cindy,

No.

Because it with that & not XML.

(You can first try to read the file as simple text file, change or remove
all the & and then read it again as XML)

Cor

"CindyH" <ch*******@new.rr.comschreef in bericht
news:%2***************@TK2MSFTNGP05.phx.gbl...
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 #2
"CindyH" <ch*******@new.rr.comschreef in bericht
news:%2***************@TK2MSFTNGP05.phx.gbl...
>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?
Cor Ligthert[MVP] wrote:
No.
Because it with that "&" is not XML.
A thought ...

The XmlReader classes are inheritable. Do you know of anyone who's
experimented with creating XmlReader subclasses that can detect (and
correct) this kind of thing as the Xml text is read in?

I /may/ be looking at doing something similar, and an extended XmlReader
would be ideal. I'm thinking of writing Xml-formatted log files that
/lack/ a closing root element tag. These can be appended to, like
regular text log files (quick and simple) and a customised XmlReader
could "spot" the errant End-Of-File and append the missing tag, as the
text is read "back in".
Haven't tried it yet, though.

Regards,
Phill W.
Jun 27 '08 #3
Phill,

I would not even think about it to take any minute in it. This lead to
endless changes because whatever not well format XML can be created.

XML is a well describted way to exchange data. Why would I not use that?

Cor

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kschreef in bericht
news:g1**********@south.jnrs.ja.net...
>"CindyH" <ch*******@new.rr.comschreef in bericht
news:%2***************@TK2MSFTNGP05.phx.gbl...
>>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?

Cor Ligthert[MVP] wrote:
No.
Because it with that "&" is not XML.

A thought ...

The XmlReader classes are inheritable. Do you know of anyone who's
experimented with creating XmlReader subclasses that can detect (and
correct) this kind of thing as the Xml text is read in?

I /may/ be looking at doing something similar, and an extended XmlReader
would be ideal. I'm thinking of writing Xml-formatted log files that
/lack/ a closing root element tag. These can be appended to, like regular
text log files (quick and simple) and a customised XmlReader could "spot"
the errant End-Of-File and append the missing tag, as the text is read
"back in".
Haven't tried it yet, though.

Regards,
Phill W.
Jun 27 '08 #4

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

Similar topics

2
by: Yuriy | last post by:
Hi, any ideas how to read XML fragment from TextReader? XmlTextReader constructor accepts only Stream or string as source Do I miss something? thanks Yuriy
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...
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
0
by: davidpenty | last post by:
Hi there, I am having some problems with a multi-threaded asp.net seach page. My search page sends off four asynchronous http requests to four search engines then waits for the results to come...
5
by: sck10 | last post by:
Hello, I am using the following to get RSS Feeds. I've been able to get the xml files from every site except CNN. When I try to get there feed, I get the exception: A column named 'link'...
2
by: Marek Suski | last post by:
Hi all, I am getting following error while a user is trying to execute web method from proxy class (proxy class inhertis from WebServicesClientProtocol class) System.Xml.XmlException: There is...
2
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: 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?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
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...

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.