| Author |
Message |
   
Biriyani
Side Hero Username: Biriyani
Post Number: 3181 Registered: 03-2012 Posted From: 171.161.160.10
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:45 am: |
    |
Mental_sachinodu:may be you need to flush or close the XmlTextWriter before you start reading from the Memory stream? are you already doing it?
thanka a lot annai..its working after flushing |
   
Biriyani
Side Hero Username: Biriyani
Post Number: 3180 Registered: 03-2012 Posted From: 171.161.160.10
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:34 am: |
    |
Mental_sachinodu:may be you need to flush or close the XmlTextWriter before you start reading from the Memory stream? are you already doing it?
chass..how did i miss this..lemme try by flushing |
   
Biriyani
Side Hero Username: Biriyani
Post Number: 3179 Registered: 03-2012 Posted From: 171.161.160.10
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:32 am: |
    |
Mental_sachinodu:ok, on a second look, it doesnt appear to be the size issue. may be something to do with the way xml is being built?
<roottag1111111> <childtag222222> <childtag333333> if if my program is displaying the above content now which is not full.. if I remove some characters from those tags..then i can see the next tags getting displayed.. <roottag1> <childtag2> <childtag3> <childtag4> <child |
   
Mental_sachinodu
Side Hero Username: Mental_sachinodu
Post Number: 8185 Registered: 10-2008 Posted From: 208.85.128.5
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:31 am: |
    |
Biriyani:if (stream != null) { stream.Position = 0; StreamReader reader1 = new StreamReader(stream); if (stream.Length == 0) return; Console.WriteLine(reader1.ReadToEnd());
} may be you need to flush or close the XmlTextWriter before you start reading from the Memory stream? are you already doing it? the world of appearances may or may not be real, or both may and may not be real - or may be indescribable; or may be real and indescribable, or unreal and indescribable; or in the end may be read and unreal and indescribable - its all Syadvada |
   
Mental_sachinodu
Side Hero Username: Mental_sachinodu
Post Number: 8184 Registered: 10-2008 Posted From: 208.85.128.5
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:25 am: |
    |
Mental_sachinodu:will you be able to know the size of content prior to putting it in to XmlTextWriter, im guessing yes. the default capacity of the stream is 4096 bytes. so i would read the content first, initialize the appropriate stream size and then put into the textwriter.
ok, on a second look, it doesnt appear to be the size issue. may be something to do with the way xml is being built? the world of appearances may or may not be real, or both may and may not be real - or may be indescribable; or may be real and indescribable, or unreal and indescribable; or in the end may be read and unreal and indescribable - its all Syadvada |
   
Mental_sachinodu
Side Hero Username: Mental_sachinodu
Post Number: 8183 Registered: 10-2008 Posted From: 208.85.128.5
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:21 am: |
    |
Biriyani:code paste chesa chudu..
will you be able to know the size of content prior to putting it in to XmlTextWriter, im guessing yes. the default capacity of the stream is 4096 bytes. so i would read the content first, initialize the appropriate stream size and then put into the textwriter. if your contect is already less than 4096 bytes, then its a different issue altogether the world of appearances may or may not be real, or both may and may not be real - or may be indescribable; or may be real and indescribable, or unreal and indescribable; or in the end may be read and unreal and indescribable - its all Syadvada |
   
Biriyani
Side Hero Username: Biriyani
Post Number: 3178 Registered: 03-2012 Posted From: 171.159.192.10
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:05 am: |
    |
Mental_sachinodu:If you have used the byte[] constructor the stream is not resizable. you can use the constructor MemoryStream(int), makes it a resizable stream, and you can increase the stream length by using SetLength
code paste chesa chudu.. |
   
Biriyani
Side Hero Username: Biriyani
Post Number: 3176 Registered: 03-2012 Posted From: 171.159.192.10
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 11:03 am: |
    |
Twitter:
XmlTextWriter writer; Stream stream = null; stream = new MemoryStream(); writer = new XmlTextWriter(stream, Encoding.UTF8); //code here for writing xml content using writer //code wherr i am reading the stream content...here am getting the issue if (stream != null) { stream.Position = 0; StreamReader reader1 = new StreamReader(stream); if (stream.Length == 0) return; Console.WriteLine(reader1.ReadToEnd()); } above code lo...console lo write cheyyakunda..file lo write chesi chusa...there also its not wiritng the full content if (stream != null) { stream.Position = 0; StreamReader reader1 = new StreamReader(stream); using (FileStream fileStream = System.IO.File.Create("C:/test.txt",int) stream.Length)) // Fill the bytes[] array with the stream data byte[] bytesInStream = new byte[stream.Length]; stream.Read(bytesInStream, 0, (int)bytesInStream.Length); // Use FileStream object to write to the specified file fileStream.Write(bytesInStream, 0, bytesInStream.Length); } |
   
Mental_sachinodu
Side Hero Username: Mental_sachinodu
Post Number: 8182 Registered: 10-2008 Posted From: 208.85.128.5
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 10:57 am: |
    |
If you have used the byte[] constructor the stream is not resizable. you can use the constructor MemoryStream(int), makes it a resizable stream, and you can increase the stream length by using SetLength. the world of appearances may or may not be real, or both may and may not be real - or may be indescribable; or may be real and indescribable, or unreal and indescribable; or in the end may be read and unreal and indescribable - its all Syadvada |
   
Twitter
Megastar Username: Twitter
Post Number: 21861 Registered: 10-2009 Posted From: 69.126.240.254
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 10:54 am: |
    |
Biriyani:but say if the xm content has 1000 characters..memory straming object is only honding 500 characters...Can i increase the memorystream object capacity? or is there any alternative to this?
byte stream array declare chesuntav dhaani size penchu limit is your local RAM. enthaina penchocchu. |
   
Biriyani
Side Hero Username: Biriyani
Post Number: 3175 Registered: 03-2012 Posted From: 171.159.194.10
Rating: N/A Votes: 0 (Vote!) | | Posted on Monday, August 20, 2012 - 10:53 am: |
    |
MemoryStream object lo formatted xml content store chesthunna... but say if the xm content has 1000 characters..memory straming object is only honding 500 characters...Can i increase the memorystream object capacity? or is there any alternative to this? |