Does anyone know of a tool that breaks down your code into a tree structure so if I put in something like <html> <head> bla bla </head> <body> <table> <tr><td> bla bla bla bla</td></tr> <tr><td> bla bla nbla </td></tr> </table> </body> </html> It would return something like <table> <tr> <td></td> <td></td> </tr> </table> Cheers
Hi, It could be fairly easily made. What do you need it for? If you are after a detailed tree representation of the document structure then look no further than Firefox's DOM Inspector tool. It also highlights elements on the page as you select them from the DOM inspector. If on the other hand you simply want to strip out non-tag content you could do that fairly easily with one or two regular expressions, maybe on a PHP page. Say // Remove content data preg_replace('#<(.*)>(.+?)</(.*)>#s', '<$1></$3>', $code); // Remove attributes preg_replace('#<([ ]{0,})([^ ]{1,})(.*)>#'), '<$2>', $code); PHP: Untested, just a thought. - P
Hello I use homesite 4.5 (note: 4.5 is not the latest version) and homesite has a "Tag Inspector" tab that renders a tree view of the code. This isn't exactly what you asked about, but I thought you might find it interesting. I've attached a picture of it.
In FireFox goto Tools > DOM Inspector and you'll find the entire tree under HTML. Because the source is free you can get the complete tree structure for all tags from Mozilla source. But its in c++ I guess.