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



int zx_DEC_ATTR_md_AdditionalMetadataLocation(struct zx_ctx* c, struct zx_md_AdditionalMetadataLocation_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_md_AdditionalMetadataLocation(struct zx_ctx* c, struct zx_md_AdditionalMetadataLocation_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AffiliationDescriptor(struct zx_ctx* c, struct zx_md_AffiliationDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_affiliationOwnerID_ATTR:  x->affiliationOwnerID = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_validUntil_ATTR:  x->validUntil = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_md_AffiliationDescriptor(struct zx_ctx* c, struct zx_md_AffiliationDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_AffiliateMember_ELEM:
    if (!x->AffiliateMember)
      x->AffiliateMember = el;
    return 1;
  case zx_md_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_ArtifactResolutionService(struct zx_ctx* c, struct zx_md_ArtifactResolutionService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AssertionConsumerService(struct zx_ctx* c, struct zx_md_AssertionConsumerService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AssertionIDRequestService(struct zx_ctx* c, struct zx_md_AssertionIDRequestService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AttributeAuthorityDescriptor(struct zx_ctx* c, struct zx_md_AttributeAuthorityDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_errorURL_ATTR:  x->errorURL = 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_md_AttributeAuthorityDescriptor(struct zx_ctx* c, struct zx_md_AttributeAuthorityDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el;
    return 1;
  case zx_md_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_md_Organization_s*)el;
    return 1;
  case zx_md_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_md_ContactPerson_s*)el;
    return 1;
  case zx_md_AttributeService_ELEM:
    if (!x->AttributeService)
      x->AttributeService = (struct zx_md_AttributeService_s*)el;
    return 1;
  case zx_md_AssertionIDRequestService_ELEM:
    if (!x->AssertionIDRequestService)
      x->AssertionIDRequestService = (struct zx_md_AssertionIDRequestService_s*)el;
    return 1;
  case zx_md_NameIDFormat_ELEM:
    if (!x->NameIDFormat)
      x->NameIDFormat = el;
    return 1;
  case zx_md_AttributeProfile_ELEM:
    if (!x->AttributeProfile)
      x->AttributeProfile = el;
    return 1;
  case zx_sa_Attribute_ELEM:
    if (!x->Attribute)
      x->Attribute = (struct zx_sa_Attribute_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AttributeConsumingService(struct zx_ctx* c, struct zx_md_AttributeConsumingService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_md_AttributeConsumingService(struct zx_ctx* c, struct zx_md_AttributeConsumingService_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_md_ServiceName_ELEM:
    if (!x->ServiceName)
      x->ServiceName = (struct zx_md_ServiceName_s*)el;
    return 1;
  case zx_md_ServiceDescription_ELEM:
    if (!x->ServiceDescription)
      x->ServiceDescription = (struct zx_md_ServiceDescription_s*)el;
    return 1;
  case zx_md_RequestedAttribute_ELEM:
    if (!x->RequestedAttribute)
      x->RequestedAttribute = (struct zx_md_RequestedAttribute_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AttributeService(struct zx_ctx* c, struct zx_md_AttributeService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AuthnAuthorityDescriptor(struct zx_ctx* c, struct zx_md_AuthnAuthorityDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_errorURL_ATTR:  x->errorURL = 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_md_AuthnAuthorityDescriptor(struct zx_ctx* c, struct zx_md_AuthnAuthorityDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el;
    return 1;
  case zx_md_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_md_Organization_s*)el;
    return 1;
  case zx_md_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_md_ContactPerson_s*)el;
    return 1;
  case zx_md_AuthnQueryService_ELEM:
    if (!x->AuthnQueryService)
      x->AuthnQueryService = (struct zx_md_AuthnQueryService_s*)el;
    return 1;
  case zx_md_AssertionIDRequestService_ELEM:
    if (!x->AssertionIDRequestService)
      x->AssertionIDRequestService = (struct zx_md_AssertionIDRequestService_s*)el;
    return 1;
  case zx_md_NameIDFormat_ELEM:
    if (!x->NameIDFormat)
      x->NameIDFormat = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AuthnQueryService(struct zx_ctx* c, struct zx_md_AuthnQueryService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_AuthzService(struct zx_ctx* c, struct zx_md_AuthzService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_md_ContactPerson(struct zx_ctx* c, struct zx_md_ContactPerson_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_Company_ELEM:
    if (!x->Company)
      x->Company = el;
    return 1;
  case zx_md_GivenName_ELEM:
    if (!x->GivenName)
      x->GivenName = el;
    return 1;
  case zx_md_SurName_ELEM:
    if (!x->SurName)
      x->SurName = el;
    return 1;
  case zx_md_EmailAddress_ELEM:
    if (!x->EmailAddress)
      x->EmailAddress = el;
    return 1;
  case zx_md_TelephoneNumber_ELEM:
    if (!x->TelephoneNumber)
      x->TelephoneNumber = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_EncryptionMethod(struct zx_ctx* c, struct zx_md_EncryptionMethod_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Algorithm_ATTR:  x->Algorithm = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_md_EncryptionMethod(struct zx_ctx* c, struct zx_md_EncryptionMethod_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xenc_KeySize_ELEM:
    if (!x->KeySize)
      x->KeySize = el;
    return 1;
  case zx_xenc_OAEPparams_ELEM:
    if (!x->OAEPparams)
      x->OAEPparams = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_EntitiesDescriptor(struct zx_ctx* c, struct zx_md_EntitiesDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_Name_ATTR:  x->Name = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_validUntil_ATTR:  x->validUntil = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_md_EntitiesDescriptor(struct zx_ctx* c, struct zx_md_EntitiesDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_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;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_EntityDescriptor(struct zx_ctx* c, struct zx_md_EntityDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_entityID_ATTR:  x->entityID = x->gg.attr; return 1;
    case zx_validUntil_ATTR:  x->validUntil = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_md_EntityDescriptor(struct zx_ctx* c, struct zx_md_EntityDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_RoleDescriptor_ELEM:
    if (!x->RoleDescriptor)
      x->RoleDescriptor = (struct zx_md_RoleDescriptor_s*)el;
    return 1;
  case zx_md_IDPSSODescriptor_ELEM:
    if (!x->IDPSSODescriptor)
      x->IDPSSODescriptor = (struct zx_md_IDPSSODescriptor_s*)el;
    return 1;
  case zx_md_SPSSODescriptor_ELEM:
    if (!x->SPSSODescriptor)
      x->SPSSODescriptor = (struct zx_md_SPSSODescriptor_s*)el;
    return 1;
  case zx_md_AuthnAuthorityDescriptor_ELEM:
    if (!x->AuthnAuthorityDescriptor)
      x->AuthnAuthorityDescriptor = (struct zx_md_AuthnAuthorityDescriptor_s*)el;
    return 1;
  case zx_md_AttributeAuthorityDescriptor_ELEM:
    if (!x->AttributeAuthorityDescriptor)
      x->AttributeAuthorityDescriptor = (struct zx_md_AttributeAuthorityDescriptor_s*)el;
    return 1;
  case zx_md_PDPDescriptor_ELEM:
    if (!x->PDPDescriptor)
      x->PDPDescriptor = (struct zx_md_PDPDescriptor_s*)el;
    return 1;
  case zx_md_AffiliationDescriptor_ELEM:
    if (!x->AffiliationDescriptor)
      x->AffiliationDescriptor = (struct zx_md_AffiliationDescriptor_s*)el;
    return 1;
  case zx_md_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_md_Organization_s*)el;
    return 1;
  case zx_md_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_md_ContactPerson_s*)el;
    return 1;
  case zx_md_AdditionalMetadataLocation_ELEM:
    if (!x->AdditionalMetadataLocation)
      x->AdditionalMetadataLocation = (struct zx_md_AdditionalMetadataLocation_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_md_Extensions(struct zx_ctx* c, struct zx_md_Extensions_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_shibmd_Scope_ELEM:
    if (!x->Scope)
      x->Scope = (struct zx_shibmd_Scope_s*)el;
    return 1;
  case zx_shibmd_KeyAuthority_ELEM:
    if (!x->KeyAuthority)
      x->KeyAuthority = (struct zx_shibmd_KeyAuthority_s*)el;
    return 1;
  case zx_idpdisc_DiscoveryResponse_ELEM:
    if (!x->DiscoveryResponse)
      x->DiscoveryResponse = (struct zx_idpdisc_DiscoveryResponse_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_IDPSSODescriptor(struct zx_ctx* c, struct zx_md_IDPSSODescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_WantAuthnRequestsSigned_ATTR:  x->WantAuthnRequestsSigned = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_errorURL_ATTR:  x->errorURL = 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_md_IDPSSODescriptor(struct zx_ctx* c, struct zx_md_IDPSSODescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el;
    return 1;
  case zx_md_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_md_Organization_s*)el;
    return 1;
  case zx_md_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_md_ContactPerson_s*)el;
    return 1;
  case zx_md_ArtifactResolutionService_ELEM:
    if (!x->ArtifactResolutionService)
      x->ArtifactResolutionService = (struct zx_md_ArtifactResolutionService_s*)el;
    return 1;
  case zx_md_SingleLogoutService_ELEM:
    if (!x->SingleLogoutService)
      x->SingleLogoutService = (struct zx_md_SingleLogoutService_s*)el;
    return 1;
  case zx_md_ManageNameIDService_ELEM:
    if (!x->ManageNameIDService)
      x->ManageNameIDService = (struct zx_md_ManageNameIDService_s*)el;
    return 1;
  case zx_md_NameIDFormat_ELEM:
    if (!x->NameIDFormat)
      x->NameIDFormat = el;
    return 1;
  case zx_md_SingleSignOnService_ELEM:
    if (!x->SingleSignOnService)
      x->SingleSignOnService = (struct zx_md_SingleSignOnService_s*)el;
    return 1;
  case zx_md_NameIDMappingService_ELEM:
    if (!x->NameIDMappingService)
      x->NameIDMappingService = (struct zx_md_NameIDMappingService_s*)el;
    return 1;
  case zx_md_AssertionIDRequestService_ELEM:
    if (!x->AssertionIDRequestService)
      x->AssertionIDRequestService = (struct zx_md_AssertionIDRequestService_s*)el;
    return 1;
  case zx_md_AttributeProfile_ELEM:
    if (!x->AttributeProfile)
      x->AttributeProfile = el;
    return 1;
  case zx_sa_Attribute_ELEM:
    if (!x->Attribute)
      x->Attribute = (struct zx_sa_Attribute_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_KeyDescriptor(struct zx_ctx* c, struct zx_md_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_md_KeyDescriptor(struct zx_ctx* c, struct zx_md_KeyDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_KeyInfo_ELEM:
    if (!x->KeyInfo)
      x->KeyInfo = (struct zx_ds_KeyInfo_s*)el;
    return 1;
  case zx_md_EncryptionMethod_ELEM:
    if (!x->EncryptionMethod)
      x->EncryptionMethod = (struct zx_md_EncryptionMethod_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_ManageNameIDService(struct zx_ctx* c, struct zx_md_ManageNameIDService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_NameIDMappingService(struct zx_ctx* c, struct zx_md_NameIDMappingService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_md_Organization(struct zx_ctx* c, struct zx_md_Organization_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_OrganizationName_ELEM:
    if (!x->OrganizationName)
      x->OrganizationName = (struct zx_md_OrganizationName_s*)el;
    return 1;
  case zx_md_OrganizationDisplayName_ELEM:
    if (!x->OrganizationDisplayName)
      x->OrganizationDisplayName = (struct zx_md_OrganizationDisplayName_s*)el;
    return 1;
  case zx_md_OrganizationURL_ELEM:
    if (!x->OrganizationURL)
      x->OrganizationURL = (struct zx_md_OrganizationURL_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_PDPDescriptor(struct zx_ctx* c, struct zx_md_PDPDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_errorURL_ATTR:  x->errorURL = 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_md_PDPDescriptor(struct zx_ctx* c, struct zx_md_PDPDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el;
    return 1;
  case zx_md_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_md_Organization_s*)el;
    return 1;
  case zx_md_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_md_ContactPerson_s*)el;
    return 1;
  case zx_md_AuthzService_ELEM:
    if (!x->AuthzService)
      x->AuthzService = (struct zx_md_AuthzService_s*)el;
    return 1;
  case zx_md_AssertionIDRequestService_ELEM:
    if (!x->AssertionIDRequestService)
      x->AssertionIDRequestService = (struct zx_md_AssertionIDRequestService_s*)el;
    return 1;
  case zx_md_NameIDFormat_ELEM:
    if (!x->NameIDFormat)
      x->NameIDFormat = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_RequestedAttribute(struct zx_ctx* c, struct zx_md_RequestedAttribute_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_FriendlyName_ATTR:  x->FriendlyName = x->gg.attr; return 1;
    case zx_Name_ATTR:  x->Name = x->gg.attr; return 1;
    case zx_NameFormat_ATTR:  x->NameFormat = x->gg.attr; return 1;
    case zx_isRequired_ATTR:  x->isRequired = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_md_RequestedAttribute(struct zx_ctx* c, struct zx_md_RequestedAttribute_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa_AttributeValue_ELEM:
    if (!x->AttributeValue)
      x->AttributeValue = (struct zx_sa_AttributeValue_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_RoleDescriptor(struct zx_ctx* c, struct zx_md_RoleDescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_errorURL_ATTR:  x->errorURL = 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_md_RoleDescriptor(struct zx_ctx* c, struct zx_md_RoleDescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el;
    return 1;
  case zx_md_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_md_Organization_s*)el;
    return 1;
  case zx_md_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_md_ContactPerson_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_md_SPSSODescriptor(struct zx_ctx* c, struct zx_md_SPSSODescriptor_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AuthnRequestsSigned_ATTR:  x->AuthnRequestsSigned = x->gg.attr; return 1;
    case zx_ID_ATTR:  x->ID = x->gg.attr; return 1;
    case zx_WantAssertionsSigned_ATTR:  x->WantAssertionsSigned = x->gg.attr; return 1;
    case zx_cacheDuration_ATTR:  x->cacheDuration = x->gg.attr; return 1;
    case zx_errorURL_ATTR:  x->errorURL = 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_md_SPSSODescriptor(struct zx_ctx* c, struct zx_md_SPSSODescriptor_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Signature_ELEM:
    if (!x->Signature)
      x->Signature = (struct zx_ds_Signature_s*)el;
    return 1;
  case zx_md_Extensions_ELEM:
    if (!x->Extensions)
      x->Extensions = (struct zx_md_Extensions_s*)el;
    return 1;
  case zx_md_KeyDescriptor_ELEM:
    if (!x->KeyDescriptor)
      x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el;
    return 1;
  case zx_md_Organization_ELEM:
    if (!x->Organization)
      x->Organization = (struct zx_md_Organization_s*)el;
    return 1;
  case zx_md_ContactPerson_ELEM:
    if (!x->ContactPerson)
      x->ContactPerson = (struct zx_md_ContactPerson_s*)el;
    return 1;
  case zx_md_ArtifactResolutionService_ELEM:
    if (!x->ArtifactResolutionService)
      x->ArtifactResolutionService = (struct zx_md_ArtifactResolutionService_s*)el;
    return 1;
  case zx_md_SingleLogoutService_ELEM:
    if (!x->SingleLogoutService)
      x->SingleLogoutService = (struct zx_md_SingleLogoutService_s*)el;
    return 1;
  case zx_md_ManageNameIDService_ELEM:
    if (!x->ManageNameIDService)
      x->ManageNameIDService = (struct zx_md_ManageNameIDService_s*)el;
    return 1;
  case zx_md_NameIDFormat_ELEM:
    if (!x->NameIDFormat)
      x->NameIDFormat = el;
    return 1;
  case zx_md_AssertionConsumerService_ELEM:
    if (!x->AssertionConsumerService)
      x->AssertionConsumerService = (struct zx_md_AssertionConsumerService_s*)el;
    return 1;
  case zx_md_AttributeConsumingService_ELEM:
    if (!x->AttributeConsumingService)
      x->AttributeConsumingService = (struct zx_md_AttributeConsumingService_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_SingleLogoutService(struct zx_ctx* c, struct zx_md_SingleLogoutService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_md_SingleSignOnService(struct zx_ctx* c, struct zx_md_SingleSignOnService_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;
    case zx_ResponseLocation_ATTR:  x->ResponseLocation = x->gg.attr; return 1;
    case zx_index_ATTR:  x->index = x->gg.attr; return 1;
    case zx_isDefault_ATTR:  x->isDefault = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}


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