Importing XML
Importing an XML document is the process of adding meta data to a target repository. You can import meta data that was previously exported through the IExport interface, the Export object, or some other mechanism that you define.
To import object data, you can use the IImport interface and the Import object. You can handle the XML document as a string to import it from memory. More likely, however, you will want to import an XML document from a file.
Import requires the following conditions:
- The XML documents you import must be structured in the format described by Meta Data Coalition (MDC) Open Information Model (OIM) XML Encoding.
- The type information of the target repository or tool must be identical to the type information of the source objects or model. For example, if you export objects from a Unified Modeling Language (UML) information model, you must install an identical UML information model in the target repository database prior to importing. If the information models do not correspond exactly, you will lose data during the import. Rows that fail to import are logged to an error file. This file is named MSMDCXML.log and it is created in your Temp directory.
You can set flags on an import object to determine import behavior. For more information, see IImport::ImportXMLString Method and IImport::ImportXML Method.
Import returns a collection of top-level objects that your application can manipulate. To view and manipulate imported data in a repository database, the imported data must be related to the repository root object. When the information model in the target database corresponds to the information model in the source database, a relationship to the root object may be established automatically. However, whether this linkage occurs depends on the structure and content of the imported data. If your imported data is not related to the root object, you must programmatically add an object from the imported data to a collection of the root object. This step is necessary to support navigation and to define relationships with objects in other information models.
See Also
Import Automation Object Example