// Copyright (c) 2005-2011 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD/e, an XML Schema
// to C++ data binding compiler for embedded systems.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
//

// Begin prologue.
//
//
// End prologue.

#include "SceneDescription-pskel.h"

// Vector_pskel
//

void Vector_pskel::
X_parser (::xml_schema::float_pskel& p)
{
  this->X_parser_ = &p;
}

void Vector_pskel::
Y_parser (::xml_schema::float_pskel& p)
{
  this->Y_parser_ = &p;
}

void Vector_pskel::
Z_parser (::xml_schema::float_pskel& p)
{
  this->Z_parser_ = &p;
}

void Vector_pskel::
parsers (::xml_schema::float_pskel& X,
         ::xml_schema::float_pskel& Y,
         ::xml_schema::float_pskel& Z)
{
  this->X_parser_ = &X;
  this->Y_parser_ = &Y;
  this->Z_parser_ = &Z;
}

Vector_pskel::
Vector_pskel ()
: Vector_impl_ (0),
  X_parser_ (0),
  Y_parser_ (0),
  Z_parser_ (0),
  v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
{
}

Vector_pskel::
Vector_pskel (Vector_pskel* impl, void*)
: ::xsde::cxx::parser::validating::complex_content (impl, 0),
  Vector_impl_ (impl),
  X_parser_ (0),
  Y_parser_ (0),
  Z_parser_ (0),
  v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
{
}

// Color_pskel
//

void Color_pskel::
R_parser (::xml_schema::float_pskel& p)
{
  this->R_parser_ = &p;
}

void Color_pskel::
G_parser (::xml_schema::float_pskel& p)
{
  this->G_parser_ = &p;
}

void Color_pskel::
B_parser (::xml_schema::float_pskel& p)
{
  this->B_parser_ = &p;
}

void Color_pskel::
parsers (::xml_schema::float_pskel& R,
         ::xml_schema::float_pskel& G,
         ::xml_schema::float_pskel& B)
{
  this->R_parser_ = &R;
  this->G_parser_ = &G;
  this->B_parser_ = &B;
}

Color_pskel::
Color_pskel ()
: Color_impl_ (0),
  R_parser_ (0),
  G_parser_ (0),
  B_parser_ (0),
  v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
{
}

Color_pskel::
Color_pskel (Color_pskel* impl, void*)
: ::xsde::cxx::parser::validating::complex_content (impl, 0),
  Color_impl_ (impl),
  R_parser_ (0),
  G_parser_ (0),
  B_parser_ (0),
  v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
{
}

// BlockType_pskel
//

void BlockType_pskel::
Mass_parser (::xml_schema::float_pskel& p)
{
  this->Mass_parser_ = &p;
}

void BlockType_pskel::
Size_parser (::Vector_pskel& p)
{
  this->Size_parser_ = &p;
}

void BlockType_pskel::
Location_parser (::Vector_pskel& p)
{
  this->Location_parser_ = &p;
}

void BlockType_pskel::
Color_parser (::Color_pskel& p)
{
  this->Color_parser_ = &p;
}

void BlockType_pskel::
Value_parser (::xml_schema::integer_pskel& p)
{
  this->Value_parser_ = &p;
}

void BlockType_pskel::
parsers (::xml_schema::float_pskel& Mass,
         ::Vector_pskel& Size,
         ::Vector_pskel& Location,
         ::Color_pskel& Color,
         ::xml_schema::integer_pskel& Value)
{
  this->Mass_parser_ = &Mass;
  this->Size_parser_ = &Size;
  this->Location_parser_ = &Location;
  this->Color_parser_ = &Color;
  this->Value_parser_ = &Value;
}

BlockType_pskel::
BlockType_pskel ()
: BlockType_impl_ (0),
  Mass_parser_ (0),
  Size_parser_ (0),
  Location_parser_ (0),
  Color_parser_ (0),
  Value_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_)
{
}

BlockType_pskel::
BlockType_pskel (BlockType_pskel* impl, void*)
: ::xsde::cxx::parser::validating::complex_content (impl, 0),
  BlockType_impl_ (impl),
  Mass_parser_ (0),
  Size_parser_ (0),
  Location_parser_ (0),
  Color_parser_ (0),
  Value_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_)
{
}

// GroupReferenceType_pskel
//

void GroupReferenceType_pskel::
Location_parser (::Vector_pskel& p)
{
  this->Location_parser_ = &p;
}

void GroupReferenceType_pskel::
Color_parser (::Color_pskel& p)
{
  this->Color_parser_ = &p;
}

void GroupReferenceType_pskel::
Ref_parser (::xml_schema::idref_pskel& p)
{
  this->Ref_parser_ = &p;
}

void GroupReferenceType_pskel::
parsers (::Vector_pskel& Location,
         ::Color_pskel& Color,
         ::xml_schema::idref_pskel& Ref)
{
  this->Location_parser_ = &Location;
  this->Color_parser_ = &Color;
  this->Ref_parser_ = &Ref;
}

GroupReferenceType_pskel::
GroupReferenceType_pskel ()
: GroupReferenceType_impl_ (0),
  Location_parser_ (0),
  Color_parser_ (0),
  Ref_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_)
{
}

GroupReferenceType_pskel::
GroupReferenceType_pskel (GroupReferenceType_pskel* impl, void*)
: ::xsde::cxx::parser::validating::complex_content (impl, 0),
  GroupReferenceType_impl_ (impl),
  Location_parser_ (0),
  Color_parser_ (0),
  Ref_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_)
{
}

// GroupType_pskel
//

void GroupType_pskel::
id_parser (::xml_schema::id_pskel& p)
{
  this->id_parser_ = &p;
}

void GroupType_pskel::
Block_parser (::BlockType_pskel& p)
{
  this->Block_parser_ = &p;
}

void GroupType_pskel::
GroupReference_parser (::GroupReferenceType_pskel& p)
{
  this->GroupReference_parser_ = &p;
}

void GroupType_pskel::
parsers (::xml_schema::id_pskel& id,
         ::BlockType_pskel& Block,
         ::GroupReferenceType_pskel& GroupReference)
{
  this->id_parser_ = &id;
  this->Block_parser_ = &Block;
  this->GroupReference_parser_ = &GroupReference;
}

GroupType_pskel::
GroupType_pskel ()
: GroupType_impl_ (0),
  id_parser_ (0),
  Block_parser_ (0),
  GroupReference_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_),
  v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
{
}

GroupType_pskel::
GroupType_pskel (GroupType_pskel* impl, void*)
: ::xsde::cxx::parser::validating::complex_content (impl, 0),
  GroupType_impl_ (impl),
  id_parser_ (0),
  Block_parser_ (0),
  GroupReference_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_),
  v_state_attr_stack_ (sizeof (v_state_attr_), &v_state_attr_first_)
{
}

// SceneDescriptionType_pskel
//

void SceneDescriptionType_pskel::
Group_parser (::GroupType_pskel& p)
{
  this->Group_parser_ = &p;
}

void SceneDescriptionType_pskel::
Base_parser (::BlockType_pskel& p)
{
  this->Base_parser_ = &p;
}

void SceneDescriptionType_pskel::
GroupReference_parser (::GroupReferenceType_pskel& p)
{
  this->GroupReference_parser_ = &p;
}

void SceneDescriptionType_pskel::
parsers (::GroupType_pskel& Group,
         ::BlockType_pskel& Base,
         ::GroupReferenceType_pskel& GroupReference)
{
  this->Group_parser_ = &Group;
  this->Base_parser_ = &Base;
  this->GroupReference_parser_ = &GroupReference;
}

SceneDescriptionType_pskel::
SceneDescriptionType_pskel ()
: SceneDescriptionType_impl_ (0),
  Group_parser_ (0),
  Base_parser_ (0),
  GroupReference_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_)
{
}

SceneDescriptionType_pskel::
SceneDescriptionType_pskel (SceneDescriptionType_pskel* impl, void*)
: ::xsde::cxx::parser::validating::complex_content (impl, 0),
  SceneDescriptionType_impl_ (impl),
  Group_parser_ (0),
  Base_parser_ (0),
  GroupReference_parser_ (0),
  v_state_stack_ (sizeof (v_state_), &v_state_first_)
{
}

#include <assert.h>

// Vector_pskel
//

void Vector_pskel::
X (float x)
{
  if (this->Vector_impl_)
    this->Vector_impl_->X (x);
}

void Vector_pskel::
Y (float x)
{
  if (this->Vector_impl_)
    this->Vector_impl_->Y (x);
}

void Vector_pskel::
Z (float x)
{
  if (this->Vector_impl_)
    this->Vector_impl_->Z (x);
}

void Vector_pskel::
_reset ()
{
  typedef ::xsde::cxx::parser::validating::complex_content base;
  base::_reset ();

  this->v_state_attr_stack_.clear ();

  if (this->X_parser_)
    this->X_parser_->_reset ();

  if (this->Y_parser_)
    this->Y_parser_->_reset ();

  if (this->Z_parser_)
    this->Z_parser_->_reset ();
}

// Color_pskel
//

void Color_pskel::
R (float x)
{
  if (this->Color_impl_)
    this->Color_impl_->R (x);
}

void Color_pskel::
G (float x)
{
  if (this->Color_impl_)
    this->Color_impl_->G (x);
}

void Color_pskel::
B (float x)
{
  if (this->Color_impl_)
    this->Color_impl_->B (x);
}

void Color_pskel::
_reset ()
{
  typedef ::xsde::cxx::parser::validating::complex_content base;
  base::_reset ();

  this->v_state_attr_stack_.clear ();

  if (this->R_parser_)
    this->R_parser_->_reset ();

  if (this->G_parser_)
    this->G_parser_->_reset ();

  if (this->B_parser_)
    this->B_parser_->_reset ();
}

// BlockType_pskel
//

void BlockType_pskel::
Mass (float x)
{
  if (this->BlockType_impl_)
    this->BlockType_impl_->Mass (x);
}

void BlockType_pskel::
Size (const ::Vector& x)
{
  if (this->BlockType_impl_)
    this->BlockType_impl_->Size (x);
}

