// Copyright (C) 2005 Code Synthesis Tools CC
//
// This program was generated by XML Schema Definition Compiler (XSD)
//
// 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
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// In addition, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//

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

#include <xsd/cxx/pre.hxx>

#include "hello.hxx"

// hello
// 

hello::
hello (_xsd_greeting::type const& _xsd_greeting)
: _xsd_hello::base (),
greeting ( _xsd_greeting, this),
name (this)
{
}

hello::
hello (class hello const& _xsd_hello)
: _xsd_hello::base (_xsd_hello ),
greeting (_xsd_hello.greeting, this),
name (_xsd_hello.name, this)
{
}


#include <xsd/cxx/parser.hxx>

// hello
//

hello::
hello (::xsd::cxx::xml::element< char > const& e)
: _xsd_hello::base (_xsd_hello::traits::create (e)),
greeting (this),
name (this)
{

  ::xsd::cxx::parser< char > p (e);

  while (p.more_elements ())
  {
    ::xsd::cxx::xml::element< char > e (p.next_element ());
    ::std::basic_string< char > n (::xsd::cxx::xml::uq_name (e.name ()));

    if (n == "greeting")
    {
      greeting (_xsd_greeting::traits::create (e));
    }

    else if (n == "name")
    {
      name ().push_back (_xsd_name::traits::create (e));
    }

    else 
    {
      throw ::xsd::cxx::tree::unexpected_element < char > (n, "");
    }
  }
}

#include <xsd/cxx/tree/exceptions.hxx>

::std::auto_ptr< class hello >
hello (::std::basic_string< char > const& u)
{
  ::std::auto_ptr< class hello > r;
  ::xsd::cxx::xml::initialize ();
  if (::xsd::cxx::xml::auto_ptr< ::xercesc::DOMDocument > d = ::xsd::cxx::xml::dom (u, 0))
  {
    r = hello (*d);
  }

  ::xsd::cxx::xml::terminate ();
  if (r.get () == 0)
  {
    throw ::xsd::cxx::tree::invalid_instance ();
  }

  return r;
}

::std::auto_ptr< class hello >
hello (::std::basic_string< char > const& u, ::xercesc::DOMErrorHandler& h)
{
  ::std::auto_ptr< class hello > r;
  ::xsd::cxx::xml::initialize ();
  if (::xsd::cxx::xml::auto_ptr< ::xercesc::DOMDocument > d = ::xsd::cxx::xml::dom (u, &h))
  {
    r = hello (*d);
  }

  ::xsd::cxx::xml::terminate ();
  if (r.get () == 0)
  {
    throw ::xsd::cxx::tree::invalid_instance ();
  }

  return r;
}

::std::auto_ptr< class hello >
hello (::xercesc::DOMInputSource& i)
{
  ::std::auto_ptr< class hello > r;
  ::xsd::cxx::xml::initialize ();
  if (::xsd::cxx::xml::auto_ptr< ::xercesc::DOMDocument > d = ::xsd::cxx::xml::dom< char > (i, 0))
  {
    r = hello (*d);
  }

  ::xsd::cxx::xml::terminate ();
  if (r.get () == 0)
  {
    throw ::xsd::cxx::tree::invalid_instance ();
  }

  return r;
}

::std::auto_ptr< class hello >
hello (::xercesc::DOMInputSource& i, ::xercesc::DOMErrorHandler& h)
{
  ::std::auto_ptr< class hello > r;
  ::xsd::cxx::xml::initialize ();
  if (::xsd::cxx::xml::auto_ptr< ::xercesc::DOMDocument > d = ::xsd::cxx::xml::dom< char > (i, &h))
  {
    r = hello (*d);
  }

  ::xsd::cxx::xml::terminate ();
  if (r.get () == 0)
  {
    throw ::xsd::cxx::tree::invalid_instance ();
  }

  return r;
}

::std::auto_ptr< class hello >
hello (::xercesc::DOMDocument const& d)
{
  ::xsd::cxx::xml::element< char > e (d.getDocumentElement ());
  if (e.name () == "hello")
  {
    return ::std::auto_ptr< class hello > (new class hello (::xsd::cxx::tree::traits< class hello >::create (e)));
  }

  else
  {
    throw ::xsd::cxx::tree::unexpected_element < char > (e.name (), "hello");
  }
}

#include <xsd/cxx/post.hxx>

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

