473,802 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1356
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******** *******@TK2MSFT NGP05.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******** *******@TK2MSFT NGP05.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.j a.net...
>"CindyH" <ch*******@new. rr.comschreef in bericht
news:%2******* ********@TK2MSF TNGP05.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
4170
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
1687
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 but the xmltextreader's are not supporting to read this kind of files. Using XMLTextReaders is there anyway to read this kind of files. Thanks in advance, Prasad Dannani.
3
1859
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 XmlTextReader object with that stream as input. However, the second class that performs this operation cannot start reading at position X, because the first instance of XmlTextReader advanced the position in the stream to the end of the stream....
1
2518
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 (which works fine), to send data, but on the same stream be able to read data (which is causing problems). In the function "bool Connect()", we want to instantiate the XmlTextReader with the stream that we got from the 'TcpClient client', but...
1
2714
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> <EmployeeStrength>> 1000</EmployeeStrength> When I do a Xmltextreader.read() and then check the contents of the xml node by XmltextReader.ReadString(), I get an exception when I have
0
1107
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 back (in xml) The searches are just URLs with querystrings. Each request sets a boolean to true when it has got a reply from the search engine. I have declare the booleans as 'volatile'.
5
9366
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' already belongs to this DataTable: cannot set a nested table name to the same name. Any help with this would be appreciated. Thanks, sck10
2
3694
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 an unclosed literal string. Line 1, position 129. at System.Xml.XmlScanner.ScanLiteral() at System.Xml.XmlTextReader.SetLiteralValues(XmlAttributeTokenInfo fld) at System.Xml.XmlTextReader.SetAttributeValues()
2
1610
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 reading a stream like this? Thanks, Cindy
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10538
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10285
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9115
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.