void BlockType_pskel::
Location (const ::Vector& x)
{
  if (this->BlockType_impl_)
    this->BlockType_impl_->Location (x);
}

void BlockType_pskel::
Color (const ::Color& x)
{
  if (this->BlockType_impl_)
    this->BlockType_impl_->Color (x);
}

void BlockType_pskel::
Value (long x)
{
  if (this->BlockType_impl_)
    this->BlockType_impl_->Value (x);
}

void BlockType_pskel::
_reset ()
{
  if (this->resetting_)
    return;

  typedef ::xsde::cxx::parser::validating::complex_content base;
  base::_reset ();

  this->v_state_stack_.clear ();

  this->resetting_ = true;

  if (this->Mass_parser_)
    this->Mass_parser_->_reset ();

  if (this->Size_parser_)
    this->Size_parser_->_reset ();

  if (this->Location_parser_)
    this->Location_parser_->_reset ();

  if (this->Color_parser_)
    this->Color_parser_->_reset ();

  if (this->Value_parser_)
    this->Value_parser_->_reset ();

  this->resetting_ = false;
}

// GroupReferenceType_pskel
//

void GroupReferenceType_pskel::
Location (const ::Vector& x)
{
  if (this->GroupReferenceType_impl_)
    this->GroupReferenceType_impl_->Location (x);
}

void GroupReferenceType_pskel::
Color (const ::Color& x)
{
  if (this->GroupReferenceType_impl_)
    this->GroupReferenceType_impl_->Color (x);
}

void GroupReferenceType_pskel::
Ref (const ::std::string& x)
{
  if (this->GroupReferenceType_impl_)
    this->GroupReferenceType_impl_->Ref (x);
}

void GroupReferenceType_pskel::
_reset ()
{
  if (this->resetting_)
    return;

  typedef ::xsde::cxx::parser::validating::complex_content base;
  base::_reset ();

  this->v_state_stack_.clear ();

  this->resetting_ = true;

  if (this->Location_parser_)
    this->Location_parser_->_reset ();

  if (this->Color_parser_)
    this->Color_parser_->_reset ();

  if (this->Ref_parser_)
    this->Ref_parser_->_reset ();

  this->resetting_ = false;
}

// GroupType_pskel
//

void GroupType_pskel::
id (const ::std::string& x)
{
  if (this->GroupType_impl_)
    this->GroupType_impl_->id (x);
}

void GroupType_pskel::
choice_arm (choice_arm_tag x)
{
  if (this->GroupType_impl_)
    this->GroupType_impl_->choice_arm (x);
}

void GroupType_pskel::
Block (const ::BlockType& x)
{
  if (this->GroupType_impl_)
    this->GroupType_impl_->Block (x);
}

void GroupType_pskel::
GroupReference (const ::GroupReferenceType& x)
{
  if (this->GroupType_impl_)
    this->GroupType_impl_->GroupReference (x);
}

void GroupType_pskel::
_reset ()
{
  if (this->resetting_)
    return;

  typedef ::xsde::cxx::parser::validating::complex_content base;
  base::_reset ();

  this->v_state_stack_.clear ();

  this->v_state_attr_stack_.clear ();

  if (this->id_parser_)
    this->id_parser_->_reset ();

  this->resetting_ = true;

  if (this->Block_parser_)
    this->Block_parser_->_reset ();

  if (this->GroupReference_parser_)
    this->GroupReference_parser_->_reset ();

  this->resetting_ = false;
}

// SceneDescriptionType_pskel
//

void SceneDescriptionType_pskel::
Group (::GroupType* x)
{
  if (this->SceneDescriptionType_impl_)
    this->SceneDescriptionType_impl_->Group (x);
}

void SceneDescriptionType_pskel::
Base (const ::BlockType& x)
{
  if (this->SceneDescriptionType_impl_)
    this->SceneDescriptionType_impl_->Base (x);
}

void SceneDescriptionType_pskel::
GroupReference (const ::GroupReferenceType& x)
{
  if (this->SceneDescriptionType_impl_)
    this->SceneDescriptionType_impl_->GroupReference (x);
}

void SceneDescriptionType_pskel::
_reset ()
{
  if (this->resetting_)
    return;

  typedef ::xsde::cxx::parser::validating::complex_content base;
  base::_reset ();

  this->v_state_stack_.clear ();

  this->resetting_ = true;

  if (this->Group_parser_)
    this->Group_parser_->_reset ();

  if (this->Base_parser_)
    this->Base_parser_->_reset ();

  if (this->GroupReference_parser_)
    this->GroupReference_parser_->_reset ();

  this->resetting_ = false;
}

#include <assert.h>

// Element validation and dispatch functions for BlockType_pskel.
//
bool BlockType_pskel::
_start_element_impl (const ::xsde::cxx::ro_string& ns,
                     const ::xsde::cxx::ro_string& n)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  if (vd->func == 0 && vd->state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (base::_start_element_impl (ns, n))
      return true;
    else
      vd->state = 1;
  }

  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, ns, n, true);

    vd = vs.data + (vs.size - 1);

    if (vd->state == ~0UL && !ctx.error_type ())
      vd = vs.data + (--vs.size - 1);
    else
      break;
  }

  if (vd->func == 0)
  {
    if (vd->state != ~0UL)
    {
      unsigned long s = ~0UL;

      if (n == "Mass" && ns.empty ())
        s = 0UL;

      if (s != ~0UL)
      {
        vd->count++;
        vd->state = ~0UL;

        vd = vs.data + vs.size++;
        vd->func = &BlockType_pskel::sequence_0;
        vd->state = s;
        vd->count = 0;

        this->sequence_0 (vd->state, vd->count, ns, n, true);
      }
      else
      {
        if (vd->count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          return true;
        }

        return false;
      }
    }
    else
      return false;
  }

  return true;
}

bool BlockType_pskel::
_end_element_impl (const ::xsde::cxx::ro_string& ns,
                   const ::xsde::cxx::ro_string& n)
{
  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size - 1];

  if (vd.func == 0 && vd.state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (!base::_end_element_impl (ns, n))
      assert (false);
    return true;
  }

  assert (vd.func != 0);
  (this->*vd.func) (vd.state, vd.count, ns, n, false);

  if (vd.state == ~0UL)
    vs.size--;

  return true;
}

void BlockType_pskel::
_pre_e_validate ()
{
  this->v_state_stack_.push ();
  static_cast< v_state_* > (this->v_state_stack_.top ())->size = 0;

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size++];

  vd.func = 0;
  vd.state = 0;
  vd.count = 0;
}

void BlockType_pskel::
_post_e_validate ()
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  ::xsde::cxx::ro_string empty;
  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, empty, empty, true);

    if (ctx.error_type ())
      return;

    assert (vd->state == ~0UL);
    vd = vs.data + (--vs.size - 1);
  }

  if (vd->count < 1UL)
    this->_schema_error (::xsde::cxx::schema_error::expected_element);

  this->v_state_stack_.pop ();
}

void BlockType_pskel::
sequence_0 (unsigned long& state,
            unsigned long& count,
            const ::xsde::cxx::ro_string& ns,
            const ::xsde::cxx::ro_string& n,
            bool start)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  XSDE_UNUSED (ctx);

  switch (state)
  {
    case 0UL:
    {
      if (n == "Mass" && ns.empty ())
      {
        if (start)
        {
          if (this->Mass_parser_)
          {
            this->Mass_parser_->pre ();
            ctx.nested_parser (this->Mass_parser_);
          }
        }
        else
        {
          if (this->Mass_parser_ != 0)
          {
            float tmp = this->Mass_parser_->post_float ();
            this->Mass (tmp);
          }

          count = 0;
          state = 1UL;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = 1UL;
        // Fall through.
      }
    }
    case 1UL:
    {
      if (n == "Size" && ns.empty ())
      {
        if (start)
        {
          if (this->Size_parser_)
          {
            this->Size_parser_->pre ();
            ctx.nested_parser (this->Size_parser_);
          }
        }
        else
        {
          if (this->Size_parser_ != 0)
          {
            const ::Vector& tmp = this->Size_parser_->post_Vector ();
            this->Size (tmp);
          }

          count = 0;
          state = 2UL;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = 2UL;
        // Fall through.
      }
    }
    case 2UL:
    {
      if (n == "Location" && ns.empty ())
      {
        if (start)
        {
          if (this->Location_parser_)
          {
            this->Location_parser_->pre ();
            ctx.nested_parser (this->Location_parser_);
          }
        }
        else
        {
          if (this->Location_parser_ != 0)
          {
            const ::Vector& tmp = this->Location_parser_->post_Vector ();
            this->Location (tmp);
          }

          count = 0;
          state = 3UL;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = 3UL;
        // Fall through.
      }
    }
    case 3UL:
    {
      if (n == "Color" && ns.empty ())
      {
        if (start)
        {
          if (this->Color_parser_)
          {
            this->Color_parser_->pre ();
            ctx.nested_parser (this->Color_parser_);
          }
        }
        else
        {
          if (this->Color_parser_ != 0)
          {
            const ::Color& tmp = this->Color_parser_->post_Color ();
            this->Color (tmp);
          }

          count = 0;
          state = 4UL;
        }

        break;
      }
      else
      {
        assert (start);
        count = 0;
        state = 4UL;
        // Fall through.
      }
    }
    case 4UL:
    {
      if (n == "Value" && ns.empty ())
      {
        if (start)
        {
          if (this->Value_parser_)
          {
            this->Value_parser_->pre ();
            ctx.nested_parser (this->Value_parser_);
          }
        }
        else
        {
          if (this->Value_parser_ != 0)
          {
            long tmp = this->Value_parser_->post_integer ();
            this->Value (tmp);
          }

          count = 0;
          state = ~0UL;
        }

        break;
      }
      else
      {
        assert (start);
        count = 0;
        state = ~0UL;
        // Fall through.
      }
    }
    case ~0UL:
      break;
  }
}

// Element validation and dispatch functions for GroupReferenceType_pskel.
//
bool GroupReferenceType_pskel::
_start_element_impl (const ::xsde::cxx::ro_string& ns,
                     const ::xsde::cxx::ro_string& n)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  if (vd->func == 0 && vd->state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (base::_start_element_impl (ns, n))
      return true;
    else
      vd->state = 1;
  }

  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, ns, n, true);

    vd = vs.data + (vs.size - 1);

    if (vd->state == ~0UL && !ctx.error_type ())
      vd = vs.data + (--vs.size - 1);
    else
      break;
  }

  if (vd->func == 0)
  {
    if (vd->state != ~0UL)
    {
      unsigned long s = ~0UL;

      if (n == "Location" && ns.empty ())
        s = 0UL;

      if (s != ~0UL)
      {
        vd->count++;
        vd->state = ~0UL;

        vd = vs.data + vs.size++;
        vd->func = &GroupReferenceType_pskel::sequence_0;
        vd->state = s;
        vd->count = 0;

        this->sequence_0 (vd->state, vd->count, ns, n, true);
      }
      else
      {
        if (vd->count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          return true;
        }

        return false;
      }
    }
    else
      return false;
  }

  return true;
}

bool GroupReferenceType_pskel::
_end_element_impl (const ::xsde::cxx::ro_string& ns,
                   const ::xsde::cxx::ro_string& n)
{
  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size - 1];

  if (vd.func == 0 && vd.state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (!base::_end_element_impl (ns, n))
      assert (false);
    return true;
  }

  assert (vd.func != 0);
  (this->*vd.func) (vd.state, vd.count, ns, n, false);

  if (vd.state == ~0UL)
    vs.size--;

  return true;
}

void GroupReferenceType_pskel::
_pre_e_validate ()
{
  this->v_state_stack_.push ();
  static_cast< v_state_* > (this->v_state_stack_.top ())->size = 0;

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size++];

  vd.func = 0;
  vd.state = 0;
  vd.count = 0;
}

void GroupReferenceType_pskel::
_post_e_validate ()
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  ::xsde::cxx::ro_string empty;
  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, empty, empty, true);

    if (ctx.error_type ())
      return;

    assert (vd->state == ~0UL);
    vd = vs.data + (--vs.size - 1);
  }

  if (vd->count < 1UL)
    this->_schema_error (::xsde::cxx::schema_error::expected_element);

  this->v_state_stack_.pop ();
}

void GroupReferenceType_pskel::
sequence_0 (unsigned long& state,
            unsigned long& count,
            const ::xsde::cxx::ro_string& ns,
            const ::xsde::cxx::ro_string& n,
            bool start)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  XSDE_UNUSED (ctx);

  switch (state)
  {
    case 0UL:
    {
      if (n == "Location" && ns.empty ())
      {
        if (start)
        {
          if (this->Location_parser_)
          {
            this->Location_parser_->pre ();
            ctx.nested_parser (this->Location_parser_);
          }
        }
        else
        {
          if (this->Location_parser_ != 0)
          {
            const ::Vector& tmp = this->Location_parser_->post_Vector ();
            this->Location (tmp);
          }

          count = 0;
          state = 1UL;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = 1UL;
        // Fall through.
      }
    }
    case 1UL:
    {
      if (n == "Color" && ns.empty ())
      {
        if (start)
        {
          if (this->Color_parser_)
          {
            this->Color_parser_->pre ();
            ctx.nested_parser (this->Color_parser_);
          }
        }
        else
        {
          if (this->Color_parser_ != 0)
          {
            const ::Color& tmp = this->Color_parser_->post_Color ();
            this->Color (tmp);
          }

          count = 0;
          state = 2UL;
        }

        break;
      }
      else
      {
        assert (start);
        count = 0;
        state = 2UL;
        // Fall through.
      }
    }
    case 2UL:
    {
      if (n == "Ref" && ns.empty ())
      {
        if (start)
        {
          if (this->Ref_parser_)
          {
            this->Ref_parser_->pre ();
            ctx.nested_parser (this->Ref_parser_);
          }
        }
        else
        {
          if (this->Ref_parser_ != 0)
          {
            const ::std::string& tmp = this->Ref_parser_->post_idref ();
            this->Ref (tmp);
          }

          count = 0;
          state = ~0UL;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = ~0UL;
        // Fall through.
      }
    }
    case ~0UL:
      break;
  }
}

// Element validation and dispatch functions for GroupType_pskel.
//
bool GroupType_pskel::
_start_element_impl (const ::xsde::cxx::ro_string& ns,
                     const ::xsde::cxx::ro_string& n)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  if (vd->func == 0 && vd->state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (base::_start_element_impl (ns, n))
      return true;
    else
      vd->state = 1;
  }

  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, ns, n, true);

    vd = vs.data + (vs.size - 1);

    if (vd->state == ~0UL && !ctx.error_type ())
      vd = vs.data + (--vs.size - 1);
    else
      break;
  }

  if (vd->func == 0)
  {
    if (vd->state != ~0UL)
    {
      unsigned long s = ~0UL;

      if ((n == "Block" && ns.empty ()) ||
          (n == "GroupReference" && ns.empty ()))
        s = 0UL;

      if (s != ~0UL)
      {
        vd->count++;
        vd->state = ~0UL;

        vd = vs.data + vs.size++;
        vd->func = &GroupType_pskel::sequence_0;
        vd->state = s;
        vd->count = 0;

        this->sequence_0 (vd->state, vd->count, ns, n, true);
      }
      else
      {
        if (vd->count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          return true;
        }

        return false;
      }
    }
    else
      return false;
  }

  return true;
}

bool GroupType_pskel::
_end_element_impl (const ::xsde::cxx::ro_string& ns,
                   const ::xsde::cxx::ro_string& n)
{
  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size - 1];

  if (vd.func == 0 && vd.state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (!base::_end_element_impl (ns, n))
      assert (false);
    return true;
  }

  assert (vd.func != 0);
  (this->*vd.func) (vd.state, vd.count, ns, n, false);

  if (vd.state == ~0UL)
    vs.size--;

  return true;
}

void GroupType_pskel::
_pre_e_validate ()
{
  this->v_state_stack_.push ();
  static_cast< v_state_* > (this->v_state_stack_.top ())->size = 0;

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size++];

  vd.func = 0;
  vd.state = 0;
  vd.count = 0;
}

void GroupType_pskel::
_post_e_validate ()
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  ::xsde::cxx::ro_string empty;
  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, empty, empty, true);

    if (ctx.error_type ())
      return;

    assert (vd->state == ~0UL);
    vd = vs.data + (--vs.size - 1);
  }

  if (vd->count < 1UL)
    this->_schema_error (::xsde::cxx::schema_error::expected_element);

  this->v_state_stack_.pop ();
}

void GroupType_pskel::
sequence_0 (unsigned long& state,
            unsigned long& count,
            const ::xsde::cxx::ro_string& ns,
            const ::xsde::cxx::ro_string& n,
            bool start)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  XSDE_UNUSED (ctx);

  switch (state)
  {
    case 0UL:
    {
      unsigned long s = ~0UL;

      if (n == "Block" && ns.empty ())
        s = 0UL;
      else if (n == "GroupReference" && ns.empty ())
        s = 1UL;

      if (s != ~0UL)
      {
        assert (start);
        count++;

        v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
        v_state_descr_& vd = vs.data[vs.size++];

        vd.func = &GroupType_pskel::choice_0;
        vd.state = s;
        vd.count = 0;

        this->choice_arm (static_cast< choice_arm_tag > (s));
        this->choice_0 (vd.state, vd.count, ns, n, true);
        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = ~0UL;
        // Fall through.
      }
    }
    case ~0UL:
      break;
  }
}

void GroupType_pskel::
choice_0 (unsigned long& state,
          unsigned long& count,
          const ::xsde::cxx::ro_string& ns,
          const ::xsde::cxx::ro_string& n,
          bool start)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  XSDE_UNUSED (count);
  XSDE_UNUSED (ns);
  XSDE_UNUSED (n);
  XSDE_UNUSED (ctx);

  switch (state)
  {
    case 0UL:
    {
      if (start)
      {
        if (this->Block_parser_)
        {
          this->Block_parser_->pre ();
          ctx.nested_parser (this->Block_parser_);
        }
      }
      else
      {
        if (this->Block_parser_ != 0)
        {
          const ::BlockType& tmp = this->Block_parser_->post_BlockType ();
          this->Block (tmp);
        }

        state = ~0UL;
      }

      break;
    }
    case 1UL:
    {
      if (start)
      {
        if (this->GroupReference_parser_)
        {
          this->GroupReference_parser_->pre ();
          ctx.nested_parser (this->GroupReference_parser_);
        }
      }
      else
      {
        if (this->GroupReference_parser_ != 0)
        {
          const ::GroupReferenceType& tmp = this->GroupReference_parser_->post_GroupReferenceType ();
          this->GroupReference (tmp);
        }

        state = ~0UL;
      }

      break;
    }
  }
}

// Element validation and dispatch functions for SceneDescriptionType_pskel.
//
bool SceneDescriptionType_pskel::
_start_element_impl (const ::xsde::cxx::ro_string& ns,
                     const ::xsde::cxx::ro_string& n)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  if (vd->func == 0 && vd->state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (base::_start_element_impl (ns, n))
      return true;
    else
      vd->state = 1;
  }

  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, ns, n, true);

    vd = vs.data + (vs.size - 1);

    if (vd->state == ~0UL && !ctx.error_type ())
      vd = vs.data + (--vs.size - 1);
    else
      break;
  }

  if (vd->func == 0)
  {
    if (vd->state != ~0UL)
    {
      unsigned long s = ~0UL;

      if (n == "Group" && ns.empty ())
        s = 0UL;

      if (s != ~0UL)
      {
        vd->count++;
        vd->state = ~0UL;

        vd = vs.data + vs.size++;
        vd->func = &SceneDescriptionType_pskel::sequence_0;
        vd->state = s;
        vd->count = 0;

        this->sequence_0 (vd->state, vd->count, ns, n, true);
      }
      else
      {
        if (vd->count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          return true;
        }

        return false;
      }
    }
    else
      return false;
  }

  return true;
}

bool SceneDescriptionType_pskel::
_end_element_impl (const ::xsde::cxx::ro_string& ns,
                   const ::xsde::cxx::ro_string& n)
{
  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size - 1];

  if (vd.func == 0 && vd.state == 0)
  {
    typedef ::xsde::cxx::parser::validating::complex_content base;
    if (!base::_end_element_impl (ns, n))
      assert (false);
    return true;
  }

  assert (vd.func != 0);
  (this->*vd.func) (vd.state, vd.count, ns, n, false);

  if (vd.state == ~0UL)
    vs.size--;

  return true;
}

void SceneDescriptionType_pskel::
_pre_e_validate ()
{
  this->v_state_stack_.push ();
  static_cast< v_state_* > (this->v_state_stack_.top ())->size = 0;

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_& vd = vs.data[vs.size++];

  vd.func = 0;
  vd.state = 0;
  vd.count = 0;
}

void SceneDescriptionType_pskel::
_post_e_validate ()
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  v_state_& vs = *static_cast< v_state_* > (this->v_state_stack_.top ());
  v_state_descr_* vd = vs.data + (vs.size - 1);

  ::xsde::cxx::ro_string empty;
  while (vd->func != 0)
  {
    (this->*vd->func) (vd->state, vd->count, empty, empty, true);

    if (ctx.error_type ())
      return;

    assert (vd->state == ~0UL);
    vd = vs.data + (--vs.size - 1);
  }

  if (vd->count < 1UL)
    this->_schema_error (::xsde::cxx::schema_error::expected_element);

  this->v_state_stack_.pop ();
}

void SceneDescriptionType_pskel::
sequence_0 (unsigned long& state,
            unsigned long& count,
            const ::xsde::cxx::ro_string& ns,
            const ::xsde::cxx::ro_string& n,
            bool start)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  XSDE_UNUSED (ctx);

  switch (state)
  {
    case 0UL:
    {
      if (n == "Group" && ns.empty ())
      {
        if (start)
        {
          if (this->Group_parser_)
          {
            this->Group_parser_->pre ();
            ctx.nested_parser (this->Group_parser_);
          }
        }
        else
        {
          if (this->Group_parser_ != 0)
          {
            ::GroupType* tmp = this->Group_parser_->post_GroupType ();
            this->Group (tmp);
          }

          count++;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = 1UL;
        // Fall through.
      }
    }
    case 1UL:
    {
      if (n == "Base" && ns.empty ())
      {
        if (start)
        {
          if (this->Base_parser_)
          {
            this->Base_parser_->pre ();
            ctx.nested_parser (this->Base_parser_);
          }
        }
        else
        {
          if (this->Base_parser_ != 0)
          {
            const ::BlockType& tmp = this->Base_parser_->post_BlockType ();
            this->Base (tmp);
          }

          count = 0;
          state = 2UL;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = 2UL;
        // Fall through.
      }
    }
    case 2UL:
    {
      if (n == "GroupReference" && ns.empty ())
      {
        if (start)
        {
          if (this->GroupReference_parser_)
          {
            this->GroupReference_parser_->pre ();
            ctx.nested_parser (this->GroupReference_parser_);
          }
        }
        else
        {
          if (this->GroupReference_parser_ != 0)
          {
            const ::GroupReferenceType& tmp = this->GroupReference_parser_->post_GroupReferenceType ();
            this->GroupReference (tmp);
          }

          count++;
        }

        break;
      }
      else
      {
        assert (start);
        if (count < 1UL)
        {
          this->_schema_error (::xsde::cxx::schema_error::expected_element);
          break;
        }

        count = 0;
        state = ~0UL;
        // Fall through.
      }
    }
    case ~0UL:
      break;
  }
}

// Attribute validation and dispatch functions for Vector_pskel.
//
bool Vector_pskel::
_attribute_impl_phase_one (const ::xsde::cxx::ro_string& ns,
                           const ::xsde::cxx::ro_string& n,
                           const ::xsde::cxx::ro_string& s)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  if (n == "X" && ns.empty ())
  {
    if (this->X_parser_)
    {
      this->X_parser_->pre ();

      this->X_parser_->_pre_impl (ctx);

      if (!ctx.error_type ())
        this->X_parser_->_characters (s);

      if (!ctx.error_type ())
        this->X_parser_->_post_impl ();

      if (!ctx.error_type ())
      {
        float tmp = this->X_parser_->post_float ();

        this->X (tmp);
      }
    }

    static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->X = true;
    return true;
  }

  if (n == "Y" && ns.empty ())
  {
    if (this->Y_parser_)
    {
      this->Y_parser_->pre ();

      this->Y_parser_->_pre_impl (ctx);

      if (!ctx.error_type ())
        this->Y_parser_->_characters (s);

      if (!ctx.error_type ())
        this->Y_parser_->_post_impl ();

      if (!ctx.error_type ())
      {
        float tmp = this->Y_parser_->post_float ();

        this->Y (tmp);
      }
    }

    static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->Y = true;
    return true;
  }

  if (n == "Z" && ns.empty ())
  {
    if (this->Z_parser_)
    {
      this->Z_parser_->pre ();

      this->Z_parser_->_pre_impl (ctx);

      if (!ctx.error_type ())
        this->Z_parser_->_characters (s);

      if (!ctx.error_type ())
        this->Z_parser_->_post_impl ();

      if (!ctx.error_type ())
      {
        float tmp = this->Z_parser_->post_float ();

        this->Z (tmp);
      }
    }

    static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->Z = true;
    return true;
  }

  return false;
}

void Vector_pskel::
_pre_a_validate ()
{
  this->v_state_attr_stack_.push ();
  v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());

  as.X = false;
  as.Y = false;
  as.Z = false;
}

void Vector_pskel::
_post_a_validate ()
{
  v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());

  if (!as.X)
  {
    this->_schema_error (::xsde::cxx::schema_error::expected_attribute);
    return;
  }

  if (!as.Y)
  {
    this->_schema_error (::xsde::cxx::schema_error::expected_attribute);
    return;
  }

  if (!as.Z)
  {
    this->_schema_error (::xsde::cxx::schema_error::expected_attribute);
    return;
  }


  this->v_state_attr_stack_.pop ();
}

// Attribute validation and dispatch functions for Color_pskel.
//
bool Color_pskel::
_attribute_impl_phase_one (const ::xsde::cxx::ro_string& ns,
                           const ::xsde::cxx::ro_string& n,
                           const ::xsde::cxx::ro_string& s)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  if (n == "R" && ns.empty ())
  {
    if (this->R_parser_)
    {
      this->R_parser_->pre ();

      this->R_parser_->_pre_impl (ctx);

      if (!ctx.error_type ())
        this->R_parser_->_characters (s);

      if (!ctx.error_type ())
        this->R_parser_->_post_impl ();

      if (!ctx.error_type ())
      {
        float tmp = this->R_parser_->post_float ();

        this->R (tmp);
      }
    }

    static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->R = true;
    return true;
  }

  if (n == "G" && ns.empty ())
  {
    if (this->G_parser_)
    {
      this->G_parser_->pre ();

      this->G_parser_->_pre_impl (ctx);

      if (!ctx.error_type ())
        this->G_parser_->_characters (s);

      if (!ctx.error_type ())
        this->G_parser_->_post_impl ();

      if (!ctx.error_type ())
      {
        float tmp = this->G_parser_->post_float ();

        this->G (tmp);
      }
    }

    static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->G = true;
    return true;
  }

  if (n == "B" && ns.empty ())
  {
    if (this->B_parser_)
    {
      this->B_parser_->pre ();

      this->B_parser_->_pre_impl (ctx);

      if (!ctx.error_type ())
        this->B_parser_->_characters (s);

      if (!ctx.error_type ())
        this->B_parser_->_post_impl ();

      if (!ctx.error_type ())
      {
        float tmp = this->B_parser_->post_float ();

        this->B (tmp);
      }
    }

    static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->B = true;
    return true;
  }

  return false;
}

void Color_pskel::
_pre_a_validate ()
{
  this->v_state_attr_stack_.push ();
  v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());

  as.R = false;
  as.G = false;
  as.B = false;
}

void Color_pskel::
_post_a_validate ()
{
  v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());

  if (!as.R)
  {
    this->_schema_error (::xsde::cxx::schema_error::expected_attribute);
    return;
  }

  if (!as.G)
  {
    this->_schema_error (::xsde::cxx::schema_error::expected_attribute);
    return;
  }

  if (!as.B)
  {
    this->_schema_error (::xsde::cxx::schema_error::expected_attribute);
    return;
  }


  this->v_state_attr_stack_.pop ();
}

// Attribute validation and dispatch functions for GroupType_pskel.
//
bool GroupType_pskel::
_attribute_impl_phase_one (const ::xsde::cxx::ro_string& ns,
                           const ::xsde::cxx::ro_string& n,
                           const ::xsde::cxx::ro_string& s)
{
  ::xsde::cxx::parser::context& ctx = this->_context ();

  if (n == "id" && ns.empty ())
  {
    if (this->id_parser_)
    {
      this->id_parser_->pre ();

      this->id_parser_->_pre_impl (ctx);

      if (!ctx.error_type ())
        this->id_parser_->_characters (s);

      if (!ctx.error_type ())
        this->id_parser_->_post_impl ();

      if (!ctx.error_type ())
      {
        const ::std::string& tmp = this->id_parser_->post_id ();

        this->id (tmp);
      }
    }

    static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ())->id = true;
    return true;
  }

  return false;
}

void GroupType_pskel::
_pre_a_validate ()
{
  this->v_state_attr_stack_.push ();
  v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());

  as.id = false;
}

void GroupType_pskel::
_post_a_validate ()
{
  v_state_attr_& as = *static_cast< v_state_attr_* > (this->v_state_attr_stack_.top ());

  if (!as.id)
  {
    this->_schema_error (::xsde::cxx::schema_error::expected_attribute);
    return;
  }


  this->v_state_attr_stack_.pop ();
}

// Begin epilogue.
//
//
// End epilogue.

