3

ある人がこのようなものをある言語で文字列のようなjsonを使って作成し、かなり良いhtmlを作成したプロジェクトを見たことがあります。C#または.NETに使用できるようなものはありますか

radio-box{ AName, [First|Second|Value:9|ItsLikeAnEnum]}, TextBox[user, password],
Checkbox[RememberMe:true, blah]}  //blah is default which is false
4

4 に答える 4

3

ASP.NETを使用している場合は、HTMLAgilityパックがあります。

HTMLを扱うための多くのヘルパーがあります。説明している形式とまったく同じではありませんが、生のHTMLを処理するよりも簡単です。

ウェブサイトから:

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).

于 2010-02-12T11:34:13.510 に答える
1

While it doesn't match the code sample in your question, but maybe you are looking for a templating language like NHaml? Here's a short NHaml example:

%h1 List of products
%ul
  - foreach (var product in products)
    %li= product.Name 

Is equivalent to:

<h1>List of products</h1>
<ul>
    <% foreach (var product in products) %>
        <li>
            <%= product.Name %>
        </li>
    <% } %>
</ul>
于 2010-02-12T12:06:04.397 に答える
0

正確には答えはありませんが、Asp.NetMVCにTagBuilderがあります。

于 2010-02-12T11:43:57.727 に答える
0

ASP.NET MVC を見ると、組み込みの html ヘルパー メソッドがたくさんありますが、それはそういう意味ですか?

http://www.asp.net/mvc

于 2010-02-12T11:40:44.993 に答える