Hi Nick,
As Jeroen suggested, for createing xml reader/writer, we're recommended to
use the factory method(Create) on XmlReader/XmlWriter abstract class. There
are several benefits on this(such as reusable setting and xmlreader
chaining...), here is the MSDN document mentioned this:
#Creating XML Readers
http://msdn.microsoft.com/en-us/library/9khb6435.aspx
And by default XmlTextReader implementation is used for
XmlReader.Create(when you supply a stream based input). e.g.
===============================
static void RunXmlReader()
{
byte[] bytes = Encoding.UTF8.GetBytes(@"<testChuck>
Master pages in ASP.NET 2.0 applications
are the pages that enable you to provide a consistent look to your web
application. In ASP.NET 1.1, to achieve a consistent look across a website,
you need to use User controls and place them on each page. The master pages
eliminate the need to place the header, footer, or other important sections
on each page of your website repeatedly. The master pages are programmable
and contain methods, properties, and controls that can be made visible in
all other content pages. However, these elements need to be declared with
the Public scope in the master pages. You can build your content pages,
which have a unique content of their own and then merge the master page
with it to provide the page a consistent look. A single website can have
more than one master page. To use master page in your content page, you
need to reference the master page that you want to use. This article
discusses the way that you can use to reference a master page in your
content page.
</testChuck>"
);
MemoryStream ms = new MemoryStream(bytes);
XmlReaderSettings settings = new XmlReaderSettings();
XmlReader xtr = XmlReader.Create(ms);
Console.WriteLine(xtr.GetType());
xtr.ReadToFollowing("testChuck");
xtr.Read();
int cnt = 0;
char[] cbuf = new char[128];
cnt = xtr.ReadValueChunk(cbuf, 0, cbuf.Length);
while (cnt > 0)
{
Console.Write(new string(cbuf,0, cnt));
cnt = xtr.ReadValueChunk(cbuf, 0, cbuf.Length);
}
xtr.Close();
}
===============================
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?bmlja2R1?= <
[email protected]>
Subject: Support for stream based reading from XmlReader?
Date: Sun, 25 Jan 2009 11:49:02 -0800
I see XmlReader has a method named ReadValueChunk() which is a chunking
mechanism for reading large text from an XML document. However, that method
is not implemented in XmlTextReader. Is there some way to chunk the reads of
large textual data?
--
Thanks,
Nick
(e-mail address removed)
remove "nospam" change community. to msn.com