update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6455 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a8433a1956
commit
dc96942b88
|
@ -190,8 +190,8 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_get(switch_xml_t xml,...);
|
|||
///\ must be freed.
|
||||
///\param xml the xml node
|
||||
///\return the xml text string
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml);
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset);
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_header);
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset, switch_bool_t prn_header);
|
||||
|
||||
///\brief returns a NULL terminated array of processing instructions for the given
|
||||
///\ target
|
||||
|
|
|
@ -47,7 +47,7 @@ SWITCH_STANDARD_API(find_user_function)
|
|||
int argc;
|
||||
char *mydata = NULL, *argv[3];
|
||||
char *key, *user, *domain;
|
||||
char *xmlstr, *xs;
|
||||
char *xmlstr;
|
||||
|
||||
if (!cmd) {
|
||||
stream->write_function(stream, "bad args\n");
|
||||
|
@ -82,14 +82,10 @@ SWITCH_STANDARD_API(find_user_function)
|
|||
end:
|
||||
|
||||
if (xml && x_user) {
|
||||
xmlstr = switch_xml_toxml(x_user);
|
||||
xmlstr = switch_xml_toxml(x_user, SWITCH_FALSE);
|
||||
assert(xmlstr);
|
||||
if ((xs = strstr(xmlstr, "?>"))) {
|
||||
xs += 2;
|
||||
} else {
|
||||
xs = xmlstr;
|
||||
}
|
||||
stream->write_function(stream, "%s", xs);
|
||||
|
||||
stream->write_function(stream, "%s", xmlstr);
|
||||
free(xmlstr);
|
||||
switch_xml_free(xml);
|
||||
|
||||
|
@ -1607,7 +1603,7 @@ SWITCH_STANDARD_API(show_function)
|
|||
snprintf(count, sizeof(count), "%d", holder.count);
|
||||
|
||||
switch_xml_set_attr(switch_xml_set_flag(holder.xml, SWITCH_XML_DUP), strdup("row_count"), strdup(count));
|
||||
xmlstr = switch_xml_toxml(holder.xml);
|
||||
xmlstr = switch_xml_toxml(holder.xml, SWITCH_FALSE);
|
||||
|
||||
if (xmlstr) {
|
||||
holder.stream->write_function(holder.stream, "%s", xmlstr);
|
||||
|
|
|
@ -527,7 +527,7 @@ SWITCH_STANDARD_API(fifo_api_function)
|
|||
switch_mutex_unlock(node->mutex);
|
||||
}
|
||||
}
|
||||
xml_text = switch_xml_toxml(x_report);
|
||||
xml_text = switch_xml_toxml(x_report, SWITCH_FALSE);
|
||||
assert(xml_text);
|
||||
stream->write_function(stream, "%s\n", xml_text);
|
||||
switch_xml_free(x_report);
|
||||
|
|
|
@ -2595,7 +2595,7 @@ static void do_rss(vm_profile_t *profile, char *user, char *domain, char *host,
|
|||
sql = switch_mprintf("select * from voicemail_data where user='%s' and domain='%s' order by read_flags", user, domain);
|
||||
vm_execute_sql_callback(profile, profile->mutex, sql, rss_callback, &holder);
|
||||
|
||||
xmlstr = switch_xml_toxml(holder.xml);
|
||||
xmlstr = switch_xml_toxml(holder.xml, SWITCH_TRUE);
|
||||
|
||||
stream->write_function(stream, "%s", xmlstr);
|
||||
|
||||
|
|
|
@ -731,7 +731,7 @@ static void dl_logger(char *file, const char *func, int line, int level, char *f
|
|||
*xmltxt++ = '\0';
|
||||
if (strlen(xmltxt) > 2) {
|
||||
xml = switch_xml_parse_str(xmltxt, strlen(xmltxt));
|
||||
form = switch_xml_toxml(xml);
|
||||
form = switch_xml_toxml(xml, SWITCH_FALSE);
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level,
|
||||
"%s:\n-------------------------------------------------------------------------------\n"
|
||||
"%s\n", ll, form);
|
||||
|
@ -2301,7 +2301,7 @@ static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id)
|
|||
|
||||
switch_xml_set_attr(vcard, "xmlns", "vcard-tmp");
|
||||
|
||||
if ((xmlstr = switch_xml_toxml(vcard))) {
|
||||
if ((xmlstr = switch_xml_toxml(vcard, SWITCH_FALSE))) {
|
||||
ldl_handle_send_vcard(handle, to, from, id, xmlstr);
|
||||
sent = 1;
|
||||
} else {
|
||||
|
|
|
@ -471,7 +471,7 @@ static switch_status_t read_packet(listener_t * listener, switch_event_t **event
|
|||
etype = "xml";
|
||||
|
||||
if ((xml = switch_event_xmlize(event, "%s", ""))) {
|
||||
listener->ebuf = switch_xml_toxml(xml);
|
||||
listener->ebuf = switch_xml_toxml(xml, SWITCH_FALSE);
|
||||
switch_xml_free(xml);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML ERROR!\n");
|
||||
|
|
|
@ -50,7 +50,7 @@ static void event_handler(switch_event_t *event)
|
|||
default:
|
||||
switch_event_serialize(event, &buf);
|
||||
if ((xml = switch_event_xmlize(event, NULL))) {
|
||||
xmlstr = switch_xml_toxml(xml);
|
||||
xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
|
||||
dofree++;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ static JSBool request_dump_env(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
switch_xml_t xml;
|
||||
char *xmlstr;
|
||||
if ((xml = switch_event_xmlize(ro->stream->event, SWITCH_VA_NONE))) {
|
||||
xmlstr = switch_xml_toxml(xml);
|
||||
xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, xmlstr));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -646,7 +646,7 @@ static JSBool event_serialize(JSContext * cx, JSObject * obj, uintN argc, jsval
|
|||
switch_xml_t xml;
|
||||
char *xmlstr;
|
||||
if ((xml = switch_event_xmlize(eo->event, SWITCH_VA_NONE))) {
|
||||
xmlstr = switch_xml_toxml(xml);
|
||||
xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, xmlstr));
|
||||
switch_xml_free(xml);
|
||||
free(xmlstr);
|
||||
|
@ -1898,7 +1898,7 @@ static JSBool session_cdr(JSContext * cx, JSObject * obj, uintN argc, jsval * ar
|
|||
|
||||
if (switch_ivr_generate_xml_cdr(jss->session, &cdr) == SWITCH_STATUS_SUCCESS) {
|
||||
char *xml_text;
|
||||
if ((xml_text = switch_xml_toxml(cdr))) {
|
||||
if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, xml_text));
|
||||
}
|
||||
switch_safe_free(xml_text);
|
||||
|
|
|
@ -76,7 +76,7 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
|||
|
||||
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
|
||||
/* build the XML */
|
||||
if (!(xml_text = switch_xml_toxml(cdr))) {
|
||||
if (!(xml_text = switch_xml_toxml(cdr, SWITCH_TRUE))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
||||
goto error;
|
||||
}
|
||||
|
|
|
@ -1595,16 +1595,16 @@ static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len,
|
|||
}
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml)
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_header)
|
||||
{
|
||||
char *s;
|
||||
s = (char *)malloc(SWITCH_XML_BUFSIZE);
|
||||
return switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0);
|
||||
return switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header);
|
||||
}
|
||||
|
||||
// converts an switch_xml structure back to xml, returning a string of xml date that
|
||||
// must be freed
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset)
|
||||
SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset, switch_bool_t prn_header)
|
||||
{
|
||||
switch_xml_t p = (xml) ? xml->parent : NULL, o = (xml) ? xml->ordered : NULL;
|
||||
switch_xml_root_t root = (switch_xml_root_t) xml;
|
||||
|
@ -1617,8 +1617,9 @@ SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_
|
|||
assert(s != NULL);
|
||||
memset(s, 0, max);
|
||||
len += offset;
|
||||
len += sprintf(s + len, "<?xml version=\"1.0\"?>\n");
|
||||
|
||||
if (prn_header) {
|
||||
len += sprintf(s + len, "<?xml version=\"1.0\"?>\n");
|
||||
}
|
||||
|
||||
if (!xml || !xml->name) {
|
||||
if (!(r = (char *)realloc(s, len + 1))) {
|
||||
|
|
Loading…
Reference in New Issue