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



int zx_DEC_ATTR_di12_AuthenticateRequester(struct zx_ctx* c, struct zx_di12_AuthenticateRequester_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_descriptionIDRefs_ATTR:  x->descriptionIDRefs = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_AuthenticateSessionContext(struct zx_ctx* c, struct zx_di12_AuthenticateSessionContext_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_descriptionIDRefs_ATTR:  x->descriptionIDRefs = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_AuthorizeRequester(struct zx_ctx* c, struct zx_di12_AuthorizeRequester_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_descriptionIDRefs_ATTR:  x->descriptionIDRefs = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

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

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_Description(struct zx_ctx* c, struct zx_di12_Description_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_di12_Description(struct zx_ctx* c, struct zx_di12_Description_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_SecurityMechID_ELEM:
    if (!x->SecurityMechID)
      x->SecurityMechID = el;
    return 1;
  case zx_di12_CredentialRef_ELEM:
    if (!x->CredentialRef)
      x->CredentialRef = el;
    return 1;
  case zx_di12_WsdlURI_ELEM:
    if (!x->WsdlURI)
      x->WsdlURI = el;
    return 1;
  case zx_di12_ServiceNameRef_ELEM:
    if (!x->ServiceNameRef)
      x->ServiceNameRef = el;
    return 1;
  case zx_di12_Endpoint_ELEM:
    if (!x->Endpoint)
      x->Endpoint = el;
    return 1;
  case zx_di12_SoapAction_ELEM:
    if (!x->SoapAction)
      x->SoapAction = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_EncryptResourceID(struct zx_ctx* c, struct zx_di12_EncryptResourceID_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_descriptionIDRefs_ATTR:  x->descriptionIDRefs = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_EncryptedResourceID(struct zx_ctx* c, struct zx_di12_EncryptedResourceID_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xenc_EncryptedData_ELEM:
    if (!x->EncryptedData)
      x->EncryptedData = (struct zx_xenc_EncryptedData_s*)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_di12_Extension(struct zx_ctx* c, struct zx_di12_Extension_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_InsertEntry(struct zx_ctx* c, struct zx_di12_InsertEntry_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;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_Modify(struct zx_ctx* c, struct zx_di12_Modify_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_di12_Modify(struct zx_ctx* c, struct zx_di12_Modify_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_ResourceID_ELEM:
    if (!x->ResourceID)
      x->ResourceID = (struct zx_di12_ResourceID_s*)el;
    return 1;
  case zx_di12_EncryptedResourceID_ELEM:
    if (!x->EncryptedResourceID)
      x->EncryptedResourceID = (struct zx_di12_EncryptedResourceID_s*)el;
    return 1;
  case zx_di12_InsertEntry_ELEM:
    if (!x->InsertEntry)
      x->InsertEntry = (struct zx_di12_InsertEntry_s*)el;
    return 1;
  case zx_di12_RemoveEntry_ELEM:
    if (!x->RemoveEntry)
      x->RemoveEntry = (struct zx_di12_RemoveEntry_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_ModifyResponse(struct zx_ctx* c, struct zx_di12_ModifyResponse_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_id_ATTR:  x->id = x->gg.attr; return 1;
    case zx_newEntryIDs_ATTR:  x->newEntryIDs = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_ModifyResponse(struct zx_ctx* c, struct zx_di12_ModifyResponse_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_Status_ELEM:
    if (!x->Status)
      x->Status = (struct zx_di12_Status_s*)el;
    return 1;
  case zx_di12_Extension_ELEM:
    if (!x->Extension)
      x->Extension = (struct zx_di12_Extension_s*)el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_Options(struct zx_ctx* c, struct zx_di12_Options_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_Option_ELEM:
    if (!x->Option)
      x->Option = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_Query(struct zx_ctx* c, struct zx_di12_Query_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_di12_Query(struct zx_ctx* c, struct zx_di12_Query_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_ResourceID_ELEM:
    if (!x->ResourceID)
      x->ResourceID = (struct zx_di12_ResourceID_s*)el;
    return 1;
  case zx_di12_EncryptedResourceID_ELEM:
    if (!x->EncryptedResourceID)
      x->EncryptedResourceID = (struct zx_di12_EncryptedResourceID_s*)el;
    return 1;
  case zx_di12_RequestedServiceType_ELEM:
    if (!x->RequestedServiceType)
      x->RequestedServiceType = (struct zx_di12_RequestedServiceType_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_QueryResponse(struct zx_ctx* c, struct zx_di12_QueryResponse_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_di12_QueryResponse(struct zx_ctx* c, struct zx_di12_QueryResponse_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_Status_ELEM:
    if (!x->Status)
      x->Status = (struct zx_di12_Status_s*)el;
    return 1;
  case zx_di12_ResourceOffering_ELEM:
    if (!x->ResourceOffering)
      x->ResourceOffering = (struct zx_di12_ResourceOffering_s*)el;
    return 1;
  case zx_di12_Credentials_ELEM:
    if (!x->Credentials)
      x->Credentials = (struct zx_di12_Credentials_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_RemoveEntry(struct zx_ctx* c, struct zx_di12_RemoveEntry_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_entryID_ATTR:  x->entryID = x->gg.attr; return 1;

  default: return 0;
  }
}

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

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_RequestedServiceType(struct zx_ctx* c, struct zx_di12_RequestedServiceType_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_ServiceType_ELEM:
    if (!x->ServiceType)
      x->ServiceType = el;
    return 1;
  case zx_di12_Options_ELEM:
    if (!x->Options)
      x->Options = (struct zx_di12_Options_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_ResourceID(struct zx_ctx* c, struct zx_di12_ResourceID_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_di12_ResourceID(struct zx_ctx* c, struct zx_di12_ResourceID_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_ResourceOffering(struct zx_ctx* c, struct zx_di12_ResourceOffering_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_entryID_ATTR:  x->entryID = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_ResourceOffering(struct zx_ctx* c, struct zx_di12_ResourceOffering_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_ResourceID_ELEM:
    if (!x->ResourceID)
      x->ResourceID = (struct zx_di12_ResourceID_s*)el;
    return 1;
  case zx_di12_EncryptedResourceID_ELEM:
    if (!x->EncryptedResourceID)
      x->EncryptedResourceID = (struct zx_di12_EncryptedResourceID_s*)el;
    return 1;
  case zx_di12_ServiceInstance_ELEM:
    if (!x->ServiceInstance)
      x->ServiceInstance = (struct zx_di12_ServiceInstance_s*)el;
    return 1;
  case zx_di12_Options_ELEM:
    if (!x->Options)
      x->Options = (struct zx_di12_Options_s*)el;
    return 1;
  case zx_di12_Abstract_ELEM:
    if (!x->Abstract)
      x->Abstract = el;
    return 1;

  default: return 0;
  }
}




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

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_ServiceInstance(struct zx_ctx* c, struct zx_di12_ServiceInstance_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_ServiceType_ELEM:
    if (!x->ServiceType)
      x->ServiceType = el;
    return 1;
  case zx_di12_ProviderID_ELEM:
    if (!x->ProviderID)
      x->ProviderID = el;
    return 1;
  case zx_di12_Description_ELEM:
    if (!x->Description)
      x->Description = (struct zx_di12_Description_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_di12_Status(struct zx_ctx* c, struct zx_di12_Status_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_code_ATTR:  x->code = x->gg.attr; return 1;
    case zx_comment_ATTR:  x->comment = x->gg.attr; return 1;
    case zx_ref_ATTR:  x->ref = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_di12_Status(struct zx_ctx* c, struct zx_di12_Status_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_di12_Status_ELEM:
    if (!x->Status)
      x->Status = (struct zx_di12_Status_s*)el;
    return 1;

  default: return 0;
  }
}


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