Amaya

## Creating and opening documents

### Creating a new document

Amaya allows you to create both local and remote documents. Three types of documents are available:

- New document, to create a document including text, links, formulae, etc.
- New formula, to create a single mathematical formula
- New style sheet, to create a CSS style sheet

To create a document:

1. Choose New from the File menu, and then select the file type you want to create.
2. At the prompt, type the URI or the local path name of the new document (a default name is assigned to the document if no name is specified). You can use the file browser to find a local directory.
3. Choose the location of the new document : Replace current, In new tab or In new Window.
4. If you are creating a new XHTML document:
   - When a title of the new document is requested, Amaya generates a default title (the file name without the suffix). That title could be updated later by the Tools/Change title command.
   - If you plan to use a template, click the From template toggle and select a template, either by selecting in the list of registered templates or by typing the URI or file name of a template that is not in the list. To update the list of available templates, see Preferences/Templates
   - If you do not want to use a template, you may specify the Document profile of the new document (XHTML Transitional, XHTML 1.1, XHTML strict, XHTML basic, HTML transitional, Compound document). You may use the default profile proposed by Amaya.

     If you want to create a XHTML document including either MathML or SVG elements (Compound document), it is recommended to create a document file with a `.xml` suffix.

5. You may select a charset to encode strings in the document. Pay attention, if you plan to publish your document on a server, this charset should be selected in accordance with the Web server that will serve the document (contact your web master).
   By default `.html` pages are served with `iso-8859-1` and `.xml` pages are served with `utf-8`.
6. Click Create. The new document is open, and a root element is created.

### Opening a document

You can open local and remote documents in several ways:

File menu
  1. Choose Open document from the File menu.

     Note: You can alternately use a keyboard shortcut to open a document. Press `Ctrl-o ctrl-o`.

  2. In the Open document dialog, type the full path or URI of the file you want to open, or use the Browse button (a file icon) to open a file selection dialog.
  3. When the document is correctly specified, click Open.

  You can also use these steps to create a new local document, by specifying the name of a file that does not exist.

Files browser
  A file browser may be displayed in the tools area with Views > Show/Hide toolbars > Files. This tool gives access to all local directories. A simple click allows you to open or close a directory and a double click on a file name opens the corresponding document.
Document address field
  Note that this method works only if you have chosen a profile with the navigation feature.

  The address of the current document is displayed at the top of the window. Edit this address to specify the file name or the URI of the document you want to open and press `Enter`.

  You can also create a new document by typing the name of a document that does not exist yet.

  Note: You can click the button on the right side of the document address field to display the list of the documents you have opened recently. You can then select an address in this list to open the corresponding document.

Links
  By activating a link you load the target document.

Note about character sets

Amaya reads HTML and XHTML documents differently:

- Amaya reads HTML documents by default as ISO-Latin-1 files. If an author does not provide information about the character set (charset) in the HTTP header or in a `meta` element, Amaya considers an HTML document to be encoded in ISO-Latin-1.
- Amaya reads XHTML documents by default as UTF-8 files. If an author does not provide information about the charset in the HTTP header, in the XML declaration, or in a `meta` element, Amaya considers an XHTML document to be encoded in UTF-8.

Because the default charset is different for HTML and XHTML documents, authors often create documents using the incorrect charset. For example, consider an XHTML document that uses ISO Latin-1 but does not provide information about the charset. When the XML parser analyzing the document encounters a sequence of bits that does not match a valid UTF-8 character, the document is considered to be not well formed. Parsing stops and Amaya displays an error message that proposes either to reload the document as an HTML document or to show parsing errors. If show parsing errors is chosen, Amaya displays the detected errors.