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 Next »


 
Reads an Xml formatted document into an existing data model in the 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 edmiDeleteModelContents, before invoking this function.
 
Related functions: edmiReadXMLFile
Header:
#include "sdai.h"
Prototype:
EdmiError edmiReadXMLDocument (SdaiXml         pXml,
                                SdaiModel       modelId,
                                SdaiString      encodingEdm,
                                SdaiUnsignedInt options);
Arguments:

pXml

Xml document exchange struct. See sdai.h for detailed description of all data structure elements.

modelId

modelId of the data model in the EDMdatabase to populate. This function can not create a model implicitly. I.e, the model must exist.

encodingEdm

The encoding of data in EDM. Valid encodings 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 encoding in EDM is UTF8. If this parameter is NULL or an empty string, the default value will be the encoding that is specified within the Xml document.

options

A bitwise OR between the options listed and described below. All available options are defined in the header file sdai.h .

Options: Descriptions:

SHOW_STATISTICS

Show statistics when reading/writing XML

XML_PARSE_TRACE

Show trace when reading/writing XML

CREATE_SCRATCH_INSTANCES

The imported population in the xml document will not be persistant.

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 abrupted in case of erroneous data.

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;
SdaiModel modId;
SdaiXml xml;
SdaiUnsignedInt options = SHOW_STATISTICS | XML_PARSE_TRACE;
SdaiString encoding = "UTF-8";
. . .
 
modId = edmiGetModel("myRepository", "myModel");
if (rstat = edmiReadXMLDocument (xml, modId, encoding, options)) {
printf("\nError %d in edmiReadXMLDocument: %s", rstat, 
edmiGetErrorText(rstat));
goto error; 
}

  • No labels