欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

How to convert a String to Stream

系統 1796 0
How do you convert a String object to Stream (type) object?

I know it is more common to do the conversion in the other direction, but for me it is definitely the other way.

I have a web service input parameter of type string.? This parameter is actually an xml document payload. Why this is so is a long story.

Anyway, I need to validate it.? I've written xml validation code in the past.? The one real stumbling block here isd this data type conversion.

I'm at a bit of a loss how to do this.? Ultimately I need to get the data into an XmlReader object coupled with the XmlReadersettings object (this is a .net 2.0 asp.net app).? Looking at the object model for various System.XML namespace objects this does not appear to be a straightforward task.

Short of writing the string to disk and then opening it up with a FileStream object,there's got to be a better way.? Anyone have a better idea?

Thanks!
Mr Bungle
Tuesday, July 18, 2006
?
?
Implement a class derived from stream, i.e. declare a StringStream class, use your string to construct it, and implement the various abstract methods declared in Stream such as Read and CanWrite.
Christopher Wells
Tuesday, July 18, 2006
?
?
Use the StringReader class, e.g.

string xmlText = ... your XML ...;
XmlReaderSettings settings = ... your settings ...;

StringReader stringReader = new StringReader(xmlText);
XmlTextReader xmlReader = XmlReader.Create(stringReader, settings);
...
Joe
Wednesday, July 19, 2006
?
?
There is also the MemoryStream object, convert your string into an array of bytes and write directly into the memorystream.

MemoryStream memStream = new MemoryStream();
byte [] data = Encoding.Unicode.GetBytes(theString);
memStream.Write(data, 0, data.Length);
Foxedup
Wednesday, July 19, 2006
?
?
The System.IO.StringReader object worked like a charm and just required a single line of additional code.? What a relief! Thanks for all the helpful replies.
Mr Bungle
Wednesday, July 19, 2006
?
?

This topic is archived. No further replies will be accepted.

How to convert a String to Stream


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。?!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 久久综合丁香激情久久 | 成人伊人 | 天天干天天色 | 99在线热播精品免费 | 亚洲一区二区在线视频 | 一区二区国产精品 | 天天天天 | 亚洲另类天天更新影院在线观看 | 日韩一区二区在线视频 | www.av在线免费观看 | 亚洲欧美综合精品久久成人 | 一级毛片视频在线观看 | 日韩午夜电影 | 国产色片在线观看 | 亚州 色毛片免费观看 | 国产一三区A片在线播放 | 国产高清视频在线 | 欧美性网 | 国产精品久久久久秋霞影视 | 欧美三级在线 | 欧美zozozo人禽交免费观看 | 久草在线新免久费观看视频 | 91在线精品视频 | 亚洲一卡二卡在线 | 边摸边吃奶边做激情叫床文章 | 操人视频免费 | 在线观看亚洲一区二区三区 | 狠狠躁躁夜夜躁波多野结依 | 日韩在线观看免费 | 一区二区三区免费在线观看 | 欧美日韩在线免费观看 | 欧美永久免费 | 国产成人精品福利网站在线观看 | 亚洲成人免费网址 | 波多野结衣一区二区三区在线观看 | 日日夜夜天天 | 日本一二三区视频 | 日韩加勒比在线 | 欧美极品brazzers 高清 | 免费视频日韩 | 欧美精品videosex极品 |