![]() |
![]() |
![]() |
Lasso Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
const char * (*LassoRegistryTranslationFunction) (const char *from_namespace, const char *from_name, const char *to_namespace); gint lasso_registry_default_add_direct_mapping (const char *from_namespace, const char *from_name, const char *to_namespace, const char *to_name); gint lasso_registry_default_add_functional_mapping (const char *from_namespace, const char *to_namespace, LassoRegistryTranslationFunction translation_function); const char* lasso_registry_default_get_mapping (const char *from_namespace, const char *from_name, const char *to_namespace);
This object implement a function of (namespace, name, namespace) -> namespace. For the moment there is no need to enumerate all (namespace, name) pair given a base pair (i.e. a function (namespace, name) -> [(namespace,name)].
We support two kind of mapping; you can give a direct mapping between two QName, or you can give a function that will manage mapping between one namespace and another one.
A QName is a name qualified by a namespace.
For internal use inside lasso we define the following namespaces: LASSO_LASSO_HREF http://www.entrouvert.org/namespaces/lasso/0.0 LASSO_PYTHON_HREF http://lasso.entrouvert.org/namespaces/python/0.0
For functionnal mappings the mapping function must return const char* strings created using
g_intern_string()
or using g_type_name()
.
const char * (*LassoRegistryTranslationFunction) (const char *from_namespace, const char *from_name, const char *to_namespace);
gint lasso_registry_default_add_direct_mapping (const char *from_namespace, const char *from_name, const char *to_namespace, const char *to_name);
Add a new mapping from a QName to a QName.
|
the namespace of the mapped QName |
|
the name of the mapped QName |
|
the namepsace of the mapped to QName |
|
the name of the mapped to QName |
Returns : |
0 if successfull, LASSO_REGISTRY_ERROR_KEY_EXISTS if this mapping is already registered, LASSO_PARAM_ERROR_INVALID_VALUE if one the argument is invalid. |
gint lasso_registry_default_add_functional_mapping (const char *from_namespace, const char *to_namespace, LassoRegistryTranslationFunction translation_function);
from_namespace
: URI of the source namespace
to_namespace
: URI of the destination namespace
translation_function
: a function mapping string to string from the first namespace to the second one
Register a new mapping from from_namesapce to to_namespace using the translation_function into the default mapping. This functions is not forced to return a value for any string, it can return NULL.
Returns : |
0 if successfull, LASSO_REGISTRY_ERROR_KEY_EXISTS if this mapping is already registered, LASSO_PARAM_ERROR_INVALID_VALUE if one the argument is invalid. |
const char* lasso_registry_default_get_mapping (const char *from_namespace, const char *from_name, const char *to_namespace);
Retrieve the name of the QName in the namespace to_namespace that maps the QName from_namespace:from_name.
|
the namespace of the mapped QName |
|
the name of the mapped QName |
|
the namepsace of the mapped to QName |
Returns : |
the name string of the QName or NULL if no mapping exists. |