Engineering Full Stack Apps with Java and JavaScript
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.
<?xml version="1.0" encoding="UTF-8"?>
<Employee>
<id>001</id>
<name>Jacob</name>
<age>31</age>
<salary>1000000</salary>
</Employee>
XML is both human-readable and machine-readable.
XML was designed to store and transport data.
XML is a W3C Recommendation
XML is similar to HTML, but they are different
XML focus on structure of data, while HTML focus on displaying data
HTML has predefined tags, but XML has no predefined tags.
XML has a strict syntax compared to HTML.
An XML document is a string of characters. Almost every legal Unicode character may appear in an XML document.
Unicode is a computing industry standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems.
The latest version of Unicode contains a repertoire of more than 120,000 characters.
The standard consists of a set of code charts for visual reference, an encoding method and set of standard character encodings, a set of reference data files, and a number of related items
UTF-8 is the default character encoding for XML documents.
The characters making up an XML document are divided into markup and content.
Generally, strings that constitute markup either begin with the character < and end with a >, or they begin with the character & and end with a ;.
Strings of characters that are not markup are content.
E.g. In the above example, id is part of markup while 001 is content.
A markup construct (tags) that begins with < and ends with >.
Tags come in three flavors:
start-tags
e.g. <section>
end-tags
e.g. </section>
empty-element tags
e.g. <line-break />
A logical document component which either begins with a start-tag and ends with a matching end-tag is called as a element.
May consist only of an empty-element tag.
A start-tag or an empty-element tag, may contain key/value pairs of data called as attributes.
<Employee id ="001">
XML documents may have a description about itself called as prolog.
E.g. <?xml version="1.0" encoding="UTF-8"?>
If it exists, it must come first in the document.
UTF-8 is the default character encoding for XML documents.
XML has strict set of rules
All XML Elements Must Have a Closing Tag
XML Tags are Case Sensitive
XML Elements Must be Properly Nested
XML Attribute Values Must be Quoted
Some characters have a special meaning in XML (e.g. <). They should be replaced with an entity reference.
E.g. You can replace the "<" character with an entity reference: <
Please go throgh the attached reference links to learn more about XML.