/* c/zx-m20-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"
#include "c/zx-m20-data.h"
#define TPF zx_
#include "zx_ext_pt.h"



int zx_DEC_ATTR_m20_AdditionalMetaLocation(struct zx_ctx* c, struct zx_m20_AdditionalMetaLocation_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_namespace_ATTR:  x->namespace_is_cxx_keyword = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_AffiliationDescriptor(struct zx_ctx* c, struct zx_m20_AffiliationDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_affiliationOwnerID_ATTR:  x->affiliationOwnerID = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_validUntil_ATTR:  x->validUntil = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_AffiliationDescriptor(struct zx_ctx* c, struct zx_m20_AffiliationDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_AffiliateMember_ELEM:
    if (!x->AffiliateMember)
      x->AffiliateMember = el;
    return 1;
  case zx_m20_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_m20_Extension_s*)el;
    return 1;
  case zx_m20_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_m20_KeyDescriptor_s*)el;
    return 1;
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_AssertionConsumerServiceURL(struct zx_ctx* c, struct zx_m20_AssertionConsumerServiceURL_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_ContactPerson(struct zx_ctx* c, struct zx_m20_ContactPerson_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_contactType_ATTR:  x->contactType = x->gg.attr; return 1;
    case zx_libertyPrincipalIdentifier_ATTR:  x->libertyPrincipalIdentifier = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_ContactPerson(struct zx_ctx* c, struct zx_m20_ContactPerson_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_Company_ELEM:
    if (!x->Company)
      x->Company = el;
    return 1;
  case zx_m20_GivenName_ELEM:
    if (!x->GivenName)
      x->GivenName = el;
    return 1;
  case zx_m20_SurName_ELEM:
    if (!x->SurName)
      x->SurName = el;
    return 1;
  case zx_m20_EmailAddress_ELEM:
    if (!x->EmailAddress)
      x->EmailAddress = el;
    return 1;
  case zx_m20_TelephoneNumber_ELEM:
    if (!x->TelephoneNumber)
      x->TelephoneNumber = el;
    return 1;
  case zx_m20_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_m20_Extension_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_EntitiesDescriptor(struct zx_ctx* c, struct zx_m20_EntitiesDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_EntityDescriptor_ELEM:
    if (!x->EntityDescriptor)
      x->EntityDescriptor = (struct zx_m20_EntityDescriptor_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_EntityDescriptor(struct zx_ctx* c, struct zx_m20_EntityDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_providerID_ATTR:  x->providerID = x->gg.attr; return 1;
    case zx_validUntil_ATTR:  x->validUntil = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_EntityDescriptor(struct zx_ctx* c, struct zx_m20_EntityDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_IDPDescriptor_ELEM:
    if (!x->IDPDescriptor)
      x->IDPDescriptor = (struct zx_m20_IDPDescriptor_s*)el;
    return 1;
  case zx_m20_SPDescriptor_ELEM:
    if (!x->SPDescriptor)
      x->SPDescriptor = (struct zx_m20_SPDescriptor_s*)el;
    return 1;
  case zx_m20_AffiliationDescriptor_ELEM:
    if (!x->AffiliationDescriptor)
      x->AffiliationDescriptor = (struct zx_m20_AffiliationDescriptor_s*)el;
    return 1;
  case zx_m20_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_m20_ContactPerson_s*)el;
    return 1;
  case zx_m20_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_m20_Organization_s*)el;
    return 1;
  case zx_m20_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_m20_Extension_s*)el;
    return 1;
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_IDPDescriptor(struct zx_ctx* c, struct zx_m20_IDPDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_protocolSupportEnumeration_ATTR:  x->protocolSupportEnumeration = x->gg.attr; return 1;
    case zx_validUntil_ATTR:  x->validUntil = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_IDPDescriptor(struct zx_ctx* c, struct zx_m20_IDPDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_m20_KeyDescriptor_s*)el;
    return 1;
  case zx_m20_SoapEndpoint_ELEM:
    if (!x->SoapEndpoint)
      x->SoapEndpoint = el;
    return 1;
  case zx_m20_SingleLogoutServiceURL_ELEM:
    if (!x->SingleLogoutServiceURL)
      x->SingleLogoutServiceURL = el;
    return 1;
  case zx_m20_SingleLogoutServiceReturnURL_ELEM:
    if (!x->SingleLogoutServiceReturnURL)
      x->SingleLogoutServiceReturnURL = el;
    return 1;
  case zx_m20_FederationTerminationServiceURL_ELEM:
    if (!x->FederationTerminationServiceURL)
      x->FederationTerminationServiceURL = el;
    return 1;
  case zx_m20_FederationTerminationServiceReturnURL_ELEM:
    if (!x->FederationTerminationServiceReturnURL)
      x->FederationTerminationServiceReturnURL = el;
    return 1;
  case zx_m20_FederationTerminationNotificationProtocolProfile_ELEM:
    if (!x->FederationTerminationNotificationProtocolProfile)
      x->FederationTerminationNotificationProtocolProfile = el;
    return 1;
  case zx_m20_SingleLogoutProtocolProfile_ELEM:
    if (!x->SingleLogoutProtocolProfile)
      x->SingleLogoutProtocolProfile = el;
    return 1;
  case zx_m20_RegisterNameIdentifierProtocolProfile_ELEM:
    if (!x->RegisterNameIdentifierProtocolProfile)
      x->RegisterNameIdentifierProtocolProfile = el;
    return 1;
  case zx_m20_RegisterNameIdentifierServiceURL_ELEM:
    if (!x->RegisterNameIdentifierServiceURL)
      x->RegisterNameIdentifierServiceURL = el;
    return 1;
  case zx_m20_RegisterNameIdentifierServiceReturnURL_ELEM:
    if (!x->RegisterNameIdentifierServiceReturnURL)
      x->RegisterNameIdentifierServiceReturnURL = el;
    return 1;
  case zx_m20_NameIdentifierMappingProtocolProfile_ELEM:
    if (!x->NameIdentifierMappingProtocolProfile)
      x->NameIdentifierMappingProtocolProfile = el;
    return 1;
  case zx_m20_NameIdentifierMappingEncryptionProfile_ELEM:
    if (!x->NameIdentifierMappingEncryptionProfile)
      x->NameIdentifierMappingEncryptionProfile = el;
    return 1;
  case zx_m20_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_m20_Organization_s*)el;
    return 1;
  case zx_m20_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_m20_ContactPerson_s*)el;
    return 1;
  case zx_m20_AdditionalMetaLocation_ELEM:
    if (!x->AdditionalMetaLocation)
      x->AdditionalMetaLocation = (struct zx_m20_AdditionalMetaLocation_s*)el;
    return 1;
  case zx_m20_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_m20_Extension_s*)el;
    return 1;
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_m20_SingleSignOnServiceURL_ELEM:
    if (!x->SingleSignOnServiceURL)
      x->SingleSignOnServiceURL = el;
    return 1;
  case zx_m20_SingleSignOnProtocolProfile_ELEM:
    if (!x->SingleSignOnProtocolProfile)
      x->SingleSignOnProtocolProfile = el;
    return 1;
  case zx_m20_AuthnServiceURL_ELEM:
    if (!x->AuthnServiceURL)
      x->AuthnServiceURL = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_KeyDescriptor(struct zx_ctx* c, struct zx_m20_KeyDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_use_ATTR:  x->use = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_KeyDescriptor(struct zx_ctx* c, struct zx_m20_KeyDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_EncryptionMethod_ELEM:
    if (!x->EncryptionMethod)
      x->EncryptionMethod = el;
    return 1;
  case zx_m20_KeySize_ELEM:
    if (!x->KeySize)
      x->KeySize = el;
    return 1;
  case zx_ds_KeyInfo_ELEM:
    if (!x->KeyInfo)
      x->KeyInfo = (struct zx_ds_KeyInfo_s*)el;
    return 1;
  case zx_m20_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_m20_Extension_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_Organization(struct zx_ctx* c, struct zx_m20_Organization_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_OrganizationName_ELEM:
    if (!x->OrganizationName)
      x->OrganizationName = (struct zx_m20_OrganizationName_s*)el;
    return 1;
  case zx_m20_OrganizationDisplayName_ELEM:
    if (!x->OrganizationDisplayName)
      x->OrganizationDisplayName = (struct zx_m20_OrganizationDisplayName_s*)el;
    return 1;
  case zx_m20_OrganizationURL_ELEM:
    if (!x->OrganizationURL)
      x->OrganizationURL = (struct zx_m20_OrganizationURL_s*)el;
    return 1;
  case zx_m20_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_m20_Extension_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_OrganizationDisplayName(struct zx_ctx* c, struct zx_m20_OrganizationDisplayName_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_lang_ATTR:  x->lang = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_OrganizationName(struct zx_ctx* c, struct zx_m20_OrganizationName_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_lang_ATTR:  x->lang = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_OrganizationURL(struct zx_ctx* c, struct zx_m20_OrganizationURL_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_lang_ATTR:  x->lang = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_m20_SPDescriptor(struct zx_ctx* c, struct zx_m20_SPDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_protocolSupportEnumeration_ATTR:  x->protocolSupportEnumeration = x->gg.attr; return 1;
    case zx_validUntil_ATTR:  x->validUntil = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_m20_SPDescriptor(struct zx_ctx* c, struct zx_m20_SPDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_m20_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_m20_KeyDescriptor_s*)el;
    return 1;
  case zx_m20_SoapEndpoint_ELEM:
    if (!x->SoapEndpoint)
      x->SoapEndpoint = el;
    return 1;
  case zx_m20_SingleLogoutServiceURL_ELEM:
    if (!x->SingleLogoutServiceURL)
      x->SingleLogoutServiceURL = el;
    return 1;
  case zx_m20_SingleLogoutServiceReturnURL_ELEM:
    if (!x->SingleLogoutServiceReturnURL)
      x->SingleLogoutServiceReturnURL = el;
    return 1;
  case zx_m20_FederationTerminationServiceURL_ELEM:
    if (!x->FederationTerminationServiceURL)
      x->FederationTerminationServiceURL = el;
    return 1;
  case zx_m20_FederationTerminationServiceReturnURL_ELEM:
    if (!x->FederationTerminationServiceReturnURL)
      x->FederationTerminationServiceReturnURL = el;
    return 1;
  case zx_m20_FederationTerminationNotificationProtocolProfile_ELEM:
    if (!x->FederationTerminationNotificationProtocolProfile)
      x->FederationTerminationNotificationProtocolProfile = el;
    return 1;
  case zx_m20_SingleLogoutProtocolProfile_ELEM:
    if (!x->SingleLogoutProtocolProfile)
      x->SingleLogoutProtocolProfile = el;
    return 1;
  case zx_m20_RegisterNameIdentifierProtocolProfile_ELEM:
    if (!x->RegisterNameIdentifierProtocolProfile)
      x->RegisterNameIdentifierProtocolProfile = el;
    return 1;
  case zx_m20_RegisterNameIdentifierServiceURL_ELEM:
    if (!x->RegisterNameIdentifierServiceURL)
      x->RegisterNameIdentifierServiceURL = el;
    return 1;
  case zx_m20_RegisterNameIdentifierServiceReturnURL_ELEM:
    if (!x->RegisterNameIdentifierServiceReturnURL)
      x->RegisterNameIdentifierServiceReturnURL = el;
    return 1;
  case zx_m20_NameIdentifierMappingProtocolProfile_ELEM:
    if (!x->NameIdentifierMappingProtocolProfile)
      x->NameIdentifierMappingProtocolProfile = el;
    return 1;
  case zx_m20_NameIdentifierMappingEncryptionProfile_ELEM:
    if (!x->NameIdentifierMappingEncryptionProfile)
      x->NameIdentifierMappingEncryptionProfile = el;
    return 1;
  case zx_m20_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_m20_Organization_s*)el;
    return 1;
  case zx_m20_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_m20_ContactPerson_s*)el;
    return 1;
  case zx_m20_AdditionalMetaLocation_ELEM:
    if (!x->AdditionalMetaLocation)
      x->AdditionalMetaLocation = (struct zx_m20_AdditionalMetaLocation_s*)el;
    return 1;
  case zx_m20_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_m20_Extension_s*)el;
    return 1;
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_m20_AssertionConsumerServiceURL_ELEM:
    if (!x->AssertionConsumerServiceURL)
      x->AssertionConsumerServiceURL = (struct zx_m20_AssertionConsumerServiceURL_s*)el;
    return 1;
  case zx_m20_AuthnRequestsSigned_ELEM:
    if (!x->AuthnRequestsSigned)
      x->AuthnRequestsSigned = el;
    return 1;

  default: return 0;
  }
}


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