Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Generates an XML file from an existing edmModel population in a remote EDMdatabase.
This function is a higher level implementation of edmiRemoteWriteXMLDocument. In addition to the features of edmiRemoteWriteXMLDocument, the header model name and repository info stored in the XML file may be optionally overruled by values given as input parameters.
Writing XML data and diagnostics to allocated strings in memory is not possible with this function. Use edmiRemoteWriteXMLDocument if this feature is required.
Related functions: edmiRemoteCreateXMLConfiguration , edmiRemoteDeleteXMLConfiguration , edmiRemoteGetXMLConfiguration, edmiRemoteGetXMLConfigurationId, edmiRemoteListXMLConfigurations, edmiRemoteReadXMLDocument, edmiRemoteReadXMLFile, edmiRemoteWriteXMLDocument.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteWriteXMLFile(SdaiServerContext serverContextId,
                                  SdaiString        remoteModelRepositoryName, 
                                  SdaiString        remoteModelName, 
                                  SdaiSelect        pSel, 
                                  SdaiString        remoteHeaderModelRepositoryName, 
                                  SdaiString        remoteHeaderModelName, 
                                  SdaiString        remoteXmlConfigName, 
                                  SdaiString        xmlFileName, 
                                  SdaiString        diagnosticFileName, 
                                  SdaiString        encodingEdm,
                                  SdaiString        encodingXml,
                                  SdaiUnsignedInt   options,  
                                  SdaiInteger       *nbWarnings,
                                  SdaiInteger       *nbErrors, 
                                  SdaiErrorCode     *sdaiError, 
                                  SdaiUnsignedInt   *edmiInvocationId); 
 
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

remoteModelRepositoryName

The name of the edmRepository that contains the edmModel with the population to export to an XML file. Repository names are case sensitive.

remoteModelName

The name of the edmModel that contains the population to be exported to an XML file. Model names are case sensitive.

pSel

A tSdaiSelect structure that contains the data to be exported to an XML file.
This argument will only be used when the argument <remoteRepositoryName> is NULL or contains an empty string.
Currently, this select structure may only contain two types of data. Either a single instanceId or an aggregate of instanceIds.

remoteHeaderModelRepositoryName

The name of the edmRepository that contains the header model of the edmModel. Repository names are case sensitive.

remoteHeaderModelName

The name of the header model. Model names are case sensitive.

remoteXmlConfigName

The name of the XML configuration to apply. XML Configurations are unique within the scope of an Express Schema.

xmlFileName

The name of the file to be created on the local file system.

diagnosticFileName

Specifies the file name for diagnostic information generated by this function. If no file name is supplied, i.e. the <diagnosticFileName> argument is set to NULL, all diagnostic information will be written to the _EDMinterface_ current output device. The _EDMinterface_ current output device can be defined by the edmiDefineOutputFunction operation.

encodingEdm

The encoding that was be applied on the XML data when it was used to populate the edmModel. Valid encoding are:

  • "UTF-8",
  • "UTF-16",
  • "ISO-10646-UCS-2",
  • "ISO-10646-UCS-4",
  • "ISO-LATIN-1",
  • "ISO-LATIN-2",
  • "ISO-8859-3",
  • "ISO-8859-4",
  • "ISO-8859-5",
  • "ISO-8859-6",
  • "ISO-8859-7",
  • "ISO-8859-8",
  • "ISO-8859-9",
  • "ISO-2022-jp",
  • "SHIFT_JIS",
  • "EUC-JP"
    Default value is UTF-8.

encodingXml

The encoding that will be applied on the XML file. Valid encoding are:

  • "UTF-8",
  • "UTF-16",
  • "ISO-10646-UCS-2",
  • "ISO-10646-UCS-4",
  • "ISO-LATIN-1",
  • "ISO-LATIN-2",
  • "ISO-8859-3",
  • "ISO-8859-4",
  • "ISO-8859-5",
  • "ISO-8859-6",
  • "ISO-8859-7",
  • "ISO-8859-8",
  • "ISO-8859-9",
  • "ISO-2022-jp",
  • "SHIFT_JIS",
  • "EUC-JP"
    Default value is UTF-8.

options

See the description of all available options below.
Multiple options may be specified by using the bitwise OR operator.

nbWarnings

Address of a variable that will receive the number of warnings that resulted from the execution of this function.

nbErrors

Address of a variable that will receive the number of errors that resulted from the execution of this function.

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.

edmiInvocationId

Currently unused

Options: Descriptions:

INCLUDE_HEADER

Include a header element in the XML file.

INCLUDE_CONFIGURATION

Include a configuration element in the XML file.

INCLUDE_SCHEMA

Include the schema elements in the XML file.

EXTRACT_SHALLOW

Only the instanceIds that are explicitly listed will be included in the XML file. No reference paths will be followed. By default, the entire mesh of referenced instances will be included in the XML file.

EDM_IDENTIFIERS

Specifies that the _EDMdatabase_ instanceIds will be used as xmlIds in the XML document. This will simplify comparison between the _EDMdatabase_ InstanceIds and the xmlIds.

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:
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); 
. . .

  • No labels