GAMGI Formats: Introduction Headers

Introduction Headers
Headers are optional in XML, but when included, they must be written correctly. Although usefull to identify files, headers are a potencial source of spelling errors, so it is often better to not include them. Currently GAMGI includes full headers when exporting files. The complete GML header is written as:

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <!DOCTYPE gml SYSTEM "http://www.gamgi.org/dtd/gamgi.dtd">

The first line is the XML declaration, the second line is the Document Type declaration. Even when the XML declaration is present, the Document Type declaration is still optional, but when the Document Type declaration is present, then the XML declaration is required.

Absolutely nothing can appear in the file before the XML declaration, in the same line or above, not even white space. The encoding and standalone parameters in the XML declaration are optional, but when included, they must be written in the order above. Everything is case-sensitive, except the encoding value, which could have been written as "utf-8", for example. No white spaces can appear before xml.

The SYSTEM identifier "http://www.gamgi.org/dtd/gamgi.dtd" in the Document Type declaration is optional, but when included, it must be written as above. The DOCTYPE identifier gml, identifying the XML root element, must be present. No white spaces can appear before DOCTYPE.

### Good:

    <?xml version="1.0"?> the encoding and standalone attributes are optional
    <!DOCTYPE gml> the SYSTEM identifier is optional

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    the Document Type declaration is optional

### Bad:

    <?xml?> the version attribute is absent

    <?xml encoding="UTF-8" version="1.0" standalone="yes"?>
    the attribute order is wrong

    <? xml version="1.0"?> white space before xml

    <! DOCTYPE gml SYSTEM "http://www.gamgi.org/dtd/gamgi.dtd">
    white space before DOCTYPE

    <!DOCTYPE gml SYSTEM "http://www.gamgi.org/dtd/gamgi.dtd">
    the XML declaration is missing

Home