edmiRemoteReadXMLDocument
EdmiError edmiRemoteReadXMLDocument(SdaiServerContext serverContextId, SdaiString remoteRepositoryName, SdaiString remoteModelName, SdaiString xmlFileName, SdaiString xmlString, SdaiString xmlDiagNosticFile, SdaiString *xmlDiagnosticString, SdaiString encodingEdm, SdaiOptions options, SdaiString *encodingXmlDocument, SdaiInteger *nbWarnings, SdaiInteger *nbErrors, SdaiInvocationId *edmiInvocationId);
Reads an XML document into an existing edmModel in a remote EDMdatabase. The imported data will be added to any existing data in the model. In case incremental import is not required, the model must be manually emptied, e.g with edmiRemoteDeleteModelContents, before invoking this function.
Arguments
1 | Type | Name | Comment |
2 | SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
3 | SdaiString | remoteRepositoryName | The name of the edmRepository in which to populate an existing edmModel with the XML data stored in the file specified by the <xmlFileName> argument. The XML data will be appended to any existing population of the edmModel. The edmRepository and the edmModel must exist in the remote EDMdatabase Repository names are case sensitive. |
4 | SdaiString | remoteModelName | The name of the edmModel to populate. The <remoteRepositoryName> and <remoteModelName> arguments uniquely identify an existing edmModel in the remote EDMdatabase. Model names are case sensitive. |
5 | SdaiString | xmlFileName | The name of the file, on the local file system, containing the XML data to read. If <xmlFileName> is NULL, data will be read from the string given in the argument <xmlString>. |
6 | SdaiString | xmlString | The string containing the XML data to be read. If the <xmlFileName> argument is not NULL and contains anything but an empty string, this argument will be neglected. |
7 | SdaiString | xmlDiagNosticFile | The name of the file, on the local file system, that will receive the diagnostics from the parsing of the XML data. If <xmlDiagnosticFile> is NULL, the parsing diagnostics will be written to the string given in the argument <xmlDiagnosticString>. |
8 | SdaiString | xmlDiagnosticString | Variable that will receive the address of an allocated string containing the diagnostics from the parsing of the XML data. If the <xmlDiagnosticFile> argument is not NULL and contains anything but an empty string, this argument will be neglected. |
9 | SdaiString | encodingEdm | The encoding that will be used by EDM. Valid encoding are;
|
10 | SdaiOptions | options | See the description of all available options below. Multiple options may be specified by using the bitwise OR operator. |
11 | SdaiString | encodingXmlDocument | Variable that will receive the encoding of the data in the XML document |
12 | SdaiInteger | nbWarnings | Variable that will receive the number of warnings that resulted from the execution of the function. |
13 | SdaiInteger | nbErrors | Variable that will receive the number of errors that resulted from the execution of the function. |
14 | SdaiInvocationId | edmiInvocationId | Currently unused |
Return Value
Â
Options
 Â
Option | Comment |
SHOW_STATISTICS | Show statistics when parsing the XML data. |
XML_PARSE_TRACE | Trace the parsing of the XML data. |
PARSE_ONLY | The XML document will be parsed only, i.e. only checked for syntactical correctness. No data will be stored in the EDMdatabase. |
CONTINUE_STORING_ON_ERROR | Ignore errors when populating the data model from the XML document, e.g, entities that do not exist in the Express schema will simply be ignored. By default, the import will be stopped in case of erroneous data. |
Â
Example
Â
 EdmiError rstat; SdaiServerContext localContext, remoteContext; SdaiModel myModelId; SdaiSchema schemaId; SdaiInstance instId, xmlConfigId; SdaiInteger nInst, nErr, nWrn; SdaiString xmlString, xmlEncoding; . . . /* Create an instance in the local database */ instId = edmiCreateInstanceAndPutAttrsBN(myModelId, "PERSON", 3, "FIRST_NAME", sdaiSTRING, "LUCY", "LAST_NAME", sdaiSTRING, "SCHMIDT", "SEX", sdaiENUMERATION, "FEMALE"); /* Get predefined xml config id */ rstat = edmiGetSchema("SOCIAL_NETWORK", &schemaId); rstat = edmiGetXMLConfigurationId(schemaId, "friends", &xmlConfigId); /* Define Local Db Context */ rstat = edmiDefineServerContext("MyLocalDbContext", "Johnny", "Supervisor", "cf37ftr", "LOCAL_DB", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &localContext); /* Write xml to string */ rstat = edmiRemoteWriteXMLDocument(localContext, NULL, NULL, NULL, NULL, &instId, 0, 1, &nInst, NULL, xmlConfigId, NULL, &xmlString, "c:/tmp/xml.dignostics", NULL, "UTF-8", "UTF-8", INCLUDE_CONFIGURATION, &nWrn, &nErr, 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 = edmiRemoteReadXMLDocument(remoteContext, "DataRepository", "MyFriends", NULL, xmlString, NULL, NULL, "UTF-8", 0, &xmlEncoding, &nWrn, &nErr, NULL); . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â