|
XML has become a standard for storing ascii data in a hierarchy based file format. Max uses it for the
Save/Load Animation feature where all the animate of objects are stored and then applied back to another
character. XML has an open format with only a few rules that need to be followed, this allow for any sort
of data to be stored in just about any way that you would like to. I use it for many different tools including
a new version of PEN Attribute Holder that is being developed, a file tracking and project management system
and most recently the PEN Helper where I store all the information about objects in an XML file for recreating
those objects when needed. Here is what the file format looks like for the PEN Helper, it has been truncated
since we just need to illustrate the format.
Code:
<penObjects>
<Preset Name="Two Way Arrow">
<Verts data="#([-0.252935,-0.40128,0],[-0.401212,-0.40128,0],[0,-1,0])" />
<Faces data="#([8,9,10],[6,7,8],[6,8,10])" />
<EdgeVis data="#([1,1,0],[1,1,0],[0,0,0])" />
<SmoothGroup data="#(0,0,0,0)" />
<Renderable data="false" />
<WireColor data="(color 90 200 225)" />
<Size data="10.0" />
<Position data="[0,0,0]" />
<Rotation data="[0,0,0]" />
<Scale data="[1,1,1]" />
</Preset>
<Preset Name="Character Root">
<Verts data="#([1,0,0],[0.86336,0.504498,0],[0.504498,0.86336,0])" />
<Faces data="#([1,2,14],[1,14,13],[2,3,15])" />
<EdgeVis data="#([1,1,0],[0,1,1],[1,1,0])" />
<SmoothGroup data="#(0,0,0,0,0,0)" />
<Renderable data="false" />
<WireColor data="(color 90 200 225)" />
<Size data="10.0" />
<Position data="[0,0,0]" />
<Rotation data="[0,0,0]" />
<Scale data="[1,1,1]" />
</Preset>
</penObjects>
The format has some simple rules.
- Each XML file has to have one root element, in the example this is <penObjects>
- Each element needs to have a closing element, in the example <penObjects> is closed
with </penObjects>
- If and element doesn't have a children elements it can be closed without a closing element as in
this element in the example <Renderable data="false" />
- The name of an element has to include only alphanumeric characters with no spaces or other characters as separators.
- Each element can have any number of properties.
- Property names need to follow the same formatting rules as element names.
- Property values start and end with a double quote " and can be anything that you want.
|