// 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::dom::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::dom::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 <istream>
#include <xercesc/framework/Wrapper4InputSource.hpp>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/exceptions.hxx>

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

  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;
  if (::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument > d = ::xsd::cxx::xml::dom::dom (u, &h))
  {
    r = hello (*d);
  }

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

  return r;
}

::std::auto_ptr< class hello >
hello (std::istream& is)
{
  ::xsd::cxx::xml::auto_initializer initializer;
  ::xsd::cxx::xml::sax::std_input_source isrc (is);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return hello (wrap);
}

::std::auto_ptr< class hello >
hello (std::istream& is, ::xercesc::DOMErrorHandler& h)
{
  ::xsd::cxx::xml::sax::std_input_source isrc (is);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return hello (wrap, h);
}

::std::auto_ptr< class hello >
hello (std::istream& is, ::std::basic_string< char > const& sid)
{
  ::xsd::cxx::xml::auto_initializer initializer;
  ::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return hello (wrap);
}

::std::auto_ptr< class hello >
hello (std::istream& is, ::std::basic_string< char > const& sid, ::xercesc::DOMErrorHandler& h)
{
  ::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return hello (wrap, h);
}

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

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

  return r;
}

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

  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::dom::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.

