Difference between revisions of "XML"

From Mario Fan Games Galaxy Wiki
m (Linked a couple HTMLs.)
m (Missed an L in HTML when linking.)
 
Line 1: Line 1:
 
'''XML''' ('''extensible markup language''') is a markup language used as a basis for other markup languages. It uses syntax very much like [[HTML]] (XHTML, in fact, is based on XML), and is usually used as a medium to store information. As it is plaintext, it is easy to edit, and it offers functionality not possible with other storage formats like [[INI]].
 
'''XML''' ('''extensible markup language''') is a markup language used as a basis for other markup languages. It uses syntax very much like [[HTML]] (XHTML, in fact, is based on XML), and is usually used as a medium to store information. As it is plaintext, it is easy to edit, and it offers functionality not possible with other storage formats like [[INI]].
  
XML allows nesting of tags, which makes organization easier. Like [[HTM]]L, either attributes or explicit "child" tags (or both) may be used to store information in a "parent" tag. However, it is a good idea to choose which one is best for a specific type of stored data; for example, object coordinates may be better stored in attributes, while a long text description of the object would be stored in tags.
+
XML allows nesting of tags, which makes organization easier. Like [[HTML]], either attributes or explicit "child" tags (or both) may be used to store information in a "parent" tag. However, it is a good idea to choose which one is best for a specific type of stored data; for example, object coordinates may be better stored in attributes, while a long text description of the object would be stored in tags.
  
 
XML opening tags must have a corresponding closing tag, unless an empty tag is used. A single root tag pair must always be present to enclose all other tags. Tags may be named anything the user chooses, including with non-Latin characters if the user's environment supports it. However, tags are case-sensitive, and the opening and closing tags must match.
 
XML opening tags must have a corresponding closing tag, unless an empty tag is used. A single root tag pair must always be present to enclose all other tags. Tags may be named anything the user chooses, including with non-Latin characters if the user's environment supports it. However, tags are case-sensitive, and the opening and closing tags must match.

Latest revision as of 22:21, 25 August 2016

XML (extensible markup language) is a markup language used as a basis for other markup languages. It uses syntax very much like HTML (XHTML, in fact, is based on XML), and is usually used as a medium to store information. As it is plaintext, it is easy to edit, and it offers functionality not possible with other storage formats like INI.

XML allows nesting of tags, which makes organization easier. Like HTML, either attributes or explicit "child" tags (or both) may be used to store information in a "parent" tag. However, it is a good idea to choose which one is best for a specific type of stored data; for example, object coordinates may be better stored in attributes, while a long text description of the object would be stored in tags.

XML opening tags must have a corresponding closing tag, unless an empty tag is used. A single root tag pair must always be present to enclose all other tags. Tags may be named anything the user chooses, including with non-Latin characters if the user's environment supports it. However, tags are case-sensitive, and the opening and closing tags must match.

Example

<?xml version="1.0" encoding="UTF-8"?>
<data>
     <level number="2" halfwaypoint="no" /> <!-- this is an empty tag; note the slash -->
     <object id="0" x="100" y="150" name="test" /> <!-- using attributes --> 
     <object> <-- using explicit tags -->
          <id>1</id>
          <x>200</x>
          <y>300</y>
          <name>test2</name>
     </object>
</data>

As you can see, it's more space-efficient to use attributes, but they are not always appropriate for all tasks. The root tag pair in this case is 'data'.