Category:Oblivion XML

Revision as of 01:03, 19 December 2009 by imported>JRoush (→‎Oblivion XML Schema)

What is XML?

XML stands for 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.

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:

<text> </text>

Note that the closing tag is denoted by slash. Anything in between an element's tags is considered to be a child of that element. For example, the following defines an image element which has a child text element:

<image> <text> </text> </image>

If an element has no children, like the first example above, then the opening/closing tag syntax can be abbreviated to:

<text />

Element traits are written as name/value pairs in the opening tag:

<image traitname="traitvalue"> </image>

Comments can be added to the code by enclosing them with "<!--" and "-->":

<!-- this is a comment -->

To learn more about XML syntax, read the complete specification or one of the tutorials provided by the World Wide Web Consortium.

Oblivion XML Schema

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" Elements define actual objects in the menu, such as buttons, text, images, etc. There are only a few elements in this category, but they are repeatedly to create the complex menu structures.

"Property Elements" are always children of Menu Elements, 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.

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" Elements - most basic mathematical operators like +, - , *, FLOOR, AND, etc. have a corresponding Operator Element.

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.

Oblivion only recognizes three XML Traits: "name", "src", and "trait".

Oblivion Menu Files

Menu xml data is stored in the Oblivion\Data\Menus directory. Each menu is stored in it's own file. Oblivion reloads a menu from disk every time it is opened, so changes to the file can be seen by closing and re-opening the menu - a very useful trick for editing. Note, however, that some menus are never closed (e.g. the HUD). These menus can be reloaded in game using "Reload menuname" console function.

Subcategories

This category has only the following subcategory.

U

Pages in category "Oblivion XML"

The following 7 pages are in this category, out of 7 total.