Validating Your Code


To validate your code is to make sure that it conforms to the W3C standards for whatever version of HTML or XHTML your page is in. There are a number of reasons for validating, but the most important is that if your page is valid, it's more likely to render better in more browsersan amazing number of the page display errors we've seen could have been solved by making the site validate before it was uploaded to a live server.

To validate your HTML page:

  • From Dreamweaver's menu, select File > Check Page > Validate Markup ( Figure 15.40 ).

    Figure 15.40. This menu lets you validate both HTML and XHTML pages.

    or

    Press Shift-F6.

    or

    Click the Validate Markup button on the Document toolbar. A pop-up menu appears; from it, choose Validate Current Document ( Figure 15.41 ).

    Figure 15.41. This menu lets you validate both HTML pages and sites, but no XHTML.

    or

    Click the green arrow in the top-left corner of the Validation tab of the Results panel. A pop-up menu appears; from it, choose Validate Current Document ( Figure 15.42 ).

    Figure 15.42. The Validate button on the Validation tab can also check your HTML.

    The validation report appears in the Validation tab of the Results panel.

To validate your XHTML page:

  • From Dreamweaver's menu, select File > Check Page > Validate as XML (Figure 15.40). The validation report appears in the Validation tab of the Results panel.

To use the validation report:

1.
After you validate your page (by one of the above methods ), the validation report appears in the Validation tab of the Results panel, displaying all of the errors and warning messages your page has generated ( Figure 15.43 ).

Figure 15.43. Validating this page resulted in a variety of different errors, messages, and warnings.


There are four types of messages:

Errors : These are things that you have to fix in order for your page to be valid.

Warnings : These are things you should look at, but they aren't mandatory.

Nesting errors : This is still an error that has to be fixed, but it's a specific type of error: it's displayed when there's a problem with nested tags. If an end tag wasn't found to close an opened tag, or if an <img> tag didn't end with a /> in an XHTML file, a nesting error would be shown.

Messages : These are less serious than warnings, but things that Dreamweaver still thinks you should know about. If your HTML page is error-free, you'll get a message saying so (if your XHTML page is error-free, you'll get nothing at all).

2.
To go to the problem line, double-click the error, and focus will shift to that line in the document. If you were in Design view when you did this, you'll be placed in Split view.

3.
To get more information about an error, or just to see it in a reasonably sized font, select the error in the Validation tab and then click the More Info button on the left toolbar of the panel. A Description dialog appears ( Figure 15.44 ). Click OK to close the dialog.

Figure 15.44. Clicking the More Info button gives you the error's Description dialog.


4.
If you want to view the full report, click the Browse Report button on the left toolbar. A browser window opens displaying each error, along with its category, description, line number, and file location ( Figure 15.45 ).

Figure 15.45. Viewing the error report launches a browser and displays all the errors, warnings, and messages.


5.
If you want to save the report for later, click the Save Report button on the left toolbar. You'll then see the standard Save As dialog, prompting you to save a new XML file.

Tips

  • As shown in Figures 15.41 and 15.42, you can also choose to validate the entire current local site or selected files in site. If you start this process and then decide to cancel it, click the Stop button on the left toolbar.

  • If your site contains any XHTML pages, validating the entire site will cause many false errors to appear. Sadly, there doesn't appear to be a way to do sitewide validation if the site contains any XHTML files.





Macromedia Dreamweaver 8 for Windows & Macintosh Visual QuickStart Guide
Macromedia Dreamweaver 8 for Windows & Macintosh
ISBN: 0321350278
EAN: 2147483647
Year: 2005
Pages: 239

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net