Creates a new XML Configuration for a compiled express schema in the EDMdatabase
Any number of XML Configurations may be defined for each express schema. XML Configurations are stored and handled in the same way as query schemas and rule schemas. All XML Configurations are unique instances of the edm_xml_configuration entity in the ExpressDataManager model.
XML Configurations are protected objects in the EDMdatabase. Ownership and access rights may be set up individually on each XML Configuration in the same way as for any other protected database object in EDM.
Related functions: edmiDeleteXMLConfiguration , edmiDeleteXMLConfigurationBN , edmiGetXMLConfiguration , edmiGetXMLConfigurationBN , edmiGetXMLConfigurationId , edmiListXMLConfigurations
Header:
#include "sdai.h"
Prototype:
EdmiError edmiCreateXMLConfiguration(SdaiSchema schemaId,
SdaiString xmlConfigurationName,
SdaiString xmlConfigurationString,
SdaiString nameSpace,
SdaiString nameSpaceAlias,
SdaiString xmlSchemaURL,
SdaiUnsignedInt options,
SdaiInstance *xmlConfigurationId);
Arguments:
SchemaId | A numeric schemaID that uniquely identifies the assosiated Express schema in an EDMdatabase. |
XmlConfigurationName | A unique name that may be used for later reference to the XML Configuration. The name of the configuration should be the same as the id attribute of the configuration element in the XML. |
xmlConfigurationString | The actual configuration XML to be stored. |
nameSpace | The namespace string to associate with the configuration. The parameter is optional. This is the namespace of elements contained in the UOS element of the generated XML |
nameSpaceAlias | The namespace alias related to the namespace above. |
xmlSchemaURL | The XML Schema url related to the namespace above. |
options | Currently unused. |
xmlConfigurationId | The instance Id of the XML Configurations insert in the entity extent of edm_xml_configuration in the ExpressDataManager model. |
Option Description
| 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_MALLOC_FILE_SIZE 8194
EdmiError rstat;
SdaiSchema schemaId;
SdaiString schemaName = "ifc2x2";
SdaiInteger numRead;
SdaiString xmlConfigFile = "c:/home/Johnny/ifcXmlConfigFile.xml";
SdaiString xmlConfigName = "i-ifc2x2";
SdaiInteger fileSize = S_MALLOC_FILE_SIZE;
SdaiString xmlConfigString = (SdaiString *) malloc (fileSize);
SdaiInstance xmlConfigId;
FILE *fp = NULL;
rstat = edmiGetSchema(schemaName, &schemaId);
if ((fp = fopen(xmlConfigFile, "r")) == NULL) {
/* error message */
goto Error;
}
xmlConfigurationString = (char *) malloc (fileSize);
numRead = fread(xmlConfigString, sizeof(char), fileSize, fp);
xmlConfigString[numRead] = '\0';
fclose(fp);
if (rstat = edmiCreateXMLConfiguration(schemaId, xmlConfigName,
xmlConfigString, NULL,
NULL, NULL, NULL,
&xmlConfigId)) {
printf("\nError %d in edmiCreateXMLConfiguration: %s", rstat,
edmiGetErrorText(rstat));
goto Error;
}
printf("\nCreated XML Configuration with Id %d", xmlConfigId);
. . .
XML CONFIGURATION FILE EXAMPLE;
<?xml version="1.0" encoding="UTF-8"?>
<iso_10303_28>
<!-=================================================================->
<!– IFC XML namespace and schema –>
<!– Namespace: +http://www.iai-international.org/ifcXML/IFC2X2_FINAL+ –>
<!– Namespace alias: "ifc" –>
<!– XML Schema: "{PATH}IFC2X2_FINAL.xsd" –>
<!-=================================================================->
<configuration id="ifcxml"
targetNamespace="http://www.iai-international.org/ifcXML/IFC2X2_FINAL">
<!– All instances on root level.
All references by reference –>
<option naming-convention="preserve-case"
exp-type="root"
exp-attribute="double-tag"
tagless="true"
inheritance="false"
flatten="false"
sparse="false"/>
</configuration>
<configuration id="ifcxml_tagged_aggregate"
targetNamespace="http://www.iai-international.org/ifcXML/IFC2X2_FINAL">
<!– All instances on root level.
All references by reference –>
<option naming-convention="preserve-case"
exp-type="root"
exp-attribute="double-tag"
tagless="false"
flatten="false"
sparse="false"/>
</configuration>
</iso_10303_28>