(x)HTML validator script? (VB.net preferred)

  • Thread starter Thread starter darrel
  • Start date Start date
D

darrel

I have built a CMS for a client and he now wants to add his own meta tags to
each page. I don't want to deal with making separate DB fields for every
potential meta tag and I figure that more advanced users might want to add
their own other tags anyways (LINK or JAVASCRIPT, etc.)

So, I was thinking of just providing a plain-text field and let them put in
any (x)HTML they would like to have appear custom on that particular page's
HEAD area.

The catch, of course, is that if they don't know what they're doing, they
could break the page by putting invalid markup or improper tags in there.

What I'm looking for (ideally) is a script/function that could validate the
content to make sure that:

a) it's valid markup
b) (even better) it only includes tags that are allowed within the HEAD
tags.

I'm thinking it'd be some sort of regular expression that could loop through
an array of allowed tags.

Anyone know of such a thing?

-Darrel
 
I have built a CMS for a client and he now wants to add his own meta tags to
each page. I don't want to deal with making separate DB fields for every
potential meta tag and I figure that more advanced users might want to add
their own other tags anyways (LINK or JAVASCRIPT, etc.)

So, I was thinking of just providing a plain-text field and let them put in
any (x)HTML they would like to have appear custom on that particular page's
HEAD area.

The catch, of course, is that if they don't know what they're doing, they
could break the page by putting invalid markup or improper tags in there.

What I'm looking for (ideally) is a script/function that could validate the
content to make sure that:

a) it's valid markup
b) (even better) it only includes tags that are allowed within the HEAD
tags.

I'm thinking it'd be some sort of regular expression that could loop through
an array of allowed tags.

Anyone know of such a thing?

-Darrel

Darrel, take a look at the following ASP.NET 2 module
http://www.thejoyofcode.com/Validator_Module.aspx

(a source code is available)
 
Back
Top