Reserved characters and namespacesCaractères réservés et espaces de noms

Two points of syntax turn up in every interchange file. Recognizing them saves you a headache later, over strange characters in the text or a file that no longer opens the way it should.

Reserved characters

Angle brackets delimit tags: a < in text would be read as the start of a tag. XML therefore gives it a replacement spelling, and gives the ampersand one too, since every replacement begins with an ampersand:

In the textWritten in the file
<&lt;
&&amp;

>, " and ' have replacement spellings too (&gt;, &quot;, &apos;), required only in certain contexts; tools often write them anyway.

In practice: a company called Smith & Sons appears in the file as Smith &amp; Sons, and the translation is written the same way. Do not replace &amp; with & by hand, you would break the file.

Namespaces

The first tag tagbalise markupbalisage A marker that delimits and identifies an element in a markup document, usually working as a pair: an opening tag and a closing tag around the content they label.Marqueur qui délimite et identifie un élément dans un document balisé, fonctionnant généralement par paire : une balise ouvrante et une balise fermante autour du contenu qu'elles désignent. of an XLIFF XML Localization Interchange File Format (XLIFF)XML Localization Interchange File Format (XLIFF) exchange formatsformats d'échange The XML-based bilingual format for passing content through a localization workflow: source and target segments travel together with workflow metadata such as translation status, rather than exchanging linguistic resources.Format bilingue fondé sur XML pour faire circuler du contenu dans un flux de localisation : segments source et cible voyagent ensemble, avec des métadonnées de flux de travail comme le statut de traduction, contrairement aux formats d'échange de ressources linguistiques. file looks like this:

<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.1"
       srcLang="en-CA" trgLang="fr-CA">

xmlns announces that <unit>, <segment> and the other tags that follow are XLIFF’s, and not those of some other format using the same names. A document can declare several namespaces, each marked by a prefix of the form prefix:tag. This is how a tool adds tags of its own to a standard format without colliding with it, and it is also a source of trouble in exchange: a tool that does not know that vocabulary will get nothing out of those tags.

One namespace is declared in advance by the XML standard itself, the one for the xml prefix. That is why xml:lang appears everywhere with no matching declaration in the file.

Written alternately in EN and FR, translation partly generated in both directions. Rédigé en alternance en EN et en FR, traduction en partie générée dans les deux sens. Updated 2026-08-26

Deux détails de syntaxe reviennent dans tous les fichiers d’échange. Les reconnaître vous évitera bien des ennuis devant des caractères étranges ou un fichier qui ne s’ouvre plus comme il devrait.

Caractères réservés

Les chevrons délimitent les balises : un < dans du texte serait lu comme le début d’une balise. XML lui prévoit donc une écriture de remplacement, et à l’esperluette aussi, puisque chaque remplacement commence par une esperluette :

Dans le texteS’écrit dans le fichier
<&lt;
&&amp;

>, " et ' ont eux aussi une écriture de remplacement (&gt;, &quot;, &apos;), obligatoire seulement dans certains contextes ; les outils les écrivent souvent par prudence.

En pratique : une entreprise nommée Smith & Sons apparaît dans le fichier sous la forme Smith &amp; Sons, et la traduction s’écrit de la même façon. Ne remplacez pas &amp; par & à la main, vous casseriez le fichier.

Espaces de noms

La première balise tagbalise markupbalisage A marker that delimits and identifies an element in a markup document, usually working as a pair: an opening tag and a closing tag around the content they label.Marqueur qui délimite et identifie un élément dans un document balisé, fonctionnant généralement par paire : une balise ouvrante et une balise fermante autour du contenu qu'elles désignent. d’un fichier XLIFF XML Localization Interchange File Format (XLIFF)XML Localization Interchange File Format (XLIFF) exchange formatsformats d'échange The XML-based bilingual format for passing content through a localization workflow: source and target segments travel together with workflow metadata such as translation status, rather than exchanging linguistic resources.Format bilingue fondé sur XML pour faire circuler du contenu dans un flux de localisation : segments source et cible voyagent ensemble, avec des métadonnées de flux de travail comme le statut de traduction, contrairement aux formats d'échange de ressources linguistiques. ressemble à ceci :

<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.1"
       srcLang="en-CA" trgLang="fr-CA">

xmlns annonce que <unit>, <segment> et les autres balises qui suivent sont celles de XLIFF, et non celles d’un autre format qui emploierait les mêmes noms. Un document peut déclarer plusieurs espaces de noms, chacun repéré par un préfixe de la forme prefixe:balise. C’est ainsi qu’un outil ajoute ses propres balises à un format normalisé sans entrer en conflit avec lui, et c’est aussi une source de difficultés à l’échange : un outil qui ne connaît pas ce vocabulaire ne tirera rien de ces balises.

Un espace de noms est déclaré d’avance par la norme XML elle-même, celui du préfixe xml. C’est pourquoi xml:lang apparaît partout sans déclaration correspondante dans le fichier.

Written alternately in EN and FR, translation partly generated in both directions. Rédigé en alternance en EN et en FR, traduction en partie générée dans les deux sens. Mise à jour 2026-08-30

Sources

Sources

Spotted an error? Une erreur ?

Language, content, a broken link: tell me what you saw and I will fix it. Langue, contenu, lien brisé : dites-moi ce que vous avez vu et je corrige.

Sending opens your mail app with the report addressed to me. L'envoi ouvre votre application de courriel avec le signalement déjà adressé à moi.