REALbasic XML Project Format
REALbasic can export and import REALbasic projects in XML format. XML is a structured, text-based data format that provides a standard framework for representing data.
For a brief orientation to XML documents in general, see What Do XML Documents Look Like?. The XML produced by REALbasic is well-formed, but it cannot be "validated" because it does not include a "document type declaration." Most of the content should be self-explanatory, with the aid of the reference below. Whitespace is significant only in the content area of the innermost tags; whitespace between one tag and another is not significant.
The general structure of a REALbasic XML file is:
<RBProject Version="3.0">
<block type="SomeBlockType" ID="1234">
<SomeTag>Content goes here</SomeTag>
<AnotherTag>More content</AnotherTag>
</block>
<block type="AnotherBlockType" ID="5678">
<SomeOtherTag>More content here</SomeOtherTag>
</block>
</RBProject>
The file is divided into "blocks" which are major organizational units. In general, there is one block for the project data (build settings, etc.), followed by one block for each item in the Project window (see block types). Each block has an "ID" which is used to refer to the block (e.g., in the ObjContainerID tag). Some tags identify groups and may contain other tags.
Markup Tags
The markup tags used by REALbasic XML are (in alphabetical order):
|
The possible values for the "type" attribute of the block tag are:
|
Tag Content
String data within a tag must be marked up according to standard XML
rules. Every "<" is replaced with "<", each ">" is replaced with
">", and every ampersand is replaced with "&". Finally, if a non-Unicode string contains byte values less than 32 or
greater than 127, it is represented with a special "
<Hex bytes="4">00C4A50B</Hex>
Example
Below is an abbreviated example of the XML import of a project containing a window, a menu, and a global module. The window contains a PushButton with code in its action event. The module contains a constant, a property, and one method.
<?xml version="1.0"?> (XML preamble)
<RBProject Version="3.0"> (version of RB used)
<block type="Project" ID="0"> (project-wide settings)
<MajorVersion>1</MajorVersion>
<MinorVersion>0</MinorVersion>
...
</block>
<block type="Window" ID="-1236533132"> (here's the Window...)
<ObjName>Window1</ObjName>
<ObjContainerID>0</ObjContainerID>
<EditBounds>
<Rect left="100" top="80" width="534" height="390"/>
</EditBounds>
...
<PropertyVal Name="Name">Window1</PropertyVal>
<PropertyVal Name="Frame">0</PropertyVal>
<PropertyVal Name="HasBackColor">False</PropertyVal>
...
<FormDefn>
<ObjName>Window1</ObjName>
<ObjSize>120</ObjSize>
<Superclass>Applet</Superclass>
<IsInterface>0</IsInterface>
</FormDefn>
<ControlBehavior>
<ObjName></ObjName>
<ObjSize>116</ObjSize>
<Superclass>PushButton</Superclass>
<IsInterface>0</IsInterface>
<HookInstance>
<ItemName>Action</ItemName>
<ItemSource>
<StartSelRow>1</StartSelRow>
<StartSelCol>10</StartSelCol>
<EndSelRow>1</EndSelRow>
<EndSelCol>10</EndSelCol>
<SourceLine>Sub Action()</SourceLine>
<SourceLine>self.Close</SourceLine>
<SourceLine>End Sub</SourceLine>
</ItemSource>
</HookInstance>
</ControlBehavior>
<Control>
<ItemName>PushButton</ItemName>
<PropertyVal Name="Name">PushButton1</PropertyVal>
...
<PropertyVal Name="Caption">OK</PropertyVal>
<PropertyVal Name="Default">True</PropertyVal>
<PropertyVal Name="Cancel">False</PropertyVal>
<PropertyVal Name="Enabled">True</PropertyVal>
<ControlIndex>0</ControlIndex>
</Control>
</block>
<block type="Menu" ID="-1236533133"> (here's the Menu...)
<ObjName>Menu</ObjName>
<ObjContainerID>0</ObjContainerID>
<EditBounds>
<Rect left="100" top="100" width="300" height="200"/>
</EditBounds>
<MenuItem>
...
</MenuItem>
...
</block>
<block type="Module" ID="-1236533108"> (here's the Module...)
<ObjName>Module1</ObjName>
<ObjContainerID>0</ObjContainerID>
<IsClass>0</IsClass>
<EditBounds>
<Rect left="84" top="220" width="400" height="300"/>
</EditBounds>
<Interfaces></Interfaces>
<ObjName>Module1</ObjName>
<ObjSize>24</ObjSize>
<IsInterface>0</IsInterface>
<Property Flags="0">kEOL</Property>
<Method>
<ItemName>InitGlobals</ItemName>
<ItemParams></ItemParams>
<ItemResult></ItemResult>
<ItemFlags>0</ItemFlags>
<ItemSource>
<StartSelRow>4</StartSelRow>
<StartSelCol>0</StartSelCol>
<EndSelRow>4</EndSelRow>
<EndSelCol>0</EndSelCol>
<SourceLine>Sub InitGlobals()</SourceLine>
<SourceLine>// Set the correct line ending</SourceLine>
<SourceLine>#if TargetWin32 then</SourceLine>
<SourceLine>kEOL = chr(10)</SourceLine>
<SourceLine>#else</SourceLine>
<SourceLine>kEOL = chr(13)</SourceLine>
<SourceLine>#endif</SourceLine>
<SourceLine>End Sub</SourceLine>
</ItemSource>
</Method>
<Constant>
<ItemName>kPi</ItemName>
<ItemType>2</ItemType>
<ItemDef>3.14157</ItemDef>
</Constant>
</block>
</RBProject>
