![](/img/trans.png)
[英]The xsd.exe generated C# class from the W3C XMLschema.xsd (the schema for xsd validation) is not accepted by the C# XmlSerializer
[英]W3C validation for Twitter widget
我在我的應用程序 [asp.net c#] 中使用Twitter Widget
。 我的代碼是:
StringBuilder strTwittsViewer = new StringBuilder();
strTwittsViewer.Append("</span><span class='cssClassFollowButton'><a href=\"https://twitter.com/Shree\" class=\"twitter-follow-button\" data-show-count=\"false\">Follow @Shree</a>");
strTwittsViewer.Append("<script type='text/javascript'>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"//platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script></span></p>");
但是我的代碼無法通過W3C 驗證。我得到了一個錯誤there is no attribute "data-show-count" …witter-follow-button" data-show-count="false">Follow @shree</a><script typ…
我搜索並找到了這個解決方案,但無法理解如何用我的代碼實現這個解決方案。謝謝。
因為數據屬性是HTML 5 規范的一部分。 使用<!DOCTYPE html>
指定 HTML 5 文檔類型
取自這里
要么
將您的鏈接代碼放入 document.write 中,這樣您就可以
strTwittsViewer.Append(@"<script language=""javascript"" type=""text/javascript"">");
strTwittsViewer.Append(@"//<![CDATA[");
strTwittsViewer.Append(@"document.write('<span class=""cssClassFollowButton""><a href=\""https://twitter.com/Shree\"" class=\""twitter-follow-button\"" data-show-count=\""false\"">Follow @Shree</a>"");");
strTwittsViewer.Append(@"//]]>");
strTwittsViewer.Append(@"</script>");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.