Difference between revisions of "Category:Oblivion XML"

15 bytes added ,  13:31, 19 December 2009
no edit summary
imported>JRoush
imported>JRoush
Line 1: Line 1:
{{unfinished}}
=== 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 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.   
Line 19: Line 18:
XML is a general syntax - the meaning of specific elements depends entirely on the program parsing the file.   
XML is a general syntax - the meaning of specific elements depends entirely on the program parsing the file.   


The elements recognized by the Oblivion parser can be divided into three basic categories.  [[Menu Element|"Menu" Elements]] define actual objects in the menu, such as buttons, text, images, etc.  There are only a few different kinds of menu elements, but they are used repeatedly to create the complex menu structures.
The elements recognized by the Oblivion parser can be divided into three basic categories.  [[Object Element|"Object" Elements]] define actual objects in the menu, such as buttons, text, images, etc.  There are only a few different kinds of object elements, but they are used repeatedly to create the complex menu structures.


[[Property Element|"Property" Elements]] are always children of Menu Elements,  
[[Property Element|"Property" Elements]] are always children of Object Elements,  
defining things like the position, color, transparency, etc. of their parent.  
defining things like the position, color, transparency, etc. of their parent.  
For example, an <image> menu element might have <width> and <height> elements as children, which Oblivion will use to determine the size of the displayed image.   
For example, an <image> object element might have <width> and <height> elements as children, which Oblivion will use to determine the size of the displayed image.   


Property elements can have literal values, written directly into the xml code.   
Property elements can have literal values, written directly into the xml code.   
They can also contain mathematical "formulas" - for example the <width> property of an <image> element might contain a formula to make the image twice as wide as it is tall.  Then, if some code in the game engine (or a mod script) changes the height of the image, the game's parser will automatically use the formula to recalculate the width.  These formulas are expressed as series of [[Operator Element|"Operator" Elements]] - most basic mathematical operators like +, - , *, FLOOR, AND, etc. have a corresponding Operator Element.
They can also contain mathematical "formulas" - for example the <width> property of an <image> element might contain a formula to make the image twice as wide as it is tall.  Then, if some code in the game engine (or a mod script) changes the height of the image, the game's parser will automatically use the formula to recalculate the width.  These formulas are expressed as series of [[Operator Element|"Operator" Elements]] - most basic mathematical operators like +, - , *, FLOOR, AND, etc. have a corresponding Operator Element.


There is one recognized element that does not fit into a category: the [[Include Element]].  It's use is similar to the ''include'' statement in C-style programming language - it allows the menu designer to copy in bits of commonly used xml code from other files.
There are a few special elements that don't fit into a category.  The most common is the [[Include Element]].  It's use is similar to the ''include'' statement in C-style programming language - it allows the menu designer to copy in bits of commonly used xml code from other files.


Elements that aren't part of the Oblivion XML schema are assumed to be Property Elements.  They will be parsed by the game engine, can be referred to by name from Operator elements and OBSE script functions, and may contain Operator Elements as children.  It is common to break up long formulas by inventing an unrecognized element to hold intermediate values.
Elements that aren't part of the Oblivion XML schema are assumed to be Property Elements.  They will be parsed by the game engine, can be referred to by name from Operator elements and OBSE script functions, and may contain Operator Elements as children.  It is common to break up long formulas by inventing an unrecognized element to hold intermediate values.
Line 34: Line 33:
Oblivion only recognizes three XML [[Traits]]: "name", "src", and "trait".
Oblivion only recognizes three XML [[Traits]]: "name", "src", and "trait".


  &lt;!-- An example of an 'image' [[Menu Element]] --&gt;  
  &lt;!-- An example of an 'image' [[Object Element]] --&gt;  
  <image name="MyImage">    &lt;!-- This image has it's [[Trait|'name' trait]] set to 'MyImage', --&gt;
  <image name="MyImage">    &lt;!-- This image has it's [[Trait|'name' trait]] set to 'MyImage', --&gt;
     <height> 10 </height>  &lt;!-- and it's [[Property Element#Sizeable|'height' property]] set to 10 pixels. --&gt;
     <height> 10 </height>  &lt;!-- and it's [[Property Element#Sizeable|'height' property]] set to 10 pixels. --&gt;
Anonymous user