Formats: XML

Written by

in

,

What is XML? It’s a document format.

The following is how I understand it.

XML is used to format documents that need to impart specific information. Somewhat like html, XML places the information between tags that classify it.

An XML document will typically start with a document declaration such as <?xml version=‘1.0’ encoding=‘UTF-8’?>. For that declaration only, the question marks serve to nest it.

Next, the XML document needs what’s called a root element. All other elements will appear within the root element. The root element must be unique at that level; there can’t be two.

Finally, each element, including the root, must have an opening and closing tag. Tags can be nested. An opening tag and closing tag look like this:

<mood_tag>happy</mood_tag>

So, a very simple xml document might be like so:

<?xml version=‘1.0’ encoding=‘UTF-8’?>

<the_root>

<an_element>Element1</an_element>

<another_element>Element2</another_element>

</the_root>

XML code can be checked for following the rules (aka validated) at the site JSON formatter: XML Validator.

Source:

ibm.com: XML Syntax Rules

-JS

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *