libxml2_plugin.c 745 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <stdlib.h>
  2. #include <errno.h>
  3. #include <string.h>
  4. #include <assert.h>
  5. #include <libxml/parser.h>
  6. #include <libxml/tree.h>
  7. #include <faux/faux.h>
  8. #include <faux/str.h>
  9. #include <faux/error.h>
  10. #include <klish/kxml.h>
  11. #include <klish/kscheme.h>
  12. #include <klish/kdb.h>
  13. uint8_t kdb_libxml2_major = KDB_MAJOR;
  14. uint8_t kdb_libxml2_minor = KDB_MINOR;
  15. bool_t kdb_libxml2_load_scheme(kdb_t *db, kscheme_t *scheme)
  16. {
  17. faux_ini_t *ini = NULL;
  18. faux_error_t *error = NULL;
  19. const char *xml_path = NULL;
  20. assert(db);
  21. if (!db)
  22. return BOOL_FALSE;
  23. // Get configuration info from kdb object
  24. ini = kdb_ini(db);
  25. if (ini)
  26. xml_path = faux_ini_find(ini, "XMLPath");
  27. error = kdb_error(db);
  28. return kxml_load_scheme(scheme, xml_path, error);
  29. }