...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiReadXMLFile(SdaiString xmlFileName,
SdaiString diagnosticFileName,
SdaiString repositoryName,
SdaiString modelName,
SdaiString headerRepositoryName,
SdaiString headerModelName,
SdaiString schemaName,
SdaiUnsignedInt options,
SdaiInteger *nbWarnings,
SdaiInteger *nbErrors,
SdaiErrorCode *sdaiError);
|
Populates an EDMmodel with Xml-formatted data from a file.
...
This function is more or less equivalent to edmiReadStepFile. It may populate an existing model or implicitly create a new one.
...
Arguments
...
1 | Type | Name | Comment | |||
2 | SdaiString | xmlFileName | The name of the file containing XML-formatted data to read. | |||
3 | SdaiString | diagnosticFileName | The name of the file that will contain diagnostic information generated by this function. If this parameter is NULL or an empty string, all diagnostic information will be written to the EDMinterface current output device. | EdmiDefineOutputFunction may be used to redefine the EDMinterface current output device. | ||
4 | SdaiString | repositoryName | If populating an existing model, this parameter is the name of the repository in which the model exists. If a new model shall be created, this parameter is the name of the repository in which to create it. | |||
5 | SdaiString | modelName | The name of an existing model or a model to create. This model will be populated with data from the XML-file. | The model must have a name that is unique within the repository that holds the model. The model name must start with a letter and the rest of the model name can be any mix of alphanumeric characters and underscore. Model names are case sensitive | . ||
6 | SdaiString | headerRepositoryName | Use this parameter to specify a separate repository for the Xml header model. If this parameter is NULL or an empty string, <headerRepositoryName> will be set equal to <repositoryName> | |||
7 | SdaiString | headerModelName | The name of the XML Header Model in the EDMdatabase. This model will be populated with data from the Header Section of the XML file. XML Header Model names are case sensitive. The specified XML Header Model will be placed in the repository specified by the <headerRepositoryName> parameter. | All instances in the specified <headerModelName> will be mapped to the XML file Header Section as is, except that the attribute FILE_DESCRIPTION.IMPLEMENTATION_LEVEL is set according to the mapping method specified by one of the following options: [CONFORMANCE_CLASS_1], [CONFORMANCE_CLASS_2] or [EDM_PRIVATE_FORMAT]. The attribute FILE_NAME.TIME_STAMP is set to the current date and time, i.e., the date and time when the XML file is produced. | When the [NO_HEADER_CHANGE] option is set, the specified header model will be mapped as is, i.e., also the three attribute values described above will be mapped from the specified header model to the XML file. | When the <headerModelName> argument is blank, a default Header Section is produced. This default header section can be configured by setting the EDM system variable EDM_XML_FILE_AUTHOR. |
8 | SdaiString | schemaName | The name of the schema containing dictionary data for the edmModel to create or update. | |||
9 | SdaiUnsignedInt | options | A bitwise OR between the options described below. All available options are defined in the header file sdai.h | |||
10 | SdaiInteger | *nbWarnings | Address of a variable that will receive the number of warnings detected during reading the specified XML file. | |||
11 | SdaiInteger | *nbErrors | Address of a variable that will receive the number of errors detected reading the specified XML file. | |||
12 | SdaiErrorCode | *sdaiError | Address of a variable that will receive any EDMinterface error code returned from the EDMserver. Use edmiGetErrorText to convert the error code into a readable error message |
Options: Descriptions:
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Option | Comment | |||||
---|---|---|---|---|---|---|
1 | SHOW_STATISTICS | Show statistics when reading the XML file. | ||||
2 | XML_PARSE_TRACE | Show trace when reading the XML file. | ||||
3 | DELETE_INSTANCES_WITH_REFS | When using the option [DELETING_EXISTING_MODEL], instances that are being referred to by other instances will not be deleted unless one of the options [DELETE_INSTANCES_WITH_REFS] and [DELETE_INSTANCE_REFS_ON_DELETE] is used. | ment meant to remain persistent in the EDMdatabase. | This option may | greately greatly improve performance when manipulating the data within a model | |
4 | DELETE_INSTANCE_REFS_ON_DELETE | When using the option [DELETING_EXISTING_MODEL], instances that are being referred to by other instances will not be deleted unless one of the options [DELETE_INSTANCES_WITH_REFS] and [DELETE_INSTANCE_REFS_ON_DELETE] is used. | therby thereby preserving consistency in the EDMdatabase | greately greatly improve performance when manipulating the data within a model | ||
5 | NO_INSTANCE_REFERENCES | When an edmModel is populated, edm will normally create and maintain tables of all external references to all the instances of the new population. To improve performance, the option [NO_INSTANCE_REFERENCES] may be used to suppress generation of these tables. The inconvenience of this is that some functions will not work on a model that has been populated with this option. These functions are; | The built in function USEDIN,The EDMinterface operations: edmiUsedIn, edmiUsedInBN, and edmiGetInstanceReferences | The ExpressX function xpxGetInstanceReferences | This option should only be used on "temporary models", i.e., models that are not | ment meant to remain persistent in the EDMdatabase. |
6 | USER_CONTROLLED_INVERSE | No automatic update and maintenance of INVERSE attributes in the actual model. | This option can improve the performance of data manipulation in this model. This option should only be used on "temporary models", i.e., models that are not | ment meant to remain persistent in the EDMdatabase. | ||
7 | DELETING_EXISTING_MODEL | This option ensures that the model is emptied before it is again repopulated with the data in the Xml File. | If the specified model exists, an error code will be returned unless one of the options [DELETING_EXISTING_MODEL] and [ADD_TO_EXISTING_MODEL] is used. | |||
8 | ADD_TO_EXISTING_MODEL | Use this option if you want to add a population to an already existing population in the given model. This enables incremental populating of a data model from XML files. | ||||
9 | PARSE_ONLY | The specified XML file will be parsed only, i.e. only checked for syntax. No data will be stored in the EDMdatabase. | ||||
10 | CREATE_SCRATCH_INSTANCES | The imported population will not be persistant in the EDMdatabase. All created instances will be scratch instances in the scratch model of the given <schemaName>. | ||||
11 | CONTINUE_STORING_ON_ERROR | If the population within the XML file contains errors such as for instance entity names that does not exist in the dictionary model, the entire population would normally be rejected. | By using this option, EDM will be forced to continue for as long as it is possible to recover from such problems. This may result in inconsistent populations and should therefore be used with care. | |||
12 | PERSISTENT_INSTANCES_HASH_TABLE | creates a EDMpersistentInstancesHashTable |
...
Example
...
Code Block | ||
---|---|---|
| ||
EdmiError rstat; SdaiInteger nErrors; SdaiInteger nWarnings; . . . modId = edmiGetModel("myRepository", "myModel"); |
...
if (rstat = edmiReadXMLFile ("c:/home/johnny/myXmlFile.xml", |
...
"c:/home/johnny/tmp/myXmlFile.diag", |
...
"myXmlRepository", "myXmlModel", |
...
"", "myXmlHeaderModel", "myXmlSchema", |
...
ADD_TO_EXISTING_MODEL | XML_PARSE_TRACE, |
...
&nWarnings, &nErrors, &rstat)) { |
...
printf("\nError %d in edmiReadXMLFile: %s", rstat, |
...
edmiGetErrorText(rstat)); |
...
goto error; } |
}
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|