test_ftypeDefine.c
#include "SDO.h"
#include "assert.h"
// Defining types from a file containing an XML Schema;
// TODO: FIXME: must declare schema components in default xmlns
// namespace (use eg. xmlns:t="..." <xsd:simpleType name="t:...">
// doesn't appear to work
void test_ftypeDefine() {
SDOFACTORY df = dfAlloc("test_ftypeDefine");
SDOTYPE t0 = findType(df, "http://www.example.com", "myType");
FILE *f = fopen("test_ftypeDefine.tmp", "w");
fputs(
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n"
" targetNamespace=\"http://www.example.com\"\n"
" xmlns=\"http://www.example.com\">\n"
" <xsd:simpleType name=\"myType\">\n"
" <xsd:restriction base=\"xsd:string\"/>\n"
" </xsd:simpleType>\n"
"</xsd:schema>\n", f);
fclose(f);
f = fopen("test_ftypeDefine.tmp", "r");
SDOLIST l = ftypeDefine(df, f);
fclose(f);
fprintf(stderr, "getCountList=%d\n", getCountList(l));
fflush(stderr);
assert(getCountList(l) == 1);
assert(!strcmp("myType", getTypeName(getTypeList(l, 0))));
assert(findType(df, "http://www.example.com", "myType"));
}