Skip navigation

Today, as I was coding away at one of my projects, I found myself writing the same code as I had written before, the code in question was producing a couple of html pages.

So I decided to turn it into a .NET  library, 20 minutes later [the imaginatively named] HTMLTools was born.

As with most of my personal projects, It has no XML documentation, it should be easy enough to understand and work with. To produce a simple web page with a heading, this is what you would write:

using Josh.HTMLTools.HTMLGeneration;

class Program
{
static void Main(string[] args)
{
List<IHtmlElement> elements = new List<IHtmlElement>();

elements.Add(new GenericHtmlElement(“h1”, “Hello world”));

HtmlPage page = new HtmlPage(“test”, elements);

page.SavePage(“Test.html”);
}

This will also save the page as Test.html in your program’s working directory.

here is the download link.

(yes I do realise that SingleTagElementType is completely random and has no use, I was planning to implement a feature that I decided to leave out for this release, after I uploaded it to Assembla)

as with most of my programs, you are free to do whatever with it, just give me some credit if possible.

If you have any questions or anything, feel free to leave a comment or send me an email (jhektor %at% gmail _dot com)

Advertisements

One Comment

  1. Are you aware of the HTMLTextWriter class? Pretty much does what you have done, albiet in a slightly more verbose manner.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: