An XML file, or document, is a file saved with ".xml" extension, in which structured data is stored. XML files store data within markup structures, similar to the HTML markup used to structure Web pages. XML is used in conjunction with many different technologies, for websites and applications running over the Internet as well as software applications running on desktop, laptop and mobile computing devices. XML is a data storage technology, with XML files acting as databases.
Uses
XML data is used in many different types of project, including websites and software applications. The nature of XML is that it can be extended to form other languages based on the same structural rules. For example, many news feeds you see on websites are structured in RSS, which is based on XML. Similarly, the XHTML variant of HTML is XML-structured. For this reason you will find XML files stored on Web servers for use within websites and applications.
Software programs also use XML. An XML document can act as a database, with programs querying, inserting and updating data in conjunction with a user interface. Many of the programming languages in use benefit from tools for processing XML data - these are often referred to XML parsing libraries. XML is prevalent in mobile technology too, with Android applications structuring data, design layouts and shape definitions in XML documents stored within an app structure.
Structure
XML files store data values in markup structures. The following example demonstrates a simple XML structure:
This data models the departments and employees in a company. Each element, or node, in an XML document is preceded by an opening tag and followed by a closing tag, which is the same as the opening tag except for a leading slash "/" character. Elements can contain other elements inside them. The opening tag of an XML element can also include attributes, such as "name" in the department element above. Each attribute is listed using a name and a value, which is enclosed in quotation marks. Attributes provide additional information about an element.Mary Smith John Jones Sarah Mitchell Margaret Cooper Mark Simpson Paul Hunter
XML is tree-structured, with a root node (company in the example) acting as parent to all other nodes in the tree. This is similar to a family tree, except that in XML, an element can have only one direct parent. In the example above, each employee node is a child of a department node and in some cases a sibling of other employee nodes. XML data values can include various data types, such as text strings, numbers and dates.
Tools
XML is a straightforward language to work with in most cases. You can create and edit XML files in a standard text editor program. There are also various XML development and editing software tools available, some free and some commercial. These XML editors are typically equipped with formatting and validating tools, and can sometimes prompt you with code excerpts as you write your markup. XML validators check XML files for markup errors. You can access such XML validation tools through software programs and websites, allowing you to make sure your XML documents are well-formed before you attempt to use the data in them.