Remove most HTML Attributes
Posted: Wed Jun 17, 2009 12:40 pm
Hi All!
I've got a script that is trying to interface with an ASP application, and the application is generating some pretty messy code. I've gotten most everything working, but one thing I'm dealing with before inserting the results in to my page, is that it's writing inline CSS and/or using old html style attributes.
Anyone know a good way of removing these? I figure it will be easier to say "let's remove everything except src= alt= href= action= target= " than "let's remove [insert incredibly long list of things like cellspacing= here]". That said, if you can give me code to remove a specific HTML attribute, I will deal with it! A function that I can pass in an attribute or an array of attributes and have them removed would also be a godsend right now!
Well, I'm sorry for the brief post, I hope I was clear.
Thank you all for your time and help!
-OmniUni
I've got a script that is trying to interface with an ASP application, and the application is generating some pretty messy code. I've gotten most everything working, but one thing I'm dealing with before inserting the results in to my page, is that it's writing inline CSS and/or using old html style attributes.
Anyone know a good way of removing these? I figure it will be easier to say "let's remove everything except src= alt= href= action= target= " than "let's remove [insert incredibly long list of things like cellspacing= here]". That said, if you can give me code to remove a specific HTML attribute, I will deal with it! A function that I can pass in an attribute or an array of attributes and have them removed would also be a godsend right now!
Well, I'm sorry for the brief post, I hope I was clear.
Thank you all for your time and help!
-OmniUni