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



int zx_DEC_ATTR_sa11_Action(struct zx_ctx* c, struct zx_sa11_Action_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Namespace_ATTR:  x->Namespace = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_Advice(struct zx_ctx* c, struct zx_sa11_Advice_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_AssertionIDReference_ELEM:
    if (!x->AssertionIDReference)
      x->AssertionIDReference = el;
    return 1;
  case zx_sa11_Assertion_ELEM:
    if (!x->Assertion)
      x->Assertion = (struct zx_sa11_Assertion_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_sa_Assertion_ELEM:
    if (!x->sa_Assertion)
      x->sa_Assertion = (struct zx_sa_Assertion_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_Assertion(struct zx_ctx* c, struct zx_sa11_Assertion_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AssertionID_ATTR:  x->AssertionID = x->gg.attr; return 1;
    case zx_IssueInstant_ATTR:  x->IssueInstant = x->gg.attr; return 1;
    case zx_Issuer_ATTR:  x->Issuer = x->gg.attr; return 1;
    case zx_MajorVersion_ATTR:  x->MajorVersion = x->gg.attr; return 1;
    case zx_MinorVersion_ATTR:  x->MinorVersion = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_Assertion(struct zx_ctx* c, struct zx_sa11_Assertion_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Conditions_ELEM:
    if (!x->Conditions)
      x->Conditions = (struct zx_sa11_Conditions_s*)el;
    return 1;
  case zx_sa11_Advice_ELEM:
    if (!x->Advice)
      x->Advice = (struct zx_sa11_Advice_s*)el;
    return 1;
  case zx_sa11_Statement_ELEM:
    if (!x->Statement)
      x->Statement = el;
    return 1;
  case zx_sa11_SubjectStatement_ELEM:
    if (!x->SubjectStatement)
      x->SubjectStatement = (struct zx_sa11_SubjectStatement_s*)el;
    return 1;
  case zx_sa11_AuthenticationStatement_ELEM:
    if (!x->AuthenticationStatement)
      x->AuthenticationStatement = (struct zx_sa11_AuthenticationStatement_s*)el;
    return 1;
  case zx_sa11_AuthorizationDecisionStatement_ELEM:
    if (!x->AuthorizationDecisionStatement)
      x->AuthorizationDecisionStatement = (struct zx_sa11_AuthorizationDecisionStatement_s*)el;
    return 1;
  case zx_sa11_AttributeStatement_ELEM:
    if (!x->AttributeStatement)
      x->AttributeStatement = (struct zx_sa11_AttributeStatement_s*)el;
    return 1;
  case zx_xasa_XACMLAuthzDecisionStatement_ELEM:
    if (!x->XACMLAuthzDecisionStatement)
      x->XACMLAuthzDecisionStatement = (struct zx_xasa_XACMLAuthzDecisionStatement_s*)el;
    return 1;
  case zx_xasa_XACMLPolicyStatement_ELEM:
    if (!x->XACMLPolicyStatement)
      x->XACMLPolicyStatement = (struct zx_xasa_XACMLPolicyStatement_s*)el;
    return 1;
  case zx_xasacd1_XACMLAuthzDecisionStatement_ELEM:
    if (!x->xasacd1_XACMLAuthzDecisionStatement)
      x->xasacd1_XACMLAuthzDecisionStatement = (struct zx_xasacd1_XACMLAuthzDecisionStatement_s*)el;
    return 1;
  case zx_xasacd1_XACMLPolicyStatement_ELEM:
    if (!x->xasacd1_XACMLPolicyStatement)
      x->xasacd1_XACMLPolicyStatement = (struct zx_xasacd1_XACMLPolicyStatement_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_sa11_Attribute(struct zx_ctx* c, struct zx_sa11_Attribute_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AttributeName_ATTR:  x->AttributeName = x->gg.attr; return 1;
    case zx_AttributeNamespace_ATTR:  x->AttributeNamespace = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_Attribute(struct zx_ctx* c, struct zx_sa11_Attribute_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_AttributeValue_ELEM:
    if (!x->AttributeValue)
      x->AttributeValue = (struct zx_sa11_AttributeValue_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_AttributeDesignator(struct zx_ctx* c, struct zx_sa11_AttributeDesignator_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AttributeName_ATTR:  x->AttributeName = x->gg.attr; return 1;
    case zx_AttributeNamespace_ATTR:  x->AttributeNamespace = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_AttributeStatement(struct zx_ctx* c, struct zx_sa11_AttributeStatement_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;
  case zx_sa11_Attribute_ELEM:
    if (!x->Attribute)
      x->Attribute = (struct zx_sa11_Attribute_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_AttributeValue(struct zx_ctx* c, struct zx_sa11_AttributeValue_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_ResourceOffering_ELEM:
    if (!x->ResourceOffering)
      x->ResourceOffering = (struct zx_di12_ResourceOffering_s*)el;
    return 1;
  case zx_a_EndpointReference_ELEM:
    if (!x->EndpointReference)
      x->EndpointReference = (struct zx_a_EndpointReference_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_AudienceRestrictionCondition(struct zx_ctx* c, struct zx_sa11_AudienceRestrictionCondition_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Audience_ELEM:
    if (!x->Audience)
      x->Audience = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_AuthenticationStatement(struct zx_ctx* c, struct zx_sa11_AuthenticationStatement_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AuthenticationInstant_ATTR:  x->AuthenticationInstant = x->gg.attr; return 1;
    case zx_AuthenticationMethod_ATTR:  x->AuthenticationMethod = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_AuthenticationStatement(struct zx_ctx* c, struct zx_sa11_AuthenticationStatement_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;
  case zx_sa11_SubjectLocality_ELEM:
    if (!x->SubjectLocality)
      x->SubjectLocality = (struct zx_sa11_SubjectLocality_s*)el;
    return 1;
  case zx_sa11_AuthorityBinding_ELEM:
    if (!x->AuthorityBinding)
      x->AuthorityBinding = (struct zx_sa11_AuthorityBinding_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_AuthorityBinding(struct zx_ctx* c, struct zx_sa11_AuthorityBinding_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AuthorityKind_ATTR:  x->AuthorityKind = x->gg.attr; return 1;
    case zx_Binding_ATTR:  x->Binding = x->gg.attr; return 1;
    case zx_Location_ATTR:  x->Location = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_AuthorizationDecisionStatement(struct zx_ctx* c, struct zx_sa11_AuthorizationDecisionStatement_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Decision_ATTR:  x->Decision = x->gg.attr; return 1;
    case zx_Resource_ATTR:  x->Resource = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_AuthorizationDecisionStatement(struct zx_ctx* c, struct zx_sa11_AuthorizationDecisionStatement_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;
  case zx_sa11_Action_ELEM:
    if (!x->Action)
      x->Action = (struct zx_sa11_Action_s*)el;
    return 1;
  case zx_sa11_Evidence_ELEM:
    if (!x->Evidence)
      x->Evidence = (struct zx_sa11_Evidence_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_Conditions(struct zx_ctx* c, struct zx_sa11_Conditions_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_NotBefore_ATTR:  x->NotBefore = x->gg.attr; return 1;
    case zx_NotOnOrAfter_ATTR:  x->NotOnOrAfter = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_Conditions(struct zx_ctx* c, struct zx_sa11_Conditions_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_AudienceRestrictionCondition_ELEM:
    if (!x->AudienceRestrictionCondition)
      x->AudienceRestrictionCondition = (struct zx_sa11_AudienceRestrictionCondition_s*)el;
    return 1;
  case zx_sa11_DoNotCacheCondition_ELEM:
    if (!x->DoNotCacheCondition)
      x->DoNotCacheCondition = (struct zx_sa11_DoNotCacheCondition_s*)el;
    return 1;
  case zx_sa11_Condition_ELEM:
    if (!x->Condition)
      x->Condition = el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_Evidence(struct zx_ctx* c, struct zx_sa11_Evidence_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_AssertionIDReference_ELEM:
    if (!x->AssertionIDReference)
      x->AssertionIDReference = el;
    return 1;
  case zx_sa11_Assertion_ELEM:
    if (!x->Assertion)
      x->Assertion = (struct zx_sa11_Assertion_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_NameIdentifier(struct zx_ctx* c, struct zx_sa11_NameIdentifier_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Format_ATTR:  x->Format = x->gg.attr; return 1;
    case zx_NameQualifier_ATTR:  x->NameQualifier = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_Subject(struct zx_ctx* c, struct zx_sa11_Subject_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_NameIdentifier_ELEM:
    if (!x->NameIdentifier)
      x->NameIdentifier = (struct zx_sa11_NameIdentifier_s*)el;
    return 1;
  case zx_sa11_SubjectConfirmation_ELEM:
    if (!x->SubjectConfirmation)
      x->SubjectConfirmation = (struct zx_sa11_SubjectConfirmation_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_SubjectConfirmation(struct zx_ctx* c, struct zx_sa11_SubjectConfirmation_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_ConfirmationMethod_ELEM:
    if (!x->ConfirmationMethod)
      x->ConfirmationMethod = el;
    return 1;
  case zx_sa11_SubjectConfirmationData_ELEM:
    if (!x->SubjectConfirmationData)
      x->SubjectConfirmationData = el;
    return 1;
  case zx_ds_KeyInfo_ELEM:
    if (!x->KeyInfo)
      x->KeyInfo = (struct zx_ds_KeyInfo_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_sa11_SubjectLocality(struct zx_ctx* c, struct zx_sa11_SubjectLocality_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_DNSAddress_ATTR:  x->DNSAddress = x->gg.attr; return 1;
    case zx_IPAddress_ATTR:  x->IPAddress = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_sa11_SubjectStatement(struct zx_ctx* c, struct zx_sa11_SubjectStatement_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_sa11_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_sa11_Subject_s*)el;
    return 1;

  default: return 0;
  }
}


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