text: /* c/zx-im-enc.c - WARNING: This file was auto generated by xsd2sg.pl. DO NOT EDIT!
   * $Id$ */
  /* Code generation design Copyright (c) 2006 Sampo Kellomaki (sampo@iki.fi),
   * All Rights Reserved. NO WARRANTY. See file COPYING for terms and conditions
   * of use. Some aspects of code generation were driven by schema
   * descriptions that were used as input and may be subject to their own copyright.
   * Code generation uses a template, whose copyright statement follows. */
  
  /** enc-templ.c  -  XML encoder template, used in code generation
   ** Copyright (c) 2010 Sampo Kellomaki (sampo@iki.fi), All Rights Reserved.
   ** Copyright (c) 2006-2007 Symlabs (symlabs@symlabs.com), All Rights Reserved.
   ** Author: Sampo Kellomaki (sampo@iki.fi)
   ** This is confidential unpublished proprietary source code of the author.
   ** NO WARRANTY, not even implied warranties. Contains trade secrets.
   ** Distribution prohibited unless authorized in writing.
   ** Licensed under Apache License 2.0, see file COPYING.
   ** Id: enc-templ.c,v 1.27 2007-10-05 22:24:28 sampo Exp $
   **
   ** 30.5.2006, created, Sampo Kellomaki (sampo@iki.fi)
   ** 6.8.2006,  factored data structure walking to aux-templ.c --Sampo
   ** 8.8.2006,  reworked namespace handling --Sampo
   ** 26.8.2006, some CSE --Sampo
   ** 23.9.2006, added WO logic --Sampo
   ** 30.9.2007, improvements to WO encoding --Sampo
   ** 8.2.2010,  better handling of schema order encoding of unknown namespace prefixes --Sampo
   ** 27.10.2010, re-engineered namespace handling --Sampo
   ** 24.11.2010, this code is sceduled for removal as el_order processing in WO encoder accomplishes the same result. --Sampo
   **
   ** N.B: wo=wire order (needed for exc-c14n), so=schema order
   ** N.B2: This template is meant to be processed by pd/xsd2sg.pl. Beware
   ** of special markers that xsd2sg.pl expects to find and understand.
   **/
  
  #include <memory.h>
  #include "errmac.h"
  #include "zx.h"
  #include "c/zx-const.h"
  #include "c/zx-data.h"
  #include "c/zx-im-data.h"
  #include "c/zx-ns.h"
  
  
  
  #if 0
  
  #ifdef EL_NAME
  #undef EL_NAME
  #endif
  #ifdef EL_STRUCT
  #undef EL_STRUCT
  #endif
  #ifdef EL_NS
  #undef EL_NS
  #endif
  #ifdef EL_TAG
  #undef EL_TAG
  #endif
  
  #define EL_NAME   im_IdentityMappingRequest
  #define EL_STRUCT zx_im_IdentityMappingRequest_s
  #define EL_NS     im
  #define EL_TAG    IdentityMappingRequest
  
  #ifndef MAYBE_UNUSED
  #define MAYBE_UNUSED   /* May appear as unused variable, but is needed by some generated code. */
  #endif
  
  #if 0
  #define ENC_LEN_DEBUG(x,tag,len) D("x=%p tag(%s) len=%d",(x),(tag),(len))
  #define ENC_LEN_DEBUG_BASE char* enc_base = p
  #else
  #define ENC_LEN_DEBUG(x,tag,len)
  #define ENC_LEN_DEBUG_BASE
  #endif
  
  /* FUNC(zx_LEN_SO_im_IdentityMappingRequest) */
  
  /* Compute length of an element (and its subelements). The XML attributes
   * and elements are processed in schema order. */
  
  /* Called by: */
  int zx_LEN_SO_im_IdentityMappingRequest(struct zx_ctx* c, struct zx_im_IdentityMappingRequest_s* x )
  {
    struct zx_ns_s* pop_seen = 0;
    struct zx_elem_s* se MAYBE_UNUSED;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    int len = sizeof("<im:IdentityMappingRequest")-1 + 1 + sizeof("</im:IdentityMappingRequest>")-1;
    if (c->inc_ns_len)
      len += zx_len_inc_ns(c, &pop_seen);
    if (1)
      len += zx_len_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
  
  #else
    /* root node has no begin tag */
    int len = 0;
  #endif
    
    for (se = &x->MappingInput->gg;
         se && se->g.tok == zx_im_MappingInput_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      len += zx_LEN_SO_im_MappingInput(c, (struct zx_im_MappingInput_s*)se);
  
  
    len += zx_len_so_common(c, &x->gg, &pop_seen);
    zx_pop_seen(pop_seen);
    ENC_LEN_DEBUG(x, "im:IdentityMappingRequest", len);
    return len;
  }
  
  /* FUNC(zx_ENC_SO_im_IdentityMappingRequest) */
  
  /* Render element into string. The XML attributes and elements are
   * processed in schema order. This is what you generally want for
   * rendering new data structure to a string. The wo pointers are not used. */
  
  /* Called by: */
  char* zx_ENC_SO_im_IdentityMappingRequest(struct zx_ctx* c, struct zx_im_IdentityMappingRequest_s* x, char* p )
  {
    struct zx_elem_s* se MAYBE_UNUSED;
    struct zx_attr_s* attr MAYBE_UNUSED;
    struct zx_ns_s* pop_seen = 0;
    ENC_LEN_DEBUG_BASE;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    ZX_OUT_TAG(p, "<im:IdentityMappingRequest");
    if (c->inc_ns)
      zx_add_inc_ns(c, &pop_seen);
    if (1)
      zx_add_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
    zx_see_attr_ns(c, x->gg.attr, &pop_seen);
    p = zx_enc_seen(p, pop_seen); 
  
    for (attr = x->gg.attr; attr; attr = (struct zx_attr_s*)attr->g.n)
      if (attr->g.tok == ZX_TOK_ATTR_NOT_FOUND)
        p = zx_attr_wo_enc(p, attr);
    ZX_OUT_CH(p, '>');
  #else
    /* root node has no begin tag */
  #endif
    
    for (se = &x->MappingInput->gg;
         se && se->g.tok == zx_im_MappingInput_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      p = zx_ENC_SO_im_MappingInput(c, (struct zx_im_MappingInput_s*)se, p);
  
    p = zx_enc_so_unknown_elems_and_content(c, p, &x->gg);
    
  #if 1 /* NORMALMODE */
    ZX_OUT_CLOSE_TAG(p, "</im:IdentityMappingRequest>");
    zx_pop_seen(pop_seen);
  #else
    /* root node has no end tag either */
  #endif
    ENC_LEN_DEBUG(x, "im:IdentityMappingRequest", p-enc_base);
    return p;
  }
  
  /* FUNC(zx_EASY_ENC_SO_im_IdentityMappingRequest) */
  
  /* Called by: */
  struct zx_str* zx_EASY_ENC_SO_im_IdentityMappingRequest(struct zx_ctx* c, struct zx_im_IdentityMappingRequest_s* x )
  {
    int len;
    char* buf;
    c->ns_tab = ZX_ALLOC(c, sizeof(zx_ns_tab));      /* *** do we really need to make a copy? Do we still keep list of aliases? */
    memcpy(c->ns_tab, zx_ns_tab, sizeof(zx_ns_tab));
    len = zx_LEN_SO_im_IdentityMappingRequest(c, x );
    buf = ZX_ALLOC(c, len+1);
    return zx_easy_enc_common(c, zx_ENC_SO_im_IdentityMappingRequest(c, x, buf ), buf, len);
  }
  #endif
  
  
  
  
  #if 0
  
  #ifdef EL_NAME
  #undef EL_NAME
  #endif
  #ifdef EL_STRUCT
  #undef EL_STRUCT
  #endif
  #ifdef EL_NS
  #undef EL_NS
  #endif
  #ifdef EL_TAG
  #undef EL_TAG
  #endif
  
  #define EL_NAME   im_IdentityMappingResponse
  #define EL_STRUCT zx_im_IdentityMappingResponse_s
  #define EL_NS     im
  #define EL_TAG    IdentityMappingResponse
  
  #ifndef MAYBE_UNUSED
  #define MAYBE_UNUSED   /* May appear as unused variable, but is needed by some generated code. */
  #endif
  
  #if 0
  #define ENC_LEN_DEBUG(x,tag,len) D("x=%p tag(%s) len=%d",(x),(tag),(len))
  #define ENC_LEN_DEBUG_BASE char* enc_base = p
  #else
  #define ENC_LEN_DEBUG(x,tag,len)
  #define ENC_LEN_DEBUG_BASE
  #endif
  
  /* FUNC(zx_LEN_SO_im_IdentityMappingResponse) */
  
  /* Compute length of an element (and its subelements). The XML attributes
   * and elements are processed in schema order. */
  
  /* Called by: */
  int zx_LEN_SO_im_IdentityMappingResponse(struct zx_ctx* c, struct zx_im_IdentityMappingResponse_s* x )
  {
    struct zx_ns_s* pop_seen = 0;
    struct zx_elem_s* se MAYBE_UNUSED;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    int len = sizeof("<im:IdentityMappingResponse")-1 + 1 + sizeof("</im:IdentityMappingResponse>")-1;
    if (c->inc_ns_len)
      len += zx_len_inc_ns(c, &pop_seen);
    if (1)
      len += zx_len_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
  
  #else
    /* root node has no begin tag */
    int len = 0;
  #endif
    
    for (se = &x->Status->gg;
         se && se->g.tok == zx_lu_Status_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      len += zx_LEN_SO_lu_Status(c, (struct zx_lu_Status_s*)se);
    for (se = &x->MappingOutput->gg;
         se && se->g.tok == zx_im_MappingOutput_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      len += zx_LEN_SO_im_MappingOutput(c, (struct zx_im_MappingOutput_s*)se);
  
  
    len += zx_len_so_common(c, &x->gg, &pop_seen);
    zx_pop_seen(pop_seen);
    ENC_LEN_DEBUG(x, "im:IdentityMappingResponse", len);
    return len;
  }
  
  /* FUNC(zx_ENC_SO_im_IdentityMappingResponse) */
  
  /* Render element into string. The XML attributes and elements are
   * processed in schema order. This is what you generally want for
   * rendering new data structure to a string. The wo pointers are not used. */
  
  /* Called by: */
  char* zx_ENC_SO_im_IdentityMappingResponse(struct zx_ctx* c, struct zx_im_IdentityMappingResponse_s* x, char* p )
  {
    struct zx_elem_s* se MAYBE_UNUSED;
    struct zx_attr_s* attr MAYBE_UNUSED;
    struct zx_ns_s* pop_seen = 0;
    ENC_LEN_DEBUG_BASE;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    ZX_OUT_TAG(p, "<im:IdentityMappingResponse");
    if (c->inc_ns)
      zx_add_inc_ns(c, &pop_seen);
    if (1)
      zx_add_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
    zx_see_attr_ns(c, x->gg.attr, &pop_seen);
    p = zx_enc_seen(p, pop_seen); 
  
    for (attr = x->gg.attr; attr; attr = (struct zx_attr_s*)attr->g.n)
      if (attr->g.tok == ZX_TOK_ATTR_NOT_FOUND)
        p = zx_attr_wo_enc(p, attr);
    ZX_OUT_CH(p, '>');
  #else
    /* root node has no begin tag */
  #endif
    
    for (se = &x->Status->gg;
         se && se->g.tok == zx_lu_Status_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      p = zx_ENC_SO_lu_Status(c, (struct zx_lu_Status_s*)se, p);
    for (se = &x->MappingOutput->gg;
         se && se->g.tok == zx_im_MappingOutput_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      p = zx_ENC_SO_im_MappingOutput(c, (struct zx_im_MappingOutput_s*)se, p);
  
    p = zx_enc_so_unknown_elems_and_content(c, p, &x->gg);
    
  #if 1 /* NORMALMODE */
    ZX_OUT_CLOSE_TAG(p, "</im:IdentityMappingResponse>");
    zx_pop_seen(pop_seen);
  #else
    /* root node has no end tag either */
  #endif
    ENC_LEN_DEBUG(x, "im:IdentityMappingResponse", p-enc_base);
    return p;
  }
  
  /* FUNC(zx_EASY_ENC_SO_im_IdentityMappingResponse) */
  
  /* Called by: */
  struct zx_str* zx_EASY_ENC_SO_im_IdentityMappingResponse(struct zx_ctx* c, struct zx_im_IdentityMappingResponse_s* x )
  {
    int len;
    char* buf;
    c->ns_tab = ZX_ALLOC(c, sizeof(zx_ns_tab));      /* *** do we really need to make a copy? Do we still keep list of aliases? */
    memcpy(c->ns_tab, zx_ns_tab, sizeof(zx_ns_tab));
    len = zx_LEN_SO_im_IdentityMappingResponse(c, x );
    buf = ZX_ALLOC(c, len+1);
    return zx_easy_enc_common(c, zx_ENC_SO_im_IdentityMappingResponse(c, x, buf ), buf, len);
  }
  #endif
  
  
  
  
  #if 0
  
  #ifdef EL_NAME
  #undef EL_NAME
  #endif
  #ifdef EL_STRUCT
  #undef EL_STRUCT
  #endif
  #ifdef EL_NS
  #undef EL_NS
  #endif
  #ifdef EL_TAG
  #undef EL_TAG
  #endif
  
  #define EL_NAME   im_MappingInput
  #define EL_STRUCT zx_im_MappingInput_s
  #define EL_NS     im
  #define EL_TAG    MappingInput
  
  #ifndef MAYBE_UNUSED
  #define MAYBE_UNUSED   /* May appear as unused variable, but is needed by some generated code. */
  #endif
  
  #if 0
  #define ENC_LEN_DEBUG(x,tag,len) D("x=%p tag(%s) len=%d",(x),(tag),(len))
  #define ENC_LEN_DEBUG_BASE char* enc_base = p
  #else
  #define ENC_LEN_DEBUG(x,tag,len)
  #define ENC_LEN_DEBUG_BASE
  #endif
  
  /* FUNC(zx_LEN_SO_im_MappingInput) */
  
  /* Compute length of an element (and its subelements). The XML attributes
   * and elements are processed in schema order. */
  
  /* Called by: */
  int zx_LEN_SO_im_MappingInput(struct zx_ctx* c, struct zx_im_MappingInput_s* x )
  {
    struct zx_ns_s* pop_seen = 0;
    struct zx_elem_s* se MAYBE_UNUSED;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    int len = sizeof("<im:MappingInput")-1 + 1 + sizeof("</im:MappingInput>")-1;
    if (c->inc_ns_len)
      len += zx_len_inc_ns(c, &pop_seen);
    if (1)
      len += zx_len_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
    len += zx_attr_so_len(c, x->reqID, sizeof("reqID")-1, &pop_seen);
  
  #else
    /* root node has no begin tag */
    int len = 0;
  #endif
    
    for (se = &x->TokenPolicy->gg;
         se && se->g.tok == zx_sec_TokenPolicy_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      len += zx_LEN_SO_sec_TokenPolicy(c, (struct zx_sec_TokenPolicy_s*)se);
    for (se = &x->Token->gg;
         se && se->g.tok == zx_sec_Token_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      len += zx_LEN_SO_sec_Token(c, (struct zx_sec_Token_s*)se);
  
  
    len += zx_len_so_common(c, &x->gg, &pop_seen);
    zx_pop_seen(pop_seen);
    ENC_LEN_DEBUG(x, "im:MappingInput", len);
    return len;
  }
  
  /* FUNC(zx_ENC_SO_im_MappingInput) */
  
  /* Render element into string. The XML attributes and elements are
   * processed in schema order. This is what you generally want for
   * rendering new data structure to a string. The wo pointers are not used. */
  
  /* Called by: */
  char* zx_ENC_SO_im_MappingInput(struct zx_ctx* c, struct zx_im_MappingInput_s* x, char* p )
  {
    struct zx_elem_s* se MAYBE_UNUSED;
    struct zx_attr_s* attr MAYBE_UNUSED;
    struct zx_ns_s* pop_seen = 0;
    ENC_LEN_DEBUG_BASE;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    ZX_OUT_TAG(p, "<im:MappingInput");
    if (c->inc_ns)
      zx_add_inc_ns(c, &pop_seen);
    if (1)
      zx_add_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
    zx_see_attr_ns(c, x->gg.attr, &pop_seen);
    p = zx_enc_seen(p, pop_seen); 
    p = zx_attr_so_enc(p, x->reqID, " reqID=\"", sizeof(" reqID=\"")-1);
  
    for (attr = x->gg.attr; attr; attr = (struct zx_attr_s*)attr->g.n)
      if (attr->g.tok == ZX_TOK_ATTR_NOT_FOUND)
        p = zx_attr_wo_enc(p, attr);
    ZX_OUT_CH(p, '>');
  #else
    /* root node has no begin tag */
  #endif
    
    for (se = &x->TokenPolicy->gg;
         se && se->g.tok == zx_sec_TokenPolicy_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      p = zx_ENC_SO_sec_TokenPolicy(c, (struct zx_sec_TokenPolicy_s*)se, p);
    for (se = &x->Token->gg;
         se && se->g.tok == zx_sec_Token_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      p = zx_ENC_SO_sec_Token(c, (struct zx_sec_Token_s*)se, p);
  
    p = zx_enc_so_unknown_elems_and_content(c, p, &x->gg);
    
  #if 1 /* NORMALMODE */
    ZX_OUT_CLOSE_TAG(p, "</im:MappingInput>");
    zx_pop_seen(pop_seen);
  #else
    /* root node has no end tag either */
  #endif
    ENC_LEN_DEBUG(x, "im:MappingInput", p-enc_base);
    return p;
  }
  
  /* FUNC(zx_EASY_ENC_SO_im_MappingInput) */
  
  /* Called by: */
  struct zx_str* zx_EASY_ENC_SO_im_MappingInput(struct zx_ctx* c, struct zx_im_MappingInput_s* x )
  {
    int len;
    char* buf;
    c->ns_tab = ZX_ALLOC(c, sizeof(zx_ns_tab));      /* *** do we really need to make a copy? Do we still keep list of aliases? */
    memcpy(c->ns_tab, zx_ns_tab, sizeof(zx_ns_tab));
    len = zx_LEN_SO_im_MappingInput(c, x );
    buf = ZX_ALLOC(c, len+1);
    return zx_easy_enc_common(c, zx_ENC_SO_im_MappingInput(c, x, buf ), buf, len);
  }
  #endif
  
  
  
  
  #if 0
  
  #ifdef EL_NAME
  #undef EL_NAME
  #endif
  #ifdef EL_STRUCT
  #undef EL_STRUCT
  #endif
  #ifdef EL_NS
  #undef EL_NS
  #endif
  #ifdef EL_TAG
  #undef EL_TAG
  #endif
  
  #define EL_NAME   im_MappingOutput
  #define EL_STRUCT zx_im_MappingOutput_s
  #define EL_NS     im
  #define EL_TAG    MappingOutput
  
  #ifndef MAYBE_UNUSED
  #define MAYBE_UNUSED   /* May appear as unused variable, but is needed by some generated code. */
  #endif
  
  #if 0
  #define ENC_LEN_DEBUG(x,tag,len) D("x=%p tag(%s) len=%d",(x),(tag),(len))
  #define ENC_LEN_DEBUG_BASE char* enc_base = p
  #else
  #define ENC_LEN_DEBUG(x,tag,len)
  #define ENC_LEN_DEBUG_BASE
  #endif
  
  /* FUNC(zx_LEN_SO_im_MappingOutput) */
  
  /* Compute length of an element (and its subelements). The XML attributes
   * and elements are processed in schema order. */
  
  /* Called by: */
  int zx_LEN_SO_im_MappingOutput(struct zx_ctx* c, struct zx_im_MappingOutput_s* x )
  {
    struct zx_ns_s* pop_seen = 0;
    struct zx_elem_s* se MAYBE_UNUSED;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    int len = sizeof("<im:MappingOutput")-1 + 1 + sizeof("</im:MappingOutput>")-1;
    if (c->inc_ns_len)
      len += zx_len_inc_ns(c, &pop_seen);
    if (1)
      len += zx_len_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
    len += zx_attr_so_len(c, x->reqRef, sizeof("reqRef")-1, &pop_seen);
  
  #else
    /* root node has no begin tag */
    int len = 0;
  #endif
    
    for (se = &x->Token->gg;
         se && se->g.tok == zx_sec_Token_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      len += zx_LEN_SO_sec_Token(c, (struct zx_sec_Token_s*)se);
  
  
    len += zx_len_so_common(c, &x->gg, &pop_seen);
    zx_pop_seen(pop_seen);
    ENC_LEN_DEBUG(x, "im:MappingOutput", len);
    return len;
  }
  
  /* FUNC(zx_ENC_SO_im_MappingOutput) */
  
  /* Render element into string. The XML attributes and elements are
   * processed in schema order. This is what you generally want for
   * rendering new data structure to a string. The wo pointers are not used. */
  
  /* Called by: */
  char* zx_ENC_SO_im_MappingOutput(struct zx_ctx* c, struct zx_im_MappingOutput_s* x, char* p )
  {
    struct zx_elem_s* se MAYBE_UNUSED;
    struct zx_attr_s* attr MAYBE_UNUSED;
    struct zx_ns_s* pop_seen = 0;
    ENC_LEN_DEBUG_BASE;
  #if 1 /* NORMALMODE */
    /* *** in simple_elem case should output ns prefix from ns node. */
    ZX_OUT_TAG(p, "<im:MappingOutput");
    if (c->inc_ns)
      zx_add_inc_ns(c, &pop_seen);
    if (1)
      zx_add_xmlns_if_not_seen(c, zx_ns_tab+(zx_im_NS >> ZX_TOK_NS_SHIFT), &pop_seen);
  
    zx_see_attr_ns(c, x->gg.attr, &pop_seen);
    p = zx_enc_seen(p, pop_seen); 
    p = zx_attr_so_enc(p, x->reqRef, " reqRef=\"", sizeof(" reqRef=\"")-1);
  
    for (attr = x->gg.attr; attr; attr = (struct zx_attr_s*)attr->g.n)
      if (attr->g.tok == ZX_TOK_ATTR_NOT_FOUND)
        p = zx_attr_wo_enc(p, attr);
    ZX_OUT_CH(p, '>');
  #else
    /* root node has no begin tag */
  #endif
    
    for (se = &x->Token->gg;
         se && se->g.tok == zx_sec_Token_ELEM;
         se = (struct zx_elem_s*)se->g.n)
      p = zx_ENC_SO_sec_Token(c, (struct zx_sec_Token_s*)se, p);
  
    p = zx_enc_so_unknown_elems_and_content(c, p, &x->gg);
    
  #if 1 /* NORMALMODE */
    ZX_OUT_CLOSE_TAG(p, "</im:MappingOutput>");
    zx_pop_seen(pop_seen);
  #else
    /* root node has no end tag either */
  #endif
    ENC_LEN_DEBUG(x, "im:MappingOutput", p-enc_base);
    return p;
  }
  
  /* FUNC(zx_EASY_ENC_SO_im_MappingOutput) */
  
  /* Called by: */
  struct zx_str* zx_EASY_ENC_SO_im_MappingOutput(struct zx_ctx* c, struct zx_im_MappingOutput_s* x )
  {
    int len;
    char* buf;
    c->ns_tab = ZX_ALLOC(c, sizeof(zx_ns_tab));      /* *** do we really need to make a copy? Do we still keep list of aliases? */
    memcpy(c->ns_tab, zx_ns_tab, sizeof(zx_ns_tab));
    len = zx_LEN_SO_im_MappingOutput(c, x );
    buf = ZX_ALLOC(c, len+1);
    return zx_easy_enc_common(c, zx_ENC_SO_im_MappingOutput(c, x, buf ), buf, len);
  }
  #endif
  
  
  /* EOF -- c/zx-im-enc.c */
  