Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String is not long enough
Message
 
To
05/02/2008 01:32:59
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01289423
Message ID:
01289466
Views:
14
What are you doing with this Xml that you need to read it into a string? Read it into an XmlTextReader or an XmlDom to do something useful with it. XmlReader will read only a chunk at a time so it's very memory efficient but parsing is a bit difficult.

There is no reason that I can think of to load Xml into a string.

+++ Rick ---

>>The string Length property is an int, which can be up to the max value of an int32, I believe (something like 2,000,000,000 characters)
>>
>>What are you trying to read in?
>
>I was doing something like this:
>
>
>lcXml = lcStreamReader.ReadToEnd()
>
>
>lcXml is defined as a String. lcStreamReader is containing a dataset which has been converted into a XML and then to it. At that point, I already changed the code to use a string builder approach instead of lcXml. With the lcXml, this is giving me an OutOfMemory exception. I have about 7000 records which contain a lot of fields in that dataset. If I have a little less than that, I am not running into the OutOfMemory exception. With the change of code, I did not have the time to test if this will help so far.
>
>Here is the ReadToEnd() stack:
>
>
>at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
>   at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength)
>   at System.Text.StringBuilder.Append(Char[] value, Int32 startIndex, Int32 charCount)
>   at System.IO.StreamReader.ReadToEnd()
>
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform