Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Web Tools Guide
Previous Page Home Next Page

Working with XML templates

XML content assist provides a comment template, a section of predefined code that you can insert into a file. You may find a template useful when you have a certain piece of code you want to reuse several times, and you do not want to write it out every time.

You can use a default template as provided, customize that template, or create your own templates.

For example, you can work on a group of XML pages that should all contain a table with a specific appearance. Create a template that contains the tags for that table, including the appropriate attributes and attribute values for each tag. (You can copy and paste the tags from a structured text editor into the template's Pattern field.) Then select the name of the template from a content assist proposal list whenever you want to insert your custom table into an XML file.

To create a new XML template, complete the following steps:

  1. Click Window > Preferences and select XML > XML Files > Templates .
  2. Click New if you want to create a completely new template.
  3. Supply a new template Name and Description.
  4. Specify the Context for the template. This is the context in which the template is available in the proposal list when content assist is requested.
  5. Specify the Pattern for your template using the appropriate tags, attributes, or attribute values to be inserted by content assist.
  6. If you want to insert a variable, click the Insert Variable button and select the variable to be inserted. For example, the date variable indicates the current date will be inserted.
  7. Click OK and then Apply to save your changes.
You can edit, remove, import, or export a template by using the same preferences page. If you have modified a default template, you can restore it to its default value. You can also restore a removed template if you have not exited from the workbench since it was removed.

If you have a template that you do not want to remove but you no longer want it to appear in the content assist list, clear its check box in the table on the Templates preferences page.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire