Difference between revisions of "XML Attribute"

186 bytes added ,  12:41, 14 March 2011
m
no edit summary
imported>JRoush
imported>Kyoma
m
Line 1: Line 1:
XML traits are named attributes of XML elements. The XML syntax doesn't specify what traits are possible, only that they be given as ''TraitName="TraiValue"'' in the opening tag of an element.  Oblivion XML recognizes only three true XML traits: '''name''', '''src''', and '''trait'''.   
XML uses named attributes for XML elements. The XML syntax doesn't specify what attributes are possible, only that they be given as ''AttributeName="Value"'' in the opening tag of an element.  Oblivion XML recognizes only three true XML attributes: '''name''', '''src''', and '''trait'''.   


The '''name''' trait provides a way to identify elements in a menu file.  This trait is used only for [[Object Element]]s - property or operator elements are never named.  The name of an element need not be unique within the entire menu, but every element should at least have a different name from it's siblings (as discussed below).
The '''name''' attribute provides a way to identify elements in a menu file.  This attribute is used only for [[Object Element]]s - property or operator elements are never named.  The name of an element need not be unique within the entire menu, but every element should at least have a different name from it's siblings (as discussed below).


  <!-- the 'name' trait of this element has the value "PictureFrame" -->
  <!-- the 'name' attribute of this element has the value "PictureFrame" -->
  <rect name="PictureFrame"> </rect>  
  <rect name="PictureFrame"> </rect>  


The '''src''' and '''trait''' traits are always provided together (except for the special case of the [[Include Element]]).  They are used only in empty Operator elements, to specify the value used by the operator:
The '''src''' and '''trait''' attributes are always provided together (except for the special case of the [[Include Element]]).  They are used only in empty Operator elements, to specify the value used by the operator:


  &lt;!-- Good --&gt;
  &lt;!-- Good --&gt;
Line 17: Line 17:
  </image>
  </image>
   
   
The '''src''' trait can refer to any [[Object Element]] by it's name, or can use one of the "relative" sources:
The '''src''' attribute can refer to any [[Object Element]] by it's name, or can use one of the "relative" sources:
*'''Me()''' - the object whose property the operator is modifying.
*'''Me()''' - the object whose property the operator is modifying.
*'''Parent()''' - the parent of Me(), that is the element of which Me() is a child.
*'''Parent()''' - the parent of Me(), that is the element of which Me() is a child.
*'''Sibling(''SiblingName'')''' - a the siblings of Me(), that is the elements that are also children of Parent().  The name of the sibling must be provided as an argument - this is why no two siblings should have the same name.
*'''Sibling(''SiblingName'')''' - a the siblings of Me(), that is the elements that are also children of Parent().  The name of the sibling can be provided as an argument - this is why no two siblings should have the same name. When omitted it will use the sibling that came before it - the one that was defined above it in the XML. Although this does not work for the very first element.
*'''Child(''ChildName'')''' - a child object of Me().  Again, the name must be specified.
*'''Child(''ChildName'')''' - a child object of Me().  Again, the name must be specified.


The '''trait''' trait can refer to any ''property'' of the source object.  The current value of this property is used as value (operand) of the operator.
The '''trait''' attribute can refer to any ''property'' of the source object.  The current value of this property is used as value (operand) of the operator.


[[Category:Oblivion XML]]
[[Category:Oblivion XML]]
Anonymous user