Forum Moderators: open

Message Too Old, No Replies

Find out which pages use tables on website

         

Darkelve

11:57 am on Jul 23, 2009 (gmt 0)

10+ Year Member



Is there a way to find out which pages have tables inside of a specific <div>?

The website I need this for is huge so I don't want to go through it manually.

swa66

12:10 pm on Jul 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That requires parsing the html.

IF (and it's a big one) you used xhtml and it's guaranteed to be well structured (read: validates) you could use xml tools to do the parsing.

Otherwise you'll always have a chance for false decisions based on not so well structured input into the parser.
But a parser might look like:
- remove comments

- skip to the interesting div
- set level to 0
- start reading input and copy it to output
- if you meet a <div>: level++
- if you meed a </div>: level-- ; if level<0: skip till end.

Look at output to see it there's a <table> inside: if so: flag it

penders

3:25 pm on Jul 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does your editor support searching mutliple files (inc sub directories) for a regular expression? If so, you might (if suitably structured - see above) be able to construct an appropriate regexp to do the job?

(Notepad++ supports this)