Editing XML Files
Extensible Markup Language (Xml) is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable.
Markup and content
By definition an Xml document is a string of characters (ie a text document) divided into markup and content. Strings that constitute markup starts with the character « < » and ends with a « > » or they begin with the character « & » and ends with an « ; ». Strings of characters that are not markup are content. However, in a CDATA section, the delimiters <![CDATA[ and ]]> are classified as markup, while the text between them is classified as content.
Tag
A markup construct that begins with < and ends with >. Tags come in three flavors:
| > | start-tags; for example: <section> |
| > | end-tags; for example: </section> |
| > | empty-element tags; for example: <line-break /> |
Element
A logical document component which either begins with a start-tag and ends with a matching end-tag or consists only of an empty-element tag. The characters between the start- and end-tags, if any, are the element's content, and may contain markup, including other elements, which are called child elements. An example of an element is <Greeting>Hello, world.</Greeting> (see hello world). Another is <line-break />.
Attribute
A markup construct consisting of a name/value pair that exists within a start-tag or empty-element tag. In the example (below) the element img has two attributes, src and alt:
<img src="madonna.jpg" alt='Foligno Madonna, by Raphael' />
Another example would be
<step number="3">Connect A to B.</step>
where the name of the attribute is "number" and the value is "3".
An XML attribute can only have a single value and each attribute can appear at most once on each element. In the common situation where a list of multiple values is desired, this must be done by encoding the list into a well-formed XML attribute with some format beyond what XML defines itself. Usually this is either a comma or semi-colon delimited list or, if the individual values are known not to contain spaces, a space-delimited list can be used.
<div class="inner greeting-box" >Hello!</div>
where the attribute "class" has both the value "inner greeting-box" and also indicates the two CSS class names "inner" and "greeting-box".
XML declaration
XML documents may begin by declaring some information about themselves, as in the following example:
<?xml version="1.0" encoding="UTF-8"?>
Escaping
XML provides escape facilities for including characters which are problematic to include directly. For example:
| > | The characters "<" and "&" are key syntax markers and may never appear in content outside a CDATA section. |
| > | Some character encodings support only a subset of Unicode. For example, it is legal to encode an XML document in ASCII, but ASCII lacks code points for Unicode characters such as "é". |
| > | It might not be possible to type the character on the author's machine. |
| > | Some characters have glyphs that cannot be visually distinguished from other characters: examples are |
| ● | non-breaking space ( ) " " compare space ( ) " " |
| ● | Cyrillic Capital Letter A (А) "А" compare Latin Capital Letter A (A) "A" |
| > | There are five predefined entities: |
| ● | < represents "<" |
| ● | > represents ">" |
| ● | & represents "&" |
| ● | ' represents ' |
| ● | " represents " |
All permitted Unicode characters may be represented with a numeric character reference. Consider the Chinese character "中", whose numeric code in Unicode is hexadecimal 4E2D, or decimal 20,013. A user whose keyboard offers no method for entering this character could still insert it in an XML document encoded either as 中 or 中. Similarly, the string "I <3 Jörg" could be encoded for inclusion in an XML document as "I <3 Jörg".
"�" is not permitted, however, because the null character is one of the control characters excluded from XML, even when using a numeric character reference. An alternative encoding mechanism such as Base64 is needed to represent such characters.
Comments
Comments may appear anywhere in a document outside other markup. Comments cannot appear before the XML declaration. Comments start with "<!--" and end with "-->". For compatibility with SGML, the string "--" (double-hyphen) is not allowed inside comments; this means comments cannot be nested. The ampersand has no special significance within comments, so entity and character references are not recognized as such, and there is no way to represent characters outside the character set of the document encoding.
An example of a valid comment: "<!--no need to escape <code> & such in comments-->"
Schema and validation
An Xml document is well-formed when it satisfies the list of syntax rules provided in the Xml specification:
| > | The document contains only properly encoded legal Unicode characters |
| > | None of the special syntax characters such as < and & appear except when performing their markup-delineation roles |
| > | The begin, end, and empty-element tags that delimit the elements are correctly nested, with none missing and none overlapping |
| > | The element tags are case-sensitive; the beginning and end tags must match exactly. |
| > | Tag names cannot contain any of the characters !"#$%&'()*+,/;<=>?@[\]^`{|}~, nor a space character, and cannot start with -, ., or a numeric digit. |
| > | A single "root" element contains all the other elements. |
In addition to being well-formed and Xml document may be valid. It means it contains a reference to a document type definition (DTD) or a schema and that its elements and attributes are declared in that DTD or schema and follow the grammatical rules that the DTD or the schema specifies.
Xml editors
A lot of Xml editing software exists with various prices and features available.
We recommend to use Notepad++ for Xml editing. This free software propose syntax highlighting and after downloading the XML Tools plugin you will be able to check you xml files.