XML Document Structure

 

Every XML Document has one root element, which may have attributes and contain other nodes. In OCAF XML Documents the root element is named "document" and has attribute "format" with the name of the OCAF Schema used to generate the file. The standard XML format is "XmlOcaf". The following elements are sub-elements of <document> and should be unique entries as its sub-elements, in a specific order. The order is:

OCAF Attributes Representation

In XML documents, OCAF attributes are elements whose name identifies the OCAF attribute type. These elements may have a simple (string or number) or complex (sub-elements) structure, depending on the architecture of OCAF attribute. Every XML type for OCAF attribute possesses a unique positive integer "id" XML attribute identifying the OCAF attribute throughout the document. To ensure "id" uniqueness, the attribute name "id" is reserved and is only used to indicate and identify elements which may be referenced from other parts of the OCAF XML document.
For every standard OCAF attribute, its XML name matches the name of a C++ class in Transient data model. Generally, the XML name of OCAF attribute can be specified in corresponding attribute driver.

XML types for OCAF attributes are declared with XML W3C Schema in a few XSD files where OCAF attributes are grouped by the package where they are defined.

Example of resulting XML file

The following example is a sample text from an XML file obtained by storing an OCAF document with two labels (0: and 0:2) and two attributes - TDataStd_Name (on label 0:) and TNaming_NamedShape (on label 0:2). The <shapes> section contents are replaced by an ellipsis.

<?xml version="1.0" encoding="UTF-8"?>
<
document format="XmlOcaf" xmlns="http://www.opencascade.org/OCAF/XML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opencascade.org/OCAF/XML http://www.opencascade.org/OCAF/XML/XmlOcaf.xsd">
<
info date="2001-10-04" schemav="0" objnb="3">
<
iitem>Copyright: Open Cascade, 2001</iitem>
<
iitem>STORAGE_VERSION: PCDM_ReadWriter_1</iitem>
<
iitem>REFERENCE_COUNTER: 0</iitem>
<
iitem>MODIFICATION_COUNTER: 1</iitem>
<
/info>
<
comments/>
<
label tag="0">
<
TDataStd_Name id="1">Document_1</TDataStd_Name>
<
label tag="2">
<
TNaming_NamedShape id="2" evolution="primitive">
<
olds/>
<
news>
<
shape tshape="+34" index="1"/>
<
/news>
<
/TNaming_NamedShape>
<
/label>
<
/label>
<
shapes>
...

<
/shapes>
<
/document>