C sharp question Chalanachithram.com | Topics | Search
Hide Clipart | Log Out | Register | Edit Profile

Last 30 mins | 1 | 2 | 4 hours     Last 1 | 7 Days

Chalanachithram.com DB » TF Industry related » Archive through August 20, 2012 » C sharp question « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this 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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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);
}
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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?

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image HASH(0x8a74d54){Movie Clipart}
Show / hide regular icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Show / Hide Filmy icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Username: Posting Information:
This is a public posting area. Enter your username and password if you have an account. Otherwise, enter your full name as your username and leave the password blank. Your e-mail address is optional.
Password:
E-mail:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: