xml中处理特殊字符和转义字符

XML 中的特殊字符 > 和 < 这类字符是XML 标记字符,在 XML 中有特殊的含义。当在 SQL 查询(或 XPath 查询)中指定这些字符时,必须对它们进行适当的编码(也称为实体编码)。下表列出了这些特殊字符并描述了它们的含义。有关更多信息,请参见 XML 1.0 规范 中的 XML 1.0 规范。 特殊字符 特殊含义 实体编码 > 开始标记 > < 结束标记 < " 引号 " ' 撇号 ' 为了不使用转义字符,保存的时候需要使用 。。。。 例如: SELECT * FROM Account WHERE ID > 5 ]] </SQL> 如何获得这些HTML内容呢? XmlDocument doc = new XmlDocument(); doc.Load("xml路径"); XmlNode Ydata = doc.SelectSingleNode("/SQL"); string StrHTML = Ydata.InnerText;</div><div id="MySignature"></div> <div class="clear"></div> <div id="blog_post_info_block"> <div id="BlogPostCategory"></div> <div id="EntryTag"></div> <div id="blog_post_info"> </div> <div class="clear"></div> <div id="post_next_prev"></div> </div> </div> <div class = "postDesc">posted @ <span id="post-date">2015-12-22 10:53</span> <a href='http://www.cnblogs.com/amylis_chen/'>星火卓越</a> 阅读(<span id="post_view_count">...</span>) 评论(<span id="post_comment_count">...</span>) <a href ="http://i.cnblogs.com/EditPosts.aspx?postid=5065954" rel="nofollow">编辑</a> <a href="#" onclick="AddToWz(5065954);return false;">收藏</a></div> </div> <script type="text/javascript">var allowComments=true,isLogined=false,cb_blogId=47895,cb_entryId=5065954,cb_blogApp=currentBlogApp,cb_blogUserGuid='ce01470b-63cf-dd11-9e4d-001cf0cd104b',cb_entryCreatedDate='2015/12/22 10:53:00';loadViewCount(cb_entryId);</script> </div><!--end: topics 文章、评论容器--> </div><a name="!comments"></a><div id="blog-comments-placeholder"></div><script type="text/javascript">var commentManager = new blogCommentManager();commentManager.renderComments(0);</script> <div id='comment_form' class='commentform'> <a name='commentform'></a> <div id='divCommentShow'></div> <div id='comment_nav'><span id='span_refresh_tips'></span><a href='javascript:void(0);' onclick='return RefreshCommentList();' id='lnk_RefreshComments' runat='server' clientidmode='Static'>刷新评论</a><a href='#' onclick='return RefreshPage();'>刷新页面</a><a href='#top'>返回顶部</a></div> <div id='comment_form_container'></div> <div class='ad_text_commentbox' id='ad_text_under_commentbox'></div> <div id='ad_t2'></div> <div id='opt_under_post'></div> <div id='ad_c1' class='c_ad_block'></div> <div id='under_post_news'></div> <div id='under_post_kb'></div> <div id='HistoryToday' class='c_ad_block'></div> <script type='text/javascript'> $(function () { setTimeout(function () { incrementViewCount(cb_entryId); }, 50); deliverAdT2(); deliverAdC1(); loadNewsAndKb(); loadBlogSignature(); LoadPostInfoBlock(cb_blogId, cb_entryId, cb_blogApp, cb_blogUserGuid); GetPrevNextPost(cb_entryId, cb_blogId, cb_entryCreatedDate); loadOptUnderPost(); GetHistoryToday(cb_blogId, cb_blogApp, cb_entryCreatedDate); }); </script> </div> </div><!--end: forFlow --> </div><!--end: mainContent 主体内容容器--> <div id="sideBar"> <div id="sideBarMain"> <!--done--> <div class="newsItem"> <h3 class="catListTitle">公告</h3> <div id="blog-news"></div><script type="text/javascript">loadBlogNews();</script> </div> <div id="blog-calendar" style="display:none"></div><script type="text/javascript">loadBlogDefaultCalendar();</script> <div id="leftcontentcontainer"> <div id="blog-sidecolumn"></div><script type="text/javascript">loadBlogSideColumn();</script> </div> </div><!--end: sideBarMain --> </div><!--end: sideBar 侧边栏容器 --> <div class="clear"></div> </div><!--end: main --> <div class="clear"></div> <div id="footer"> <!--done--> Copyright &copy;2016 星火卓越 </div><!--end: footer --> </div><!--end: home 自定义的最大容器 --> </body> </html>

你可能感兴趣的:(xml中处理特殊字符和转义字符)