// 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::
hello_type (_xsd_greeting::type_ const&_xsd_greeting)
: _xsd_hello_type::base_ (),
greeting ( _xsd_greeting, ::xsd::cxx::tree::flags::not_root, this),
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),
greeting (_xsd_hello_type.greeting, f | ::xsd::cxx::tree::flags::not_root, this),
name (_xsd_hello_type.name, f | ::xsd::cxx::tree::flags::not_root, this)
{
}


#include <xsd/cxx/parser.hxx>

// 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),
greeting (f | ::xsd::cxx::tree::flags::not_root, this),
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 ());

    if (e.name () == "greeting" && e.namespace_ ().empty ())
    {
      greeting (_xsd_greeting::traits_::create (e, f | ::xsd::cxx::tree::flags::not_root, this));
    }

    else if (e.name () == "name" && e.namespace_ ().empty ())
    {
      name ().push_back (_xsd_name::traits_::create (e, f | ::xsd::cxx::tree::flags::not_root, this));
    }

    else 
    {
    }
  }
}

#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_type >
hello (::std::basic_string< char > const& u, ::xsd::cxx::tree::flags f)
{
  ::xsd::cxx::xml::auto_initializer i ((f & ::xsd::cxx::tree::flags::dont_initialize) == 0,
  (f & ::xsd::cxx::tree::flags::keep_dom) == 0);

  ::std::auto_ptr< class ::hello_type > r;
  ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument const > d (::xsd::cxx::xml::dom::dom (u, 0, (f & ::xsd::cxx::tree::flags::dont_validate) == 0));
  if (d)
  {
    r = hello (*d, f);
  }

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

  return r;
}

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

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

  return r;
}

::std::auto_ptr< class ::hello_type >
hello (std::istream& is, ::xsd::cxx::tree::flags f)
{
  ::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);
}

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

::std::auto_ptr< class ::hello_type >
hello (std::istream& is, ::std::basic_string< char > const& sid, ::xsd::cxx::tree::flags f)
{
  ::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);
}

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

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

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

  return r;
}

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

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

  return r;
}

::std::auto_ptr< class ::hello_type >
hello (::xercesc::DOMDocument const& d, ::xsd::cxx::tree::flags f)
{
  ::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 ());

  if (e.name () == "hello" && e.namespace_ () == "")
  {
    ::std::auto_ptr< class ::hello_type > r (::xsd::cxx::tree::traits< class ::hello_type >::create (e, f, 0));
    if (f & ::xsd::cxx::tree::flags::keep_dom) c.release ();
    return r;
  }

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

#include <xsd/cxx/post.hxx>

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

