19 if (ptr && ptr->type == XML_ELEMENT_NODE &&
20 !xmlStrcmp(ptr->name, BAD_CAST elem))
33 struct _xmlAttr *attr;
38 for (attr = ptr->properties; attr; attr = attr->next)
39 if (!strcmp(attr->name,
"type") &&
40 attr->children && attr->children->type == XML_TEXT_NODE)
42 const char *t = strchr(attr->children->content,
':');
46 t = attr->children->content;
47 if (!strcmp(t,
"string"))
54 if (!ptr || ptr->type != XML_TEXT_NODE)
59 *val =
nmem_strdup(nmem, (
const char *) ptr->content);
61 *len = xmlStrlen(ptr->content);
77 char **val,
int *len,
int fixup_root)
80 int no_root_nodes = 0;
85 buf = xmlBufferCreate();
92 for (ptr = ptr->children; ptr; ptr = ptr->next)
94 if (ptr->type == XML_ELEMENT_NODE)
97 xmlNode *tmp = xmlCopyNode(ptr, 1);
99 xmlNodeDump(buf, tmp->doc, tmp, 0, 0);
105 if (no_root_nodes != 1 && fixup_root)
108 xmlBufferAddHead(buf, (
const xmlChar *)
"<yaz_record>", -1);
109 xmlBufferAdd(buf, (
const xmlChar *)
"</yaz_record>", -1);
111 *val =
odr_strdupn(o, (
const char *) buf->content, buf->use);
121 char **val,
int *len)
130 struct _xmlAttr *attr;
135 for (attr = ptr->properties; attr; attr = attr->next)
136 if (!strcmp(attr->name,
"type") &&
137 attr->children && attr->children->type == XML_TEXT_NODE)
139 const char *t = strchr(attr->children->content,
':');
143 t = attr->children->content;
144 if (!strcmp(t,
"integer"))
151 if (!ptr || ptr->type != XML_TEXT_NODE)
char * nmem_strdup(NMEM mem, const char *src)
allocates string on NMEM handle (similar strdup)
char * odr_strdupn(ODR o, const char *str, size_t n)
Odr_int odr_atoi(const char *s)
Odr_int * odr_intdup(ODR o, Odr_int v)
int yaz_match_xsd_element(xmlNodePtr ptr, const char *elem)
int yaz_match_xsd_string_n_nmem(xmlNodePtr ptr, const char *elem, NMEM nmem, char **val, int *len)
int yaz_match_xsd_XML_n2(xmlNodePtr ptr, const char *elem, ODR o, char **val, int *len, int fixup_root)
int yaz_match_xsd_XML_n(xmlNodePtr ptr, const char *elem, ODR o, char **val, int *len)
int yaz_match_xsd_string_n(xmlNodePtr ptr, const char *elem, ODR o, char **val, int *len)
int yaz_match_xsd_string(xmlNodePtr ptr, const char *elem, ODR o, char **val)
int yaz_match_xsd_integer(xmlNodePtr ptr, const char *elem, ODR o, Odr_int **val)