Creates a new XML configuration in a dictionary model in a remote EDMdatabase
Related functions: edmiRemoteDeleteXMLConfiguration , edmiRemoteGetXMLConfiguration, edmiRemoteGetXMLConfigurationId, edmiRemoteListXMLConfigurations, edmiRemoteReadXMLDocument, edmiRemoteReadXMLFile, edmiRemoteWriteXMLDocument, edmiRemoteWriteXMLFile.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteCreateXMLConfiguration (SdaiServerContext serverContextId, SdaiString schemaName, SdaiString xmlConfigurationString, SdaiString nameSpace, SdaiString nameSpaceAlias, SdaiString xmlSchemaURL, SdaiUnsignedInt options, SdaiString *parserMessages, SdaiInstance *xmlConfigurationId, SdaiInvocationId *edmiInvocationId);
Arguments:
serverContextId | Context identification, from edmiDefineServerContext |
schemaName | The name of the Express Schema for which to create an XML configuration. |
xmlConfigurationString | The XML configuration. |
nameSpace | Optional namespace string to associate with the XML configuration. This is the namespace of the elements contained in the UOS element of the generated XML. |
nameSpaceAlias | Optional alias for the <nameSpace>. |
xmlSchemaURL | Optional XML Schema URL. |
options | Currently unused. |
parserMessages | Pointer variable that will receive the address of the diagnostics string allocated by the XML parser. |
xmlConfigurationId | Variable that will receive the instanceId that uniquely identifies the XML configuration in the EDMdatabase. |
edmiInvocationId | Currently unused. |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
#define S_FILE_SIZE 8194
FILE *fp = NULL;
EdmiError rstat;
SdaiString xmlConfigString, parserMsg;
SdaiInteger numRead;
SdaiInstance xmlConfigId;
SdaiServerContext myContext;
/* Create Server Context */
rstat = edmiDefineServerContext("MyContext",
"Johnny", "Supervisor", "cf37ftr",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &myContext);
/* Read XML Config String from file */
if ((fp = fopen("c:/xml/ifcXmlConfigFile.xml", "r")) == NULL) {
printf("\nError. Failed to open config file.");
goto err;
}
xmlConfigString = (char *) malloc (S_FILE_SIZE*sizeof(char));
numRead = fread(xmlConfigString, sizeof(char), S_FILE_SIZE, fp);
xmlConfigString[numRead] = '\0';
fclose(fp);
/* Create the XML Configuration */
if (rstat = edmiRemoteCreateXMLConfiguration(myContext,
"IFC2X2_FINAL", xmlConfigString,
"http://www.iai-international.org/ifcXML/IFC2X2_FINAL",
"ifc", "c:/xml/IFC2X2_FINAL.xsd", 0,
&parserMsg, &xmlConfigId, NULL)) {
printf("\nError %d in edmiRemoteCreateXMLConfiguration: %s",
rstat, edmiGetErrotText(rstat));
if (parserMsg) {
printf("\nReturned xml parser diagnostics:\n%s", parserMsg);
}
}
. . .