惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Troy Hunt's Blog
F
Fortinet All Blogs
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
The Register - Security
The Register - Security
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
V
Vulnerabilities – Threatpost
S
Securelist
S
SegmentFault 最新的问题
T
Threat Research - Cisco Blogs
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy International News Feed
S
Schneier on Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
GbyAI
GbyAI
Apple Machine Learning Research
Apple Machine Learning Research
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
美团技术团队
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google Online Security Blog
Google Online Security Blog
M
MIT News - Artificial intelligence
U
Unit 42
V
V2EX
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
B
Blog
博客园 - 叶小钗
Attack and Defense Labs
Attack and Defense Labs
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Hacker News: Ask HN
Hacker News: Ask HN
博客园 - Franky
Engineering at Meta
Engineering at Meta
Schneier on Security
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
IT之家
IT之家
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
Martin Fowler
Martin Fowler
SecWiki News
SecWiki News

博客园 - leon qian

正则表达式全部符号解释 android显示大图片的一些技巧 SAPI 5.1 语音合成的事件 SAPI 5.1 语音合成的列举语音引擎 Unicode符号代码表 c#中的问号 C#的四则运算函数 - leon qian - 博客园 读取Excel文件时出现null的解决方法 - leon qian - 博客园 让CSS区别不同浏览器 在Repeater中使用按钮或其他控件的解决方法 - leon qian - 博客园 在IIS中使用Gzip压缩后传送数据 一堆常用JS代码 stream转string,string转stream JS代码整理 asp.net 真正意义上的裁减图片 由于启动用户实例的进程时出错的解决方法 C#中的正则表达式 转 SqlHelper详解(转载) [转].net用url重写URLReWriter实现任意二级域名
一个XML转换的例子
leon qian · 2007-11-11 · via 博客园 - leon qian

问:
我想把字符串转换成stream,
然后
System.Xml.XmlTextReader xmlReader = new System.Xml.XmlTextReader(System.IO.Stream input)

______________________________________________________________________________________________
答1:
为何一定要转呢?

string xmlFrag ="<book> " +
                         "<title>Pride And Prejudice</title>" +
                         "<bk:genre>novel</bk:genre>" +
                         "</book>";

    //Create the XmlNamespaceManager.
    NameTable nt = new NameTable();
    XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
    nsmgr.AddNamespace("bk", "urn:sample");

    //Create the XmlParserContext.
    XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);

    //Create the reader.
    XmlTextReader reader = new XmlTextReader(xmlFrag, XmlNodeType.Element, context);