dotneter
dotneter

Reputation: 1689

Object model for html generation?

Something like

new Div
{
  new A{Href = "test", Content = "link"},
  new P("text"),
}.ToString() == "<div> <a href='test'> link </a> <p>text</p> </div>"

Upvotes: 1

Views: 123

Answers (3)

dotneter
dotneter

Reputation: 1689

There it is http://sharpdom.codeplex.com/

Upvotes: 1

Joel Martinez
Joel Martinez

Reputation: 47749

I agree with @klausbyskov, however that being said ... you might want to take a look at the HTML Agility Pack:
http://www.codeplex.com/htmlagilitypack

it's mostly for parsing, but it should be able to give you a writable HTML dom that you can use. it probably won't be the format/API you're asking for, but it may be close

Upvotes: 0

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 120937

I would go with the flow though and choose asp.net or asp.net MVC. Asp.net has an object model which is slightly (radically, really) different from your example, but it's part of the core .net framework and very well supported.

Upvotes: 0

Related Questions