asp.net mvc - Using regexes to process HTML of a *known structure* -


we're using custom framework built on top of asp.net mvc generate html our object models @ runtime without writing views. approach has been successful in allowing rapid application development , maintaining uniform , feel across multiple applications.

for couple of pages in our current application however, framework has been generating extraneous h2 , h3 tags no content, lead application failing qa testing.

the viable long-term solution fix framework. we're supposed go qa in couple days, , i'm tempted use regex strip out offending tags rendered html.

i realize kludge, viable short-term solution, until figure out why framework misbehaving? please note group (building app) not same group maintains framework. latter group might fix issue tomorrow, or might fix in month - have no control on timing.

a few considerations:

  1. it frowned upon use regexes process html. while understand regexes not adequate handle general case of parsing arbitrary html, problematic use regex modify html exact structure known in advance?

  2. given step carried out every time page loads, there significant performance cost this? we're looking @ stripping out 2 or 3 tags here.

thanks in advance!

  1. no
  2. keep in mind regex don't know have 2 or 3 replacements in specifics places , process html content. keep in mind if want remove <h2></h2> or <h3></h3> don't need regex , can use simple string replace. if know these tags in tree, can use xpath or dom feature find them , remove them. must make tests find best way.

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -