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



int zx_DEC_ATTR_ds_CanonicalizationMethod(struct zx_ctx* c, struct zx_ds_CanonicalizationMethod_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_ds_CanonicalizationMethod(struct zx_ctx* c, struct zx_ds_CanonicalizationMethod_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_DSAKeyValue(struct zx_ctx* c, struct zx_ds_DSAKeyValue_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_P_ELEM:
    if (!x->P)
      x->P = el;
    return 1;
  case zx_ds_Q_ELEM:
    if (!x->Q)
      x->Q = el;
    return 1;
  case zx_ds_G_ELEM:
    if (!x->G)
      x->G = el;
    return 1;
  case zx_ds_Y_ELEM:
    if (!x->Y)
      x->Y = el;
    return 1;
  case zx_ds_J_ELEM:
    if (!x->J)
      x->J = el;
    return 1;
  case zx_ds_Seed_ELEM:
    if (!x->Seed)
      x->Seed = el;
    return 1;
  case zx_ds_PgenCounter_ELEM:
    if (!x->PgenCounter)
      x->PgenCounter = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_DigestMethod(struct zx_ctx* c, struct zx_ds_DigestMethod_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_ds_DigestMethod(struct zx_ctx* c, struct zx_ds_DigestMethod_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_KeyInfo(struct zx_ctx* c, struct zx_ds_KeyInfo_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_KeyInfo(struct zx_ctx* c, struct zx_ds_KeyInfo_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_KeyName_ELEM:
    if (!x->KeyName)
      x->KeyName = el;
    return 1;
  case zx_ds_KeyValue_ELEM:
    if (!x->KeyValue)
      x->KeyValue = (struct zx_ds_KeyValue_s*)el;
    return 1;
  case zx_ds_RetrievalMethod_ELEM:
    if (!x->RetrievalMethod)
      x->RetrievalMethod = (struct zx_ds_RetrievalMethod_s*)el;
    return 1;
  case zx_ds_X509Data_ELEM:
    if (!x->X509Data)
      x->X509Data = (struct zx_ds_X509Data_s*)el;
    return 1;
  case zx_ds_PGPData_ELEM:
    if (!x->PGPData)
      x->PGPData = (struct zx_ds_PGPData_s*)el;
    return 1;
  case zx_ds_SPKIData_ELEM:
    if (!x->SPKIData)
      x->SPKIData = (struct zx_ds_SPKIData_s*)el;
    return 1;
  case zx_ds_MgmtData_ELEM:
    if (!x->MgmtData)
      x->MgmtData = el;
    return 1;
  case zx_xenc_EncryptedKey_ELEM:
    if (!x->EncryptedKey)
      x->EncryptedKey = (struct zx_xenc_EncryptedKey_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_KeyValue(struct zx_ctx* c, struct zx_ds_KeyValue_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_DSAKeyValue_ELEM:
    if (!x->DSAKeyValue)
      x->DSAKeyValue = (struct zx_ds_DSAKeyValue_s*)el;
    return 1;
  case zx_ds_RSAKeyValue_ELEM:
    if (!x->RSAKeyValue)
      x->RSAKeyValue = (struct zx_ds_RSAKeyValue_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_Manifest(struct zx_ctx* c, struct zx_ds_Manifest_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_Manifest(struct zx_ctx* c, struct zx_ds_Manifest_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Reference_ELEM:
    if (!x->Reference)
      x->Reference = (struct zx_ds_Reference_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_Object(struct zx_ctx* c, struct zx_ds_Object_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Encoding_ATTR:  x->Encoding = x->gg.attr; return 1;
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;
    case zx_MimeType_ATTR:  x->MimeType = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_PGPData(struct zx_ctx* c, struct zx_ds_PGPData_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_PGPKeyID_ELEM:
    if (!x->PGPKeyID)
      x->PGPKeyID = el;
    return 1;
  case zx_ds_PGPKeyPacket_ELEM:
    if (!x->PGPKeyPacket)
      x->PGPKeyPacket = el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_RSAKeyValue(struct zx_ctx* c, struct zx_ds_RSAKeyValue_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Modulus_ELEM:
    if (!x->Modulus)
      x->Modulus = el;
    return 1;
  case zx_ds_Exponent_ELEM:
    if (!x->Exponent)
      x->Exponent = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_Reference(struct zx_ctx* c, struct zx_ds_Reference_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;
    case zx_Type_ATTR:  x->Type = x->gg.attr; return 1;
    case zx_URI_ATTR:  x->URI = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_Reference(struct zx_ctx* c, struct zx_ds_Reference_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Transforms_ELEM:
    if (!x->Transforms)
      x->Transforms = (struct zx_ds_Transforms_s*)el;
    return 1;
  case zx_ds_DigestMethod_ELEM:
    if (!x->DigestMethod)
      x->DigestMethod = (struct zx_ds_DigestMethod_s*)el;
    return 1;
  case zx_ds_DigestValue_ELEM:
    if (!x->DigestValue)
      x->DigestValue = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_RetrievalMethod(struct zx_ctx* c, struct zx_ds_RetrievalMethod_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Type_ATTR:  x->Type = x->gg.attr; return 1;
    case zx_URI_ATTR:  x->URI = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_RetrievalMethod(struct zx_ctx* c, struct zx_ds_RetrievalMethod_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Transforms_ELEM:
    if (!x->Transforms)
      x->Transforms = (struct zx_ds_Transforms_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_SPKIData(struct zx_ctx* c, struct zx_ds_SPKIData_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_SPKISexp_ELEM:
    if (!x->SPKISexp)
      x->SPKISexp = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_Signature(struct zx_ctx* c, struct zx_ds_Signature_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_Signature(struct zx_ctx* c, struct zx_ds_Signature_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_SignedInfo_ELEM:
    if (!x->SignedInfo)
      x->SignedInfo = (struct zx_ds_SignedInfo_s*)el;
    return 1;
  case zx_ds_SignatureValue_ELEM:
    if (!x->SignatureValue)
      x->SignatureValue = (struct zx_ds_SignatureValue_s*)el;
    return 1;
  case zx_ds_KeyInfo_ELEM:
    if (!x->KeyInfo)
      x->KeyInfo = (struct zx_ds_KeyInfo_s*)el;
    return 1;
  case zx_ds_Object_ELEM:
    if (!x->Object)
      x->Object = (struct zx_ds_Object_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_SignatureMethod(struct zx_ctx* c, struct zx_ds_SignatureMethod_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_ds_SignatureMethod(struct zx_ctx* c, struct zx_ds_SignatureMethod_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_HMACOutputLength_ELEM:
    if (!x->HMACOutputLength)
      x->HMACOutputLength = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_SignatureProperties(struct zx_ctx* c, struct zx_ds_SignatureProperties_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_SignatureProperties(struct zx_ctx* c, struct zx_ds_SignatureProperties_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_SignatureProperty_ELEM:
    if (!x->SignatureProperty)
      x->SignatureProperty = (struct zx_ds_SignatureProperty_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_SignatureProperty(struct zx_ctx* c, struct zx_ds_SignatureProperty_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;
    case zx_Target_ATTR:  x->Target = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_SignatureValue(struct zx_ctx* c, struct zx_ds_SignatureValue_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_SignedInfo(struct zx_ctx* c, struct zx_ds_SignedInfo_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Id_ATTR:  x->Id = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_SignedInfo(struct zx_ctx* c, struct zx_ds_SignedInfo_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_CanonicalizationMethod_ELEM:
    if (!x->CanonicalizationMethod)
      x->CanonicalizationMethod = (struct zx_ds_CanonicalizationMethod_s*)el;
    return 1;
  case zx_ds_SignatureMethod_ELEM:
    if (!x->SignatureMethod)
      x->SignatureMethod = (struct zx_ds_SignatureMethod_s*)el;
    return 1;
  case zx_ds_Reference_ELEM:
    if (!x->Reference)
      x->Reference = (struct zx_ds_Reference_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_ds_Transform(struct zx_ctx* c, struct zx_ds_Transform_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_ds_Transform(struct zx_ctx* c, struct zx_ds_Transform_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_XPath_ELEM:
    if (!x->XPath)
      x->XPath = el;
    return 1;
  case zx_exca_InclusiveNamespaces_ELEM:
    if (!x->InclusiveNamespaces)
      x->InclusiveNamespaces = (struct zx_exca_InclusiveNamespaces_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_Transforms(struct zx_ctx* c, struct zx_ds_Transforms_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_Transform_ELEM:
    if (!x->Transform)
      x->Transform = (struct zx_ds_Transform_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_X509Data(struct zx_ctx* c, struct zx_ds_X509Data_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_X509IssuerSerial_ELEM:
    if (!x->X509IssuerSerial)
      x->X509IssuerSerial = (struct zx_ds_X509IssuerSerial_s*)el;
    return 1;
  case zx_ds_X509SKI_ELEM:
    if (!x->X509SKI)
      x->X509SKI = el;
    return 1;
  case zx_ds_X509SubjectName_ELEM:
    if (!x->X509SubjectName)
      x->X509SubjectName = el;
    return 1;
  case zx_ds_X509Certificate_ELEM:
    if (!x->X509Certificate)
      x->X509Certificate = el;
    return 1;
  case zx_ds_X509CRL_ELEM:
    if (!x->X509CRL)
      x->X509CRL = el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_ds_X509IssuerSerial(struct zx_ctx* c, struct zx_ds_X509IssuerSerial_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_ds_X509IssuerName_ELEM:
    if (!x->X509IssuerName)
      x->X509IssuerName = el;
    return 1;
  case zx_ds_X509SerialNumber_ELEM:
    if (!x->X509SerialNumber)
      x->X509SerialNumber = el;
    return 1;

  default: return 0;
  }
}


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