/* c/zx-dec.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. */

/** dec-templ.c  -  XML decoder 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: dec-templ.c,v 1.30 2008-10-04 23:42:14 sampo Exp $
 **
 ** 28.5.2006, created, Sampo Kellomaki (sampo@iki.fi)
 ** 8.8.2006,  reworked namespace handling --Sampo
 ** 12.8.2006, added special scanning of xmlns to avoid backtracking elem recognition --Sampo
 ** 23.9.2006, added collection of WO information --Sampo
 ** 21.6.2007, improved handling of undeclared namespace prefixes --Sampo
 ** 27.10.2010, CSE refactoring, re-engineered namespace handling --Sampo
 ** 21.11.2010, re-engineered to extract most code to zx_DEC_elem, leaving just switches --Sampo
 **
 ** N.B: This template is meant to be processed by pd/xsd2sg.pl. Beware
 ** of special markers that xsd2sg.pl expects to find and understand.
 **/

#include "errmac.h"
#include "zx.h"
#include "c/zx-const.h"
#include "c/zx-data.h"
#define TPF zx_
#include "zx_ext_pt.h"



int zx_DEC_ATTR_root(struct zx_ctx* c, struct zx_root_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_root(struct zx_ctx* c, struct zx_root_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa_Assertion_ELEM:
    if (!x->Assertion)
      x->Assertion = (struct zx_sa_Assertion_s*)el;
    return 1;
  case zx_sa_EncryptedAssertion_ELEM:
    if (!x->EncryptedAssertion)
      x->EncryptedAssertion = (struct zx_sa_EncryptedAssertion_s*)el;
    return 1;
  case zx_sa_NameID_ELEM:
    if (!x->NameID)
      x->NameID = (struct zx_sa_NameID_s*)el;
    return 1;
  case zx_sa_EncryptedID_ELEM:
    if (!x->EncryptedID)
      x->EncryptedID = (struct zx_sa_EncryptedID_s*)el;
    return 1;
  case zx_sp_NewID_ELEM:
    if (!x->NewID)
      x->NewID = el;
    return 1;
  case zx_sp_AuthnRequest_ELEM:
    if (!x->AuthnRequest)
      x->AuthnRequest = (struct zx_sp_AuthnRequest_s*)el;
    return 1;
  case zx_sp_Response_ELEM:
    if (!x->Response)
      x->Response = (struct zx_sp_Response_s*)el;
    return 1;
  case zx_sp_LogoutRequest_ELEM:
    if (!x->LogoutRequest)
      x->LogoutRequest = (struct zx_sp_LogoutRequest_s*)el;
    return 1;
  case zx_sp_LogoutResponse_ELEM:
    if (!x->LogoutResponse)
      x->LogoutResponse = (struct zx_sp_LogoutResponse_s*)el;
    return 1;
  case zx_sp_ManageNameIDRequest_ELEM:
    if (!x->ManageNameIDRequest)
      x->ManageNameIDRequest = (struct zx_sp_ManageNameIDRequest_s*)el;
    return 1;
  case zx_sp_ManageNameIDResponse_ELEM:
    if (!x->ManageNameIDResponse)
      x->ManageNameIDResponse = (struct zx_sp_ManageNameIDResponse_s*)el;
    return 1;
  case zx_e_Envelope_ELEM:
    if (!x->Envelope)
      x->Envelope = (struct zx_e_Envelope_s*)el;
    return 1;
  case zx_e_Header_ELEM:
    if (!x->Header)
      x->Header = (struct zx_e_Header_s*)el;
    return 1;
  case zx_e_Body_ELEM:
    if (!x->Body)
      x->Body = (struct zx_e_Body_s*)el;
    return 1;
  case zx_md_EntityDescriptor_ELEM:
    if (!x->EntityDescriptor)
      x->EntityDescriptor = (struct zx_md_EntityDescriptor_s*)el;
    return 1;
  case zx_md_EntitiesDescriptor_ELEM:
    if (!x->EntitiesDescriptor)
      x->EntitiesDescriptor = (struct zx_md_EntitiesDescriptor_s*)el;
    return 1;
  case zx_xasp_XACMLAuthzDecisionQuery_ELEM:
    if (!x->XACMLAuthzDecisionQuery)
      x->XACMLAuthzDecisionQuery = (struct zx_xasp_XACMLAuthzDecisionQuery_s*)el;
    return 1;
  case zx_xasp_XACMLPolicyQuery_ELEM:
    if (!x->XACMLPolicyQuery)
      x->XACMLPolicyQuery = (struct zx_xasp_XACMLPolicyQuery_s*)el;
    return 1;
  case zx_xaspcd1_XACMLAuthzDecisionQuery_ELEM:
    if (!x->xaspcd1_XACMLAuthzDecisionQuery)
      x->xaspcd1_XACMLAuthzDecisionQuery = (struct zx_xaspcd1_XACMLAuthzDecisionQuery_s*)el;
    return 1;
  case zx_xaspcd1_XACMLPolicyQuery_ELEM:
    if (!x->xaspcd1_XACMLPolicyQuery)
      x->xaspcd1_XACMLPolicyQuery = (struct zx_xaspcd1_XACMLPolicyQuery_s*)el;
    return 1;
  case zx_a_EndpointReference_ELEM:
    if (!x->EndpointReference)
      x->EndpointReference = (struct zx_a_EndpointReference_s*)el;
    return 1;
  case zx_sec_Token_ELEM:
    if (!x->Token)
      x->Token = (struct zx_sec_Token_s*)el;
    return 1;
  case zx_hrxml_Candidate_ELEM:
    if (!x->Candidate)
      x->Candidate = (struct zx_hrxml_Candidate_s*)el;
    return 1;
  case zx_sa11_Assertion_ELEM:
    if (!x->sa11_Assertion)
      x->sa11_Assertion = (struct zx_sa11_Assertion_s*)el;
    return 1;
  case zx_sp11_Request_ELEM:
    if (!x->Request)
      x->Request = (struct zx_sp11_Request_s*)el;
    return 1;
  case zx_sp11_Response_ELEM:
    if (!x->sp11_Response)
      x->sp11_Response = (struct zx_sp11_Response_s*)el;
    return 1;
  case zx_ff12_Assertion_ELEM:
    if (!x->ff12_Assertion)
      x->ff12_Assertion = (struct zx_ff12_Assertion_s*)el;
    return 1;
  case zx_ff12_AuthnRequest_ELEM:
    if (!x->ff12_AuthnRequest)
      x->ff12_AuthnRequest = (struct zx_ff12_AuthnRequest_s*)el;
    return 1;
  case zx_ff12_AuthnResponse_ELEM:
    if (!x->AuthnResponse)
      x->AuthnResponse = (struct zx_ff12_AuthnResponse_s*)el;
    return 1;
  case zx_ff12_AuthnRequestEnvelope_ELEM:
    if (!x->AuthnRequestEnvelope)
      x->AuthnRequestEnvelope = (struct zx_ff12_AuthnRequestEnvelope_s*)el;
    return 1;
  case zx_ff12_AuthnResponseEnvelope_ELEM:
    if (!x->AuthnResponseEnvelope)
      x->AuthnResponseEnvelope = (struct zx_ff12_AuthnResponseEnvelope_s*)el;
    return 1;
  case zx_ff12_RegisterNameIdentifierRequest_ELEM:
    if (!x->RegisterNameIdentifierRequest)
      x->RegisterNameIdentifierRequest = (struct zx_ff12_RegisterNameIdentifierRequest_s*)el;
    return 1;
  case zx_ff12_RegisterNameIdentifierResponse_ELEM:
    if (!x->RegisterNameIdentifierResponse)
      x->RegisterNameIdentifierResponse = (struct zx_ff12_RegisterNameIdentifierResponse_s*)el;
    return 1;
  case zx_ff12_FederationTerminationNotification_ELEM:
    if (!x->FederationTerminationNotification)
      x->FederationTerminationNotification = (struct zx_ff12_FederationTerminationNotification_s*)el;
    return 1;
  case zx_ff12_LogoutRequest_ELEM:
    if (!x->ff12_LogoutRequest)
      x->ff12_LogoutRequest = (struct zx_ff12_LogoutRequest_s*)el;
    return 1;
  case zx_ff12_LogoutResponse_ELEM:
    if (!x->ff12_LogoutResponse)
      x->ff12_LogoutResponse = (struct zx_ff12_LogoutResponse_s*)el;
    return 1;
  case zx_ff12_NameIdentifierMappingRequest_ELEM:
    if (!x->NameIdentifierMappingRequest)
      x->NameIdentifierMappingRequest = (struct zx_ff12_NameIdentifierMappingRequest_s*)el;
    return 1;
  case zx_ff12_NameIdentifierMappingResponse_ELEM:
    if (!x->NameIdentifierMappingResponse)
      x->NameIdentifierMappingResponse = (struct zx_ff12_NameIdentifierMappingResponse_s*)el;
    return 1;
  case zx_m20_EntityDescriptor_ELEM:
    if (!x->m20_EntityDescriptor)
      x->m20_EntityDescriptor = (struct zx_m20_EntityDescriptor_s*)el;
    return 1;
  case zx_m20_EntitiesDescriptor_ELEM:
    if (!x->m20_EntitiesDescriptor)
      x->m20_EntitiesDescriptor = (struct zx_m20_EntitiesDescriptor_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_simple_elem(struct zx_ctx* c, struct zx_elem_s* x)
{
  switch (x->attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_simple_elem(struct zx_ctx* c, struct zx_elem_s* x)
{
  struct zx_elem_s* el = x->kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




int zx_DEC_ATTR_wrong_elem(struct zx_ctx* c, struct zx_elem_s* x)
{
  switch (x->attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_wrong_elem(struct zx_ctx* c, struct zx_elem_s* x)
{
  struct zx_elem_s* el = x->kids;
  switch (el->g.tok) {

  default: return 0;
  }
}


/* EOF -- c/zx-dec.c */
