Difference between revisions of "Category:Oblivion XML"

Jump to navigation Jump to search
718 bytes added ,  09:21, 31 March 2010
m
no edit summary
imported>JRoush
imported>JRoush
m
Line 1: Line 1:
=== What is XML? ===
=== What is XML? ===
XML stands for [http://en.wikipedia.org/wiki/XML eXtensible Markup Language], a generic syntax used to encode data in a series of parent-child relationships.  An XML document contains a hierarchical list of ''elements'', each of which is described by a set of ''traits''.  In Oblivion, XML is used to encode various customizable properties of the user interface.  Every button, box, piece of text, and colorful widget in a menu (or the HUD) is an element in that menu's XML document, where it is described by traits such as position, color, and graphical texture.
XML stands for [http://en.wikipedia.org/wiki/XML eXtensible Markup Language], a generic syntax used to encode a series of parent-child relationships.  An XML document contains a hierarchy of ''elements'', each described by a set of ''traits''.   
In Oblivion, XML is used to encode the user interface.  Every button, box, piece of text, and colorful widget in a menu (or the HUD) is an element in that menus XML document.  And each of these elements has ''child'' elements that describe it's color, size, graphical texture, location, etc.


=== General Syntax ===
=== General Syntax ===
XML markup syntax is largely based on HTML.  An XML element is defined by an pair of opening and closing ''tags'' - matching angle brackets "<>" enclosing the type of the element.  For example, the following xml code defines a text element:
XML syntax is largely based on HTML syntaxAs in HTML, an XML element is defined by opening and closing ''tags'', which are just the type of the element enclosed by angle brackets.  For example, the following xml code defines a Text element:
  <text> </text>
  <text> </text>
Note that the closing tag is denoted by slash.  Anything in between an element's tags is considered to be a child (or "contents") of that element.  For example, the following defines an image element which has a child text element:
Note that the closing tag is denoted by slash.   
 
Anything that appears between the opening and closing tags of an element is considered the ''contents'' of that element.  This might be raw text or numbers, as in the case of a Text element:
<text> This is the actual text that will be displayed </text>
Or it might be another xml element:
  <image> <text> </text> </image>
  <image> <text> </text> </image>
In this case, the "inner" element is the ''child'' of the outer element.  An element can generally have more than one child elements, and those child elements might have children of their own, and so on.  This is what creates the hierarchy that is characteristic of XML.
If an element has no children, like the first example above, then the opening/closing tag syntax can be abbreviated to:
If an element has no children, like the first example above, then the opening/closing tag syntax can be abbreviated to:
  <text />
  <text />
Element traits are written as name/value pairs in the opening tag:
 
Element ''traits'' are written as name/value pairs in the opening tag:
  <image traitname="traitvalue"> </image>
  <image traitname="traitvalue"> </image>
Comments can be added to the code by enclosing them with "&lt;!--"  and "--&gt;":
Traits are an essential part of XML, in that they can refine & control elements, and differentiate elements of the same type from one another.  '''Note''', though, that Oblivion only recognizes a few traits, and instead prefers to refine & control elements using ''child elements''.  See the next section, on [[#Oblivion XML Schema]] for more details.
 
''Comments'' can be added to the code by enclosing them with "&lt;!--"  and "--&gt;":
  &lt;!-- this is a comment --&gt;
  &lt;!-- this is a comment --&gt;
To learn more about XML syntax, read the [http://www.w3.org/XML/ complete specification] or one of the tutorials provided by the World Wide Web Consortium.
To learn more about XML syntax, read the [http://www.w3.org/XML/ complete specification] or one of the tutorials provided by the World Wide Web Consortium.


Anonymous user

Navigation menu