|
||||
|
|
HTML to XHTML Batch Page Conversion and Testing
You'll probably notice that a great many of your pages contain the same errors. You don't have to edit these all individually; there are freely available tools at your disposal to ease the workload (at least on Linux and BSD systems). For batch conversion of large numbers of files, you may want to try the "sed" tool in your favorite shell. Sed stands for Stream EDitor, meaning it's designed to edit streams of text (in our case, the contents of text files containing XHTML code). Refer to the referenced link for a great introduction to the tool; its full power is beyond the scope of this article. If you like, you can give my personal Perl batch file conversion script a try. Set the variables for your directory location, search text, and replace text. Run the script at your shell prompt, and watch as the requested changes are applied recursively through all your subdirectories. While useful, this tool is limited in functionality; feel free to extend it to meet your own needs. Updating Text in DatabasesMany sites store some or all of their page content in databases, which would seem to complicate the problem of site conversion. Lucky for us, there's a simple SQL statement that can be used to update text in database tables: update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’); Even if you need to update a large number of tables, you may want to consider taking things slowly and testing the results as you go. It's a lot easier to roll back one change than a dozen. Testing Your Pages in Multiple BrowsersYou'll want to be sure your newly edited pages render appropriately in as many web browsers as possible, with a heavy focus on IE6-8, Mozilla Firefox, Opera 9/10, and Safari. Many developers don't have a row of separate computers sitting next to them, so they use services like BrowserShots.org to see screen captures of their pages rendered in various browsers. You're bound to find a few cases where your code is technically correct, but it doesn't render properly in one browser or another. A little time spent with Google searching for "browser workarounds" will prove informative in many of these cases.
In Conclusion...Converting a site to comply with more modern Web standards takes time, but it's well worth the effort. Of course, it's always best to test your content for validity as you develop it. If you have any questions about your own conversion process, or a correction to this article, please feel free to email the author.
|
|||
| All contents Copyright © 2007-2009 ClassHelper.org®. Please see our Privacy Policy. | ||||