Creating XML files

You can create a new, empty XML file, which you can then edit in the XML editor. When you create a new, empty XML file, it is not associated with a DTD or XML schema file, so there are no restrictions on the kind of content it can contain.

Before you begin

About this task

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

To create a new, empty XML file, follow these instructions:

Procedure

  1. If necessary, create a project to contain the XML file. 
  2. In the workbench, click File > New > Other > XML > XML and click Next. If you cannot see the XML option, select the Show All Wizards check box.
  3. If you are prompted to enable XML Development capabilities, click OK.
  4. Click the Create XML file from scratch radio button.
  5. Click Next.
  6. Select the project or folder that will contain the XML file.
  7. In the File name field, type the name of the XML file, for example MyXMLFile.xml. The name of your XML file must end in .xml.
  8. Click Finish.

Results

The XML file appears in the Navigator view and, by default, automatically opens in the XML source page editor. The XML source page editor offers limited functionality compared to the XML editor, so before editing the file, you should close it, then right-click the file in the Navigator view and click Open With > XML Editor to open the file in the XML editor.

To make the XML editor the default editor for XML files, select Window > Preferences > Workbench > File Associations, then select *.xml and XML Editor from the Associated Editors list. Click Default, then click OK.

What to do next


Feedback