mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
merge in new iksemel patches
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11645 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* iksemel (XML parser for Jabber)
|
||||
** Copyright (C) 2000-2004 Gurer Ozen <madcat@e-kolay.net>
|
||||
** Copyright (C) 2000-2007 Gurer Ozen <madcat@e-kolay.net>
|
||||
** This code is free software; you can redistribute it and/or
|
||||
** modify it under the terms of GNU Lesser General Public License.
|
||||
*/
|
||||
@@ -183,6 +183,106 @@ iks_insert_node (iks *x, iks *y)
|
||||
return y;
|
||||
}
|
||||
|
||||
iks *
|
||||
iks_append (iks *x, const char *name)
|
||||
{
|
||||
iks *y;
|
||||
|
||||
if (!x) return NULL;
|
||||
y = iks_new_within (name, x->s);
|
||||
if (!y) return NULL;
|
||||
|
||||
if (x->next) {
|
||||
x->next->prev = y;
|
||||
} else {
|
||||
IKS_TAG_LAST_CHILD (x->parent) = y;
|
||||
}
|
||||
y->next = x->next;
|
||||
x->next = y;
|
||||
y->parent = x->parent;
|
||||
y->prev = x;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
iks *
|
||||
iks_prepend (iks *x, const char *name)
|
||||
{
|
||||
iks *y;
|
||||
|
||||
if (!x) return NULL;
|
||||
y = iks_new_within (name, x->s);
|
||||
if (!y) return NULL;
|
||||
|
||||
if (x->prev) {
|
||||
x->prev->next = y;
|
||||
} else {
|
||||
IKS_TAG_CHILDREN (x->parent) = y;
|
||||
}
|
||||
y->prev = x->prev;
|
||||
x->prev = y;
|
||||
y->parent = x->parent;
|
||||
y->next = x;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
iks *
|
||||
iks_append_cdata (iks *x, const char *data, size_t len)
|
||||
{
|
||||
iks *y;
|
||||
|
||||
if (!x || !data) return NULL;
|
||||
if (len == 0) len = strlen (data);
|
||||
|
||||
y = iks_new_within (NULL, x->s);
|
||||
if (!y) return NULL;
|
||||
y->type = IKS_CDATA;
|
||||
IKS_CDATA_CDATA (y) = iks_stack_strdup (x->s, data, len);
|
||||
if (!IKS_CDATA_CDATA (y)) return NULL;
|
||||
IKS_CDATA_LEN (y) = len;
|
||||
|
||||
if (x->next) {
|
||||
x->next->prev = y;
|
||||
} else {
|
||||
IKS_TAG_LAST_CHILD (x->parent) = y;
|
||||
}
|
||||
y->next = x->next;
|
||||
x->next = y;
|
||||
y->parent = x->parent;
|
||||
y->prev = x;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
iks *
|
||||
iks_prepend_cdata (iks *x, const char *data, size_t len)
|
||||
{
|
||||
iks *y;
|
||||
|
||||
if (!x || !data) return NULL;
|
||||
if (len == 0) len = strlen (data);
|
||||
|
||||
y = iks_new_within (NULL, x->s);
|
||||
if (!y) return NULL;
|
||||
y->type = IKS_CDATA;
|
||||
IKS_CDATA_CDATA(y) = iks_stack_strdup (x->s, data, len);
|
||||
if (!IKS_CDATA_CDATA (y)) return NULL;
|
||||
IKS_CDATA_LEN (y) = len;
|
||||
|
||||
if (x->prev) {
|
||||
x->prev->next = y;
|
||||
} else {
|
||||
IKS_TAG_CHILDREN (x->parent) = y;
|
||||
}
|
||||
y->prev = x->prev;
|
||||
x->prev = y;
|
||||
y->parent = x->parent;
|
||||
y->next = x;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
void
|
||||
iks_hide (iks *x)
|
||||
{
|
||||
@@ -379,7 +479,7 @@ char *
|
||||
iks_name (iks *x)
|
||||
{
|
||||
if (x) {
|
||||
if (IKS_TAG == x->type)
|
||||
if (IKS_TAG == x->type)
|
||||
return IKS_TAG_NAME (x);
|
||||
else
|
||||
return IKS_ATTRIB_NAME (x);
|
||||
|
Reference in New Issue
Block a user