- XML stands for EXtensible Markup Language
It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
source: Wikipedia
- this is an (opening) tag:
<someName>
- this is a closing tag:
</someName>
- this is a tag:
<someName>some content</someName>
- this is an empty tag:
<someName/>
- attributes only live inside opening tags
- this is an attribute with a value:
<someName attribute="value">
- can be named arbitrarily, just avoid any special characters see Rules for Naming Tags and Attributes
Tip
Your XML-Editor should know the rules and inform you in case of any violation
<tag>text</tag>
<parent>
<child></child>
</parent>
<parent>
<child></parent>
</child>
<
should be written as<
>
should be written as>
&
should be written as&
'
should be written as'
"
should be written as"
(generated by GitHub-Copilot using GPT 4o)
- Start with a letter or underscore: Names must start with a letter (a-z or A-Z) or an underscore (_).
- They cannot start with a number or punctuation character.
- Follow with letters, digits, hyphens, underscores, and periods: After the initial character, names can include letters, digits (0-9), hyphens (-), underscores (_), and periods (.).
- No spaces: Names cannot contain spaces.
- Case-sensitive: XML names are case-sensitive. For example,
<Tag>
and<tag>
are considered different tags. - Avoid XML reserved words: Names should not match XML reserved words like xml, XML, Xml, etc.
Names cannot start with a number or punctuation character. Names cannot contain spaces. Names cannot contain the following characters: !, @, #, $, %, ^, &, *, (, ), +, =, {, }, [, ], |, , :, ;, ", ', <, >, ,, ?, /.
<tagName>content</tagName>
<_tagName>content</_tagName>
<tag-name>content</tag-name>
<tag.name>content</tag.name>
<tag123>content</tag123>
<123tag>content</123tag> <!-- Starts with a number -->
<tag name>content</tag name> <!-- Contains a space -->
<tag!name>content</tag!name> <!-- Contains an exclamation mark -->