Export Requirements and Options

Schema and business objects can be exported in XML format. Before exporting any objects, it is important to verify that MQL is in native language mode. Exporting in the context of a non-native language is not supported.

The resulting XML stream follows rules defined in the XML Document Type Definition (DTD) file (named "ematrixml.dtd") that is installed with 3DSpace in the /XML directory. This DTD file is referenced by all exported 3DSpace XML files. To interpret and validate 3DSpace XML export files, an XML parser must be able to access the eMatriXML DTD file. The DTD file should reside in the same directory as the exported XML files and be transferred along with those files to any other user or application that needs to read them.

For more information, see MQL Command Reference: export Command.

This page discusses:

Ways to Export XML

Using MQL, you can export objects to XML format in either of two ways:

  • Insert an XML clause in any Export command for exporting administrative or business objects.
  • Issue an XML command to turn on XML mode as a global session setting. In this mode, any Export commands you enter, with or without the XML clause, will automatically export data in XML format.

Restrictions

Be aware of the following restrictions related to exporting and importing in XML format:

  • When exporting programs to XML, make sure that the code does not contain the characters "]]>". These characters can be included as long as there is a space between the bracket and the greater sign.
  • Legal characters in XML are the tab, carriage return, line feed, and the legal graphic characters of Unicode, that is, #x9, #xA, #xD, and #x20 and above (HEX). Therefore, other characters, such as those created with the ESC key, should not be used for ANY field, including business and administrative object names, description fields, program object code, or page object content.
  • Due to an xerces system limitation, the form feed character "^L" is not supported by the Import command. If they are included in the file you are trying to import, you will receive an error similar to:
    System Error: #1500127: 'file' does not exist
    businessobject Document SLB EH713116 AE failed to be imported.
    System Error: #1600067: XML fatal error at (file '/rmi_logs/GP2_tmp/T5011500_4x.xml',
    line 6292824, char 2): Invalid character (Unicode: 0xC)
    import failed.

The workaround is to go to the line number in the XML file and remove the offending character.

The CDATA termination character string ]]> is replaced by ]Inserted_by_ENOVIA]Inserted_by_ENOVIA> in XML export files. XML Import files will do back replacement. Outside software reading, XML files should handle this replaced string.

XML Clause

Use the XML clause as an OPTION_ITEM in any Export command to export administrative or business objects in XML format. To ensure that the XML files reside in the same directory as the XML DTD, you can export files to the XML folder (in your ENOVIA_INSTALL directory) where the DTD is installed. Alternatively, you can specify another location in your Export command and copy the DTD into that directory. Use the into clause in your Export command and specify a full directory path, including file name. For Example:

export person guy xml into file 
c:\ enovia V6R2011\studio\xml\person.xml;

XML Command

Use the XML command to turn XML mode on or off as a global session setting. The complete XML command syntax is:

 xml [on|off]; 

Omitting the on or off switch causes XML mode to be toggled on or off, depending on its current state. The XML mode is off by default when you start an MQL session.

For example, to export a person named "guy" using an XML command along with an Export command, you can enter:

xml on;
export person guy into file 
c:\ enoviaV6R2011\studio\xml\person.xml;

If you need to export several objects to XML format, using the XML command to turn on XML mode first can eliminate the need to re-enter the XML clause in each Export command as well as the possibility of an error if you forget.

XML Output

The XML export format typically generates a file 2 to 3 times larger than the standard export format. To conserve space, subelements are indented only if verbose mode is turned on. Indentation makes output more readable but is not required by an XML parser. Some XML viewers (like Internet Explorer 5.0) will generate the indentation as the file is parsed.

The following example shows standard export output when you export a person named "guy" during an MQL session. While relatively compact, this output is not very intelligible to a user.

MQL<1>set context user creator;
MQL<2>export person guy;
!MTRX!AD! person guy 8.0.2.0
guy Guy ""
"" "" "" "" 0 0
1 1 1 0 1 0 1 "" "" *
1111101111111100111110
0 1 .finder * GuyzViewTest 0 * FileInDefaultFormat 1 ""
0 0
0 0
0
0
0
de3IJEE/JIJJ.
""
0
0
0
1
Test""
1
Description description 1
0 0 0 0 70 21 0 0 1 1
1
0 0
0
0 0
person guy successfully exported.
!MTRX!END 
export successfully completed

The next example shows XML output when you use the Export command, with XML mode turned on, to export a person named "guy" during a continuation of the same MQL session. While more intelligible to a user, this code creates a larger output file than the standard export format.

MQL<3>xml on;
MQL<4>verbose on;
MQL<5>export person guy;
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- (c)MatrixOne, Inc., 2000 -->
<!DOCTYPE ematrix SYSTEM "ematrixml.dtd">
<ematrix>
  <creationProperties>
    <release>8.0.2.0</release>
    <datetime>2000-05-05T17:57:19Z</datetime>
    <event>export</event>
    <dtdInfo>&ematrixProductDtd;</dtdInfo>
  </creationProperties>
  <person id="0.1.31721.46453">
    <adminProperties>
      <name>guy</name>
    </adminProperties>
    <fullName>Guy</fullName>
    <fullUser/>
    <businessAdministrator/>
    <systemAdministrator/>
				<applicationsOnly/>
    <passwordChangeRequired/>
    <access>
      <all/>
    </access>
    <adminAccess>
      <attributeDefAccess/>
      <typeAccess/>
      <relationshipDefAccess/>
      <formatAccess/>
      <personAccess/>
      <roleAccess/>
      <associationAccess/>
      <policyAccess/>
      <programAccess/>
      <formAccess/>
      <ruleAccess/>
      <siteAccess/>
      <storeAccess/>
      <vaultAccess/>
      <serverAccess/>
      <locationAccess/>
    </adminAccess>
    <queryList count="1">
      <query>
        <name>.finder</name>
        <queryStatement>
          <vaultPattern>*</vaultPattern>
          <typePattern>GuyzViewTest</typePattern>
          <ownerPattern>*</ownerPattern>
          <namePattern>FileInDefaultFormat</namePattern>
          <revisionPattern>1</revisionPattern>
        </queryStatement>
      </query>
    </queryList>
    <password>de3IJEE/JIJJ.</password>
    <tableList count="1">
      <table>
        <name>Test</name>
        <columnList count="1">
          <column>
            <label>Description</label>
            <expression>description</expression>
            <usesBusinessObject/>
            <geometry>
              <xLocation>0.0</xLocation>
              <yLocation>0.0</yLocation>
              <width>70.0</width>
              <height>21.0</height>
              <minWidth>0.0</minWidth>
              <minHeight>0.0</minHeight>
              <autoWidth/>
              <autoHeight/>
            </geometry>
            <editable/>
          </column>
        </columnList>
						</table>
    </tableList>
  </person>
</ematrix>