mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
53464e8963
re: https://github.com/Unidata/netcdf-c/issues/2119 H/T to [Egbert Eich](https://github.com/e4t) and [Bas Couwenberg](https://github.com/sebastic) for this PR. It is undesirable to make netcdf be dependent on the availability of libxml2, but it is desirable to allow its use if available. In order to do this, a wrapper API (include/ncxml.h) was constructed that supports either ezxml or libxml2 as the implementation. Additionally, the xml support code was moved to a new directory netcdf-c/libncxml. Primary changes: * Create a new sub-directory named netcdf-c/libncxml to hold all the xml implementation code. * Move ezxml.c and ezxml.h to libncxml * Create a wrapper API -- include/ncxml.h * Create an implementation, ncxml_ezxml.c to support use of ezxml. * Create an implementation, ncxml_xml2.c to support use of libxml2. * Add a check for libxml2 in configure.ac and CMakeLists.txt * Modify libdap to use the wrapper API instead of ezxml directly. Misc. Other Changes: * Change include/netcdf_json.h from built source to be part of the distribution.
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/* Copyright 2018-2018 University Corporation for Atmospheric
|
|
Research/Unidata. */
|
|
|
|
#ifndef NCXML_H
|
|
#define NCXML_H
|
|
|
|
#ifdef _WIN32
|
|
#ifdef DLL_EXPORT /* define when building the library */
|
|
#define DECLSPEC __declspec(dllexport)
|
|
#else
|
|
#define DECLSPEC __declspec(dllimport)
|
|
#endif
|
|
#else
|
|
#define DECLSPEC
|
|
#endif
|
|
|
|
typedef void* ncxml_t;
|
|
typedef void* ncxml_attr_t;
|
|
typedef void* ncxml_doc_t;
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
DECLSPEC void ncxml_initialize(void);
|
|
DECLSPEC void ncxml_finalize(void);
|
|
DECLSPEC ncxml_doc_t ncxml_parse(char* contents, size_t len);
|
|
DECLSPEC void ncxml_free(ncxml_doc_t doc0);
|
|
DECLSPEC ncxml_t ncxml_root(ncxml_doc_t doc);
|
|
DECLSPEC const char* ncxml_name(ncxml_t xml0);
|
|
DECLSPEC char* ncxml_attr(ncxml_t xml0, const char* key);
|
|
DECLSPEC ncxml_t ncxml_child(ncxml_t xml0, const char* name);
|
|
DECLSPEC ncxml_t ncxml_next(ncxml_t xml0, const char* name);
|
|
DECLSPEC char* ncxml_text(ncxml_t xml0);
|
|
DECLSPEC int ncxml_attr_pairs(ncxml_t xml0, char*** pairsp);
|
|
/* Nameless versions of child and next */
|
|
DECLSPEC ncxml_t ncxml_child_first(ncxml_t xml0);
|
|
DECLSPEC ncxml_t ncxml_child_next(ncxml_t xml0);
|
|
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif /*NCXML_H*/
|