Partilhar via


Customizing IntelliSense

If you've worked with Code view in FrontPage 2003, you've undoubtedly come to appreciate IntelliSense. But what if you need an element or attribute that isn't included in any of the default HTML schemas? For example, W3C accessibility guidelines include a headers attribute for TD elements. If you frequently use the headers attribute, love hand coding, and are tired of typing "headers" everytime you need to insert this attribute, this tip is for you.

Background

FrontPage uses XSDs (XML Schema Definition documents) to provide IntelliSense in Code view.  In fact, this is the same as what Visual Studio uses to provide IntelliSense for HTML and XML schemas, and FrontPage even uses many of the schema annotations that Visual Studio uses.  Schema annotations are contained in the schema definition (i.e., <xsd:schema ... >) listed at the beginning of an XSD.  (For more information, see Visual Studio .NET Schema Annotations.) However, you should note that FrontPage does not use all of these annotations, so be careful using annotations or annotation values other those included in existing FrontPage IntelliSense schemas.

In addition, FrontPage provides IntelliSense only for HTML (including XHTML), not XML. So if you are inclined to playing with this feature by adding custom elements or using a custom XML schema, you may quickly find that IntelliSense for a selected schema won't function as expected or desired. However, making simple changes to existing HTML schema files (which I show you how to do in the procedure below) allows you to create some custom HTML IntelliSense.

You should also keep in mind that although changes you make may validate in Visual Studio or another XSD editor, FrontPage may not be able to understand them, which more than likely will break IntelliSense for all documents that use that schema.  Whenever possible, work with the XSD source code (such as in Notepad or XML view in Visual Studio) rather than with a visual XSD designer and make simple changes.

Note   Breaking IntelliSense does not mean that IntelliSense will not work at all. Rather, IntelliSense won't work for documents that use a specific IntelliSense schema that FrontPage doesn't understand.  IntelliSense will work for other IntelliSense schemas.  Simply select a different schema from the Schema Version option on the Authoring tab of the Page Options dialog box.

More important things to remember when playing with IntelliSense schemas are

  • always copy the schema file so that you don't overwrite the original schema making it impossible to recover the original schema without reinstalling FrontPage 
  • always change the vs:friendlyname annotation value at the beginning of the XSD so that you can differentiate between existing schemas and your custom schema (this value shows up under Schema Version on the Authoring tab of the Page Options dialog box)
  • don't make too many changes before testing the schema in FrontPage (and always create a backup of your changes XSD before making additional changes in case an additional change breaks Intellisense)
  • never replace an existing schema with a custom schema (just in case a future service pack or update replaces this file, destroying all of your changes)

Procedure

Okay, now that you know all the gochas, the following instructions explain how to add the headers attribute to a custom IntelliSense schema.  You can use these basic instructions to create additional IntelliSense schemas for FrontPage.

  1. Close FrontPage.
  2. Open Windows Explorer and navigate to:
    C:\Program Files\Common Files\Microsoft Shared\OFFICE11\SCHEMAS\HTML
    This folder contains the schema and type libraryfiles that FrontPage uses for IntelliSense. All the XSD files are IntelliSense. For example, ie3_2nav3_0.xsd contains IntelliSense for IE 3.2 and Netscape Navigator 3.0.
  3. Copy IE5_0.xsd and change the name of the copied file to IE5_0_Modified.xsd. Copying makes sure that you don't overwrite the original file. DO NOT SKIP THIS STEP.
  4. Open the new file in Notepad.
    Note You can also use Visual Studio or another XSD editor. However, you should note that if you use something other than Notepad, you will need to view the source of the XSD in order to follow the remaining instructions.)
  5. In Notepad, turn off Word Wrap (Format menu). (This makes the schema easier to read and work with.)
  6. In the opening XSD statement, locate vs:friendlyname="Internet Explorer 5.0" and add the word "Modified" to the friendly name so that it reads: vs:friendlyname="Internet Explorer 5.0 Modified"
  7. Search for: name="td"
  8. Scroll down to the list of attributes for the TD element.
  9. Add a new attribute for "headers". For example, add the following text under one of the existing attributes. (I placed it beneath the id attribute, but you can put it beneath any attribute for the TD element as long as you don't add it between the opening and closing tags of the attribute element for another HTML element.)
    <xsd:attribute name="headers" />
  10. Save the file.
  11. Start FrontPage.
  12. From the Tools menu, select Page Options.
  13. On the Authoring tab, under Schema Version (at the bottom of the dialog box), select Internet Explorer 5.0 Modified.

If you did everything right, when you add a TD element in Code view, you will find the headers attribute listed in the IntelleSense. The IntelliSense feature in FrontPage is very sensitive, so if you don't follow these instructions exactly, it may break Intellisense for your schema. Also, you can't make changes to the XSD while FrontPage is opened (or rather you can, but if you do, Intellisense will not function properly). You need to reboot FrontPage before IntelliSense schema changes take effect.

Comments

  • Anonymous
    April 21, 2006
    This was very helpful - thanks