// 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_type
// 

// hello_type::greeting
// 

hello_type::_xsd_greeting::type_ const& hello_type::
greeting () const
{
  return this->_xsd_greeting_ ();
}

hello_type::_xsd_greeting::type_& hello_type::
greeting ()
{
  return this->_xsd_greeting_ ();
}

void hello_type::
greeting (_xsd_greeting::type_ const& greeting)
{
  this->_xsd_greeting_ (greeting);
}

void hello_type::
greeting (::std::auto_ptr< _xsd_greeting::type_ > greeting)
{
  this->_xsd_greeting_ (greeting);
}

// hello_type::name
// 

hello_type::_xsd_name::container_ const& hello_type::
name () const
{
  return this->_xsd_name_ ();
}

hello_type::_xsd_name::container_& hello_type::
name ()
{
  return this->_xsd_name_ ();
}

void hello_type::
name (_xsd_name::container_ const& name)
{
  this->_xsd_name_ (name);
}

hello_type::
hello_type (_xsd_greeting::type_ const& _xsd_greeting)
: _xsd_hello_type::base_ (),
_xsd_greeting_ ( _xsd_greeting,
                ::xsd::cxx::tree::flags::not_root,
                this),
_xsd_name_ (::xsd::cxx::tree::flags::not_root, this)
{
}

hello_type::
hello_type (class hello_type const&
            _xsd_hello_type,
            ::xsd::cxx::tree::flags f,
            ::xsd::cxx::tree::type* c)
: _xsd_hello_type::base_ (_xsd_hello_type, f, c),
_xsd_greeting_ (_xsd_hello_type._xsd_greeting_,
                f | ::xsd::cxx::tree::flags::not_root,
                this),
_xsd_name_ (_xsd_hello_type._xsd_name_,
            f | ::xsd::cxx::tree::flags::not_root,
            this)
{
}


#include <xsd/cxx/parser.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>

namespace _xsd
{
  static
  ::xsd::cxx::tree::type_factory_plate< 0, char >
  type_factory_plate_init;
}

// hello_type
//

hello_type::
hello_type (::xsd::cxx::xml::dom::element< char > const& e,
            ::xsd::cxx::tree::flags f,
            ::xsd::cxx::tree::type* c)
: _xsd_hello_type::base_ (e, f, c),
_xsd_greeting_ (f | ::xsd::cxx::tree::flags::not_root, this),
_xsd_name_ (f | ::xsd::cxx::tree::flags::not_root, this)
{

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

  while (p.more_elements ())
  {
    ::xsd::cxx::xml::dom::element< char > e (p.next_element ());

    // greeting
    //
    {
      ::std::auto_ptr< _xsd_greeting::type_ > r (
        ::xsd::cxx::tree::type_factory_map_instance< 0, char > ().
        create< _xsd_greeting::type_ > (
          "greeting",
          "",
          false,
          false,
          e,
          f | ::xsd::cxx::tree::flags::not_root,
          this));

      if (r.get () != 0)
      {
        if (_xsd_greeting_._present ())
        {
          throw ::xsd::cxx::tree::unexpected_element< char > (
            e.name (), e.namespace_ (),
            "", "");
        }

        this->greeting (r);
        continue;
      }
    }

    // name
    //
    {
      ::std::auto_ptr< _xsd_name::type_ > r (
        ::xsd::cxx::tree::type_factory_map_instance< 0, char > ().
        create< _xsd_name::type_ > (
          "name",
          "",
          false,
          false,
          e,
          f | ::xsd::cxx::tree::flags::not_root,
          this));

      if (r.get () != 0)
      {
        this->name ().push_back (r);
        continue;
      }
    }
  }

  if (!_xsd_greeting_._present ())
  {
    throw ::xsd::cxx::tree::expected_element< char > ("greeting", "");
  }
}

::_xsd_hello_type::type* hello_type::
_clone (::xsd::cxx::tree::flags f,
        ::xsd::cxx::tree::type* c) const
{
  return new class hello_type (*this, f, c);
}

static
::xsd::cxx::tree::type_factory_initializer< 0, char, ::_xsd_hello_type::type >
_xsd_hello_type_type_factory_init (
  "hello_type ");


#include <istream>
#include <xercesc/framework/Wrapper4InputSource.hpp>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/error-handler.hxx>

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::basic_string< char > const& u,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::auto_initializer i (
    (f & ::xsd::cxx::tree::flags::dont_initialize) == 0,
    (f & ::xsd::cxx::tree::flags::keep_dom) == 0);

  ::xsd::cxx::tree::error_handler< char > h;

  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument const > d (
    ::xsd::cxx::xml::dom::dom< char > (
      u, h, p, (f & ::xsd::cxx::tree::flags::dont_validate) == 0));

  h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();

  return ::hello (*d, f);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::basic_string< char > const& u,
       ::xsd::cxx::xml::dom::error_handler< char >& h,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument const > d (
    ::xsd::cxx::xml::dom::dom< char > (
      u, h, p, (f & ::xsd::cxx::tree::flags::dont_validate) == 0));

  if (!d)
  {
    throw ::xsd::cxx::tree::parsing< char > ();
  }

  return ::hello (*d, f);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::basic_string< char > const& u,
       ::xercesc::DOMErrorHandler& h,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument const > d (
    ::xsd::cxx::xml::dom::dom< char > (
      u, h, p, (f & ::xsd::cxx::tree::flags::dont_validate) == 0));

  if (!d)
  {
    throw ::xsd::cxx::tree::parsing< char > ();
  }

  return ::hello (*d, f);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::istream& is,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::auto_initializer i (
    (f & ::xsd::cxx::tree::flags::dont_initialize) == 0,
    (f & ::xsd::cxx::tree::flags::keep_dom) == 0);

  ::xsd::cxx::xml::sax::std_input_source isrc (is);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return ::hello (wrap, f, p);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::istream& is,
       ::xsd::cxx::xml::dom::error_handler< char >& h,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::sax::std_input_source isrc (is);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return ::hello (wrap, h, f, p);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::istream& is,
       ::xercesc::DOMErrorHandler& h,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::sax::std_input_source isrc (is);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return ::hello (wrap, h, f, p);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::istream& is,
       ::std::basic_string< char > const& sid,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::auto_initializer i (
    (f & ::xsd::cxx::tree::flags::dont_initialize) == 0,
    (f & ::xsd::cxx::tree::flags::keep_dom) == 0);

  ::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return ::hello (wrap, f, p);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::std::istream& is,
       ::std::basic_string< char > const& sid,
       ::xsd::cxx::xml::dom::error_handler< char >& h,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
  xercesc::Wrapper4InputSource wrap (&isrc, false);
  return ::hello (wrap, h, f, p);
}

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

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::xercesc::DOMInputSource const& i,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::tree::error_handler< char > h;

  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument const > d (
    ::xsd::cxx::xml::dom::dom< char > (
      i, h, p, (f & ::xsd::cxx::tree::flags::dont_validate) == 0));

  h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();

  return ::hello (*d, f, p);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::xercesc::DOMInputSource const& i,
       ::xsd::cxx::xml::dom::error_handler< char >& h,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument const > d (
    ::xsd::cxx::xml::dom::dom< char > (
      i, h, p, (f & ::xsd::cxx::tree::flags::dont_validate) == 0));

  if (!d)
  {
    throw ::xsd::cxx::tree::parsing< char > ();
  }

  return ::hello (*d, f, p);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::xercesc::DOMInputSource const& i,
       ::xercesc::DOMErrorHandler& h,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const& p)
{
  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument const > d (
    ::xsd::cxx::xml::dom::dom< char > (
      i, h, p, (f & ::xsd::cxx::tree::flags::dont_validate) == 0));

  if (!d)
  {
    throw ::xsd::cxx::tree::parsing< char > ();
  }

  return ::hello (*d, f, p);
}

::std::auto_ptr< ::_xsd_hello_type::type >
hello (::xercesc::DOMDocument const& d,
       ::xsd::cxx::tree::flags f,
       ::xsd::cxx::tree::properties< char > const&)
{
  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument > c (
    (f & ::xsd::cxx::tree::flags::keep_dom) 
    ? dynamic_cast< ::xercesc::DOMDocument* > (d.cloneNode (true))
    : 0);

  ::xsd::cxx::xml::dom::element< char > e (
    c.get () ? c->getDocumentElement () : d.getDocumentElement ());

  ::std::auto_ptr< ::_xsd_hello_type::type > r (
    ::xsd::cxx::tree::type_factory_map_instance< 0, char > ().
    create< ::_xsd_hello_type::type > (
      "hello",
      "",
      true,
      true,
      e,
      f,
      0));

  if (r.get () != 0)
  {
    if (f & ::xsd::cxx::tree::flags::keep_dom) c.release ();
    return r;
  }

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

#include <xsd/cxx/post.hxx>

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

