edmiRemoteReadXMLFile
EdmiError edmiRemoteReadXMLFile(SdaiServerContext serverContextId, SdaiString remoteModelRepositoryName, SdaiString remoteModelName, SdaiString remoteHeaderModelRepositoryName, SdaiString remoteHeaderModelName, SdaiString xmlFileName, SdaiString diagnosticFileName, SdaiString remoteSchemaName, SdaiUnsignedInt options, SdaiInteger *nbWarnings, SdaiInteger *nbErrors, SdaiErrorCode *sdaiError, SdaiUnsignedInt *edmiInvocationId);
Reads an XML file into an existing edmModel in a remote EDMdatabase. This function is a higher level implementation of edmiRemoteReadXMLDocument. In addition to the features of edmiRemoteReadXMLDocument , some additional features are available.
- If the model does not exist, it may be implicitly created.
- The XML data may overwrite an existing population or it may increment it.
- The header model name and repository info stored in the XML file may be optionally overruled by values given as input parameters.
Reading XML data from an allocated string in memory and writing the parsing diagnostics to a string is not possible with this function. Use edmiRemoteReadXMLDocument if this feature is required.
Arguments
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
SdaiString | remoteModelRepositoryName | The name of the edmRepository in which to create and/or populate an edmModel with the XML data stored in the file specified by the <xmlFileName> argument. The edmRepository specified by this argument must exist in the remote EDMdatabase. Repository names are case sensitive. |
SdaiString | remoteModelName | The name of the edmModel to create and/or populate populate. The <remoteRepositoryName> and <remoteModelName> arguments uniquely identify an existing edmModel in the remote EDMdatabase. Model names are case sensitive. |
SdaiString | remoteHeaderModelRepositoryName | The name of the edmRepository in which to create and populate a header model with the XML data stored in the header section of the XML file. Repository names are case sensitive. |
SdaiString | remoteHeaderModelName | The name of the edmModel to create and populate with the XML data stored in the header section of the XML file. Header models may not be incrementally populated. I.e, if the arguments <remoteHeaderModelRepositoryName> and <remoteHeaderModelName> is specified, this function will fail unless the DELETING_EXISTING_MODEL option is specified. |
SdaiString | xmlFileName | The name of the file, on the local file system, that contains the XML data to be read. |
SdaiString | diagnosticFileName | The name of the file, on the local file system, that will receive the diagnostics from the parsing of the XML data. |
SdaiString | remoteSchemaName | The name of the Express Schema that specifies the meta data used for representing the XML data in an edmModel in the EDMdatabase. |
SdaiUnsignedInt | options | See the description of all available options below. Multiple options may be specified by using the bitwise OR operator. |
SdaiInteger | nbWarnings | Address of a variable that will receive the number of warnings that resulted from the execution of this function. |
SdaiInteger | nbErrors | Address of a variable that will receive the number of errors that resulted from the execution of this function. |
SdaiErrorCode | sdaiError | Variable that will receive an EDMinterface error code if the XML data was rejected due to reasons found in the data it self. System errors will not be returned in this argument. |
SdaiUnsignedInt | edmiInvocationId | Currently unused |
Return Value
Options
Option | Comment |
DELETING_EXISTING_MODEL | If the edmModel that is specified by the input parameters of this function already exists it will be deleted and recreated before the XML data is imported. |
SHOW_STATISTICS | Show statistics when reading/writing XML |
XML_PARSE_TRACE | Show trace when reading/writing XML |
DELETE_INSTANCES_WITH_REFS | If an edmModel is implicitly created, this option will disable one of the models built in features, thereby improving its data manipulation performance. This option enables deletion of referenced instances without removing of the references themselves. Use this option with extreme care. Never on models that are meant to remain persistent in the EDMdatabase . This option may lead to inconsistent populations containing references to non-existing instances. |
DELETE_INSTANCE_REFS_ON_DELETE | If an edmModel is implicitly created, this option will disable one of the models built in features, thereby improving its data manipulation performance. This option causes all external references to an instance to be deleted automatically when the instance itself is deleted. Use this option with care. Preferably not on models that are meant to remain persistent in the EDMdatabase . |
NO_INSTANCE_REFERENCES | If an edmModel is implicitly created, this option will disable one of the models built in features, thereby improving its data manipulation performance. This option prevents the creation and maintenance of "instance references tables". As a result of this, the following operations will not work:
|
USER_CONTROLLED_INVERSE | If an edmModel is implicitly created, this option will disable one of the models built in features, thereby improving its data manipulation performance. This option prevents automatic update and maintenance of the INVERSE attributes in the actual model. Use this option with care. Preferably not on models that are meant to remain persistent in the EDMdatabase . |
ADD_TO_EXISTING_MODEL | The imported XML data will be added to the existing edmModel. The XML data must be based on the same underlying Express Schema as that of the existing edmModel. This option enables incremental population of edmModels from XML files. |
PARSE_ONLY | The specified XML file will be parsed only, i.e. only checked for syntactical correctness. No data will be stored in the EDMdatabase. |
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. Use this option with care. It may result in inconsistent population. |
PERSISTENT_INSTANCES_HASH_TABLE | creates a EDMpersistentInstancesHashTable |
Example
EdmiError rstat, error; SdaiServerContext localContext, remoteContext; SdaiModel myModelId; SdaiInstance instId; SdaiInteger nErr, nWrn; tSdaiSelect sel; . . . /* Create an instance in the local database */ instId = edmiCreateInstanceAndPutAttrsBN(myModelId, "PERSON", 3, "FIRST_NAME", sdaiSTRING, "LUCY", "LAST_NAME", sdaiSTRING, "SCHMIDT", "SEX", sdaiENUMERATION, "FEMALE"); /* Put lucy into a select struct */ sel.nTypes = 0; sel.type = sdaiINSTANCE; sel.typeList = NULL; sel.value.instVal = instId; /* Define Local Db Context */ rstat = edmiDefineServerContext("MyLocalDbContext", "Johnny", "Supervisor", "cf37ftr", "LOCAL_DB", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &localContext); /* Write xml to file */ rstat = edmiRemoteWriteXMLFile(localContext, NULL, NULL, &sel, NULL, NULL, "friends", "c:/xml/lucy.xml", NULL, "UTF-8", "UTF-8", INCLUDE_CONFIGURATION, &nWrn, &nErr, &error, NULL); /* Define Remote Server Context */ rstat = edmiDefineServerContext("MyRemoteServerContext", "Johnny", "Supervisor", "cf37ftr", "TCP", "9090", "MyServerHost", NULL, NULL, NULL, NULL, NULL, &remoteContext); /* Read xml into remote database */ rstat = edmiRemoteReadXMLFile(remoteContext, "DataRepository", "MyFriends", NULL, NULL, "c:/xml/lucy.xml", NULL, "NETWORK", ADD_TO_EXISTING_MODEL, &nWrn, &nErr, &error, NULL); . . .
See also
Filter by label
There are no items with the selected labels at this time.