long double * soap_indecimal(struct soap *soap, const char *tag, long double *p, const char *type, int t) { if (soap_element_begin_in(soap, tag, 0, type)) return NULL; p = (long double*)soap_id_enter(soap, soap->id, p, t, sizeof(long double), 0, NULL, NULL, NULL); if (*soap->href) p = (long double*)soap_id_forward(soap, soap->href, p, 0, t, 0, sizeof(long double), 0, NULL); else if (p) { if (soap_s2decimal(soap, soap_value(soap), p)) return NULL; } if (soap->body && soap_element_end_in(soap, tag)) return NULL; return p; }
__int128_t * soap_in_xsd__integer(struct soap *soap, const char *tag, __int128_t *a, const char *type) { if (soap_element_begin_in(soap, tag, 0, type)) return NULL; a = (__int128_t*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__integer, sizeof(__int128_t), NULL, NULL, NULL, NULL); if (*soap->href) a = (__int128_t*)soap_id_forward(soap, soap->href, a, 0, SOAP_TYPE_xsd__integer, 0, sizeof(__int128_t), 0, NULL, NULL); else if (a) { if (soap_s2xsd__integer(soap, soap_value(soap), a)) return NULL; } if (soap->body && soap_element_end_in(soap, tag)) return NULL; return a; }
struct timeval *soap_in_xsd__dateTime(struct soap *soap, const char *tag, struct timeval *a, const char *type) { if (soap_element_begin_in(soap, tag, 0, NULL)) return NULL; if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":dateTime")) { soap->error = SOAP_TYPE; soap_revert(soap); return NULL; } a = (struct timeval*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__dateTime, sizeof(struct timeval), 0, NULL, NULL, NULL); if (*soap->href) a = (struct timeval*)soap_id_forward(soap, soap->href, a, 0, SOAP_TYPE_xsd__dateTime, 0, sizeof(struct timeval), 0, NULL); else if (a) { if (soap_s2xsd__dateTime(soap, soap_value(soap), a)) return NULL; } if (soap->body && soap_element_end_in(soap, tag)) return NULL; return a; }
struct tm *soap_in_xsd__dateTime(struct soap *soap, const char *tag, struct tm *a, const char *type) { if (soap_element_begin_in(soap, tag, 0)) return NULL; if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":dateTime")) { soap->error = SOAP_TYPE; soap_revert(soap); return NULL; } a = (struct tm*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__dateTime, sizeof(struct tm), 0, NULL, NULL, NULL); if (*soap->href) a = (struct tm*)soap_id_forward(soap, soap->href, a, 0, SOAP_TYPE_xsd__dateTime, 0, sizeof(struct tm), 0, NULL); else if (a) { const char *s = soap_value(soap); memset((void*)a, 0, sizeof(struct tm)); if (s) { char zone[16]; const char *t; zone[sizeof(zone)-1] = '\0'; if (strchr(s, '-')) t = "%d-%d-%dT%d:%d:%d%15s"; else if (strchr(s, ':')) t = "%4d%2d%2dT%d:%d:%d%15s"; else /* parse non-XSD-standard alternative ISO 8601 format */ t = "%4d%2d%2dT%2d%2d%2d%15s"; sscanf(s, t, &a->tm_year, &a->tm_mon, &a->tm_mday, &a->tm_hour, &a->tm_min, &a->tm_sec, zone); if (a->tm_year == 1) a->tm_year = 70; else a->tm_year -= 1900; a->tm_mon--; if (*zone) { if (*zone == '.') { for (s = zone + 1; *s; s++) if (*s < '0' || *s > '9') break; } else s = zone; if (*s == '+' || *s == '-') { int h = 0, m = 0; if (s[3] == ':') { sscanf(s, "%d:%d", &h, &m); if (h < 0) m = -m; } else { m = (int)atol(s); h = m / 100; m = m % 100; } a->tm_hour -= h; a->tm_min -= m; } a->tm_isdst = 0; } else a->tm_isdst = -1; } } if (soap->body && soap_element_end_in(soap, tag)) return NULL; return a; }
/** * soap_tree_value * @node: pointer to an XML subtree * @colonstring: node name strings that are being searched; for example, to * search for nodes "a", then "b", then "c", pass "a:b:c" * * soap_tree_value() is a heavily-used combination of soap_walk_tree() and * soap_value(), both described above. Generally used to locate specific * response parameters and obtain their values. NULL is returned if anything * goes wrong with the response, so callers must be prepared for that value. * * Return value: a string pointer to the XLM content field. NULL is returned * if there is any sort of problem accessing the value. **/ char *soap_tree_value(xmlNode *node, char *colonstring) { return(soap_value(soap_walk_tree(node, colonstring))); }