XML: Basic Structure
XML sounds like it can be used everywhere … but what is XML for?
In a nutshell, XML is used as an format engine to easily transmit data between many different types of programming languages.
XML structure makes encourages simplicity and usability with strong Unicode support (to use the myriad languages of the world). XML is created for documents, but it is extended into arbitrary data structures, file centric database organization, and even web services.
Before we get ahead of ourselves, let’s start with a look at a basic XML file.
XML file structure
<? xml version="1.0" encoding="UTF-8" ?>
<appearance fur="short" size="large">playful</appearance>
<appearance fur="short" size="medium">mean</appearance>
<appearance fur="medium" size="large">fluffy</appearance>
<appearance fur="short" size="small">long</appearance>
<!– this is a comment, you have reached the end of the file –>
<!– comments are also helpful if XML elements control items –>
There are four elements in our example XML file: animal, type, name, and appearance.
The name and appearance elements are children of type, which is a child of the root element animal.
Appearance has two attributes, fur and size.
Using this standardized structure, programmers and programs alike can now access the data within this file and parse it into meaningful objects or items like arrays, image galleries, Flash layouts, dynamic content, or just about anything else that can take in arbitrary data.
The point is, XML makes your data portable and usable in many different web and desktop programming languages.