rem: s = tag; if (ns && soap->part != SOAP_IN_ENVELOPE && (soap->part == SOAP_IN_HEADER || !soap->encodingStyle)) { register const char *t = strchr(s, ':'); if (t) { s = t + 1; for (ns++; ns->id; ns++) { if ((ns->out || ns->ns) && !strncmp(ns->id, tag, t - tag) && !ns->id[t - tag]) { if (soap_send(soap, s) || soap_attribute(soap, "xmlns", ns->out ? ns->out : ns->ns)) return soap->error; s = NULL; break; } } } } if (s) if (soap_send(soap, tag)) return soap->error;
context: soap_element(struct soap *soap, const char *tag, int id, const char *type){ struct Namespace *ns = soap->local_namespaces;  register const char *s;  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:""));/**/#ifdef WITH_DOM  if (soap->mode & SOAP_XML_DOM)  { register struct soap_dom_element *p, *e = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element));    e->next = NULL;    e->prnt = soap->dom;    e->nstr = NULL;    e->name = soap_strdup(soap, tag); /* check EOM? */    e->data = NULL;    e->type = 0;    e->node = NULL;    e->elts = NULL;    e->atts = NULL;    if (soap->dom)    { p = soap->dom->elts;      if (p)      { while (p->next)          p = p->next;        p->next = e;      }      else        soap->dom->elts = e;    }    soap->dom = e;  }  else#endif{  soap->level++;  if (!soap->ns && !(soap->mode & SOAP_XML_CANONICAL))    if (soap_send(soap, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"))      return soap->error;  if (soap_send_raw(soap, "<", 1))    return soap->error;  s = tag;  if (ns && soap->part != SOAP_IN_ENVELOPE && (soap->part == SOAP_IN_HEADER || !soap->encodingStyle))  { register const char *t = strchr(s, ':');    if (t)    { s = t + 1;      for (ns++; ns->id; ns++)      { if ((ns->out || ns->ns) && !strncmp(ns->id, tag, t - tag) && !ns->id[t - tag])        { if (soap_send(soap, s) || soap_attribute(soap, "xmlns", ns->out ? ns->out : ns->ns))            return soap->error;	  s = NULL;          break;        }      }    }  }  if (s)    if (soap_send(soap, tag))      return soap->error;}/**/  if (!soap->ns)  { for (ns = soap->local_namespaces; ns && ns->id; ns++)    { if (*ns->id && (ns->out || ns->ns))      { sprintf(soap->tmpbuf, "xmlns:%s", ns->id);        if (soap_attribute(soap, soap->tmpbuf, ns->out ? ns->out : ns->ns))          return soap->error;      }    }    soap->ns = 1;  }  if (id > 0)  { sprintf(soap->tmpbuf, "_%d", id);    if (soap_attribute(soap, "id", soap->tmpbuf))      return soap->error;  }  if (type && *type)  { if (soap_attribute(soap, "xsi:type", type))      return soap->error;  }  if (soap->null && soap->position > 0)  { int i;    sprintf(soap->tmpbuf, "[%d", soap->positions[0]);    for (i = 1; i < soap->position; i++)      sprintf(soap->tmpbuf + strlen(soap->tmpbuf), ",%d", soap->positions[i]);    strcat(soap->tmpbuf, "]");    if (soap_attribute(soap, "SOAP-ENC:position", soap->tmpbuf))      return soap->error;  }  if (soap->mustUnderstand)  { if (soap->actor && *soap->actor)    { if (soap_attribute(soap, soap->version == 2 ? "SOAP-ENV:role" : "SOAP-ENV:actor", soap->actor))        return soap->error;    }    if (soap_attribute(soap, "SOAP-ENV:mustUnderstand", soap->version == 2 ? "true" : "1"))      return soap->error;    soap->mustUnderstand = 0;  }  if (soap->encoding)  { if (soap->encodingStyle)    { if (!*soap->encodingStyle && soap->local_namespaces)      { if (soap->local_namespaces[1].out)          soap->encodingStyle = soap->local_namespaces[1].out;        else          soap->encodingStyle = soap->local_namespaces[1].ns;      }      if (soap_attribute(soap, "SOAP-ENV:encodingStyle", soap->encodingStyle))        return soap->error;    }    soap->encoding = 0;  }  soap->null = 0;  soap->position = 0;  return SOAP_OK;}