//
// DocumentType.h
//
// $Id: //poco/1.4/XML/include/Poco/DOM/DocumentType.h#1 $
//
// Library: XML
// Package: DOM
// Module:  DOM
//
// Definition of the DOM DocumentType class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
// 
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//


#ifndef DOM_DocumentType_INCLUDED
#define DOM_DocumentType_INCLUDED


#include "Poco/XML/XML.h"
#include "Poco/DOM/AbstractContainerNode.h"


namespace Poco {
namespace XML {


class NamedNodeMap;


class XML_API DocumentType: public AbstractContainerNode
	/// Each Document has a doctype attribute whose value is either null or a DocumentType
	/// object. The DocumentType interface in the DOM Level 1 Core provides an
	/// interface to the list of entities that are defined for the document, and
	/// little else because the effect of namespaces and the various XML scheme
	/// efforts on DTD representation are not clearly understood as of this writing.
	/// 
	/// The DOM Level 1 doesn't support editing DocumentType nodes.
{
public:
	const XMLString& name() const;
		/// The name of the DTD; i.e., the name immediately following the 
		/// DOCTYPE keyword.

	NamedNodeMap* entities() const;
		/// A NamedNodeMap containing the general entities,
		/// both external and internal, declared in the DTD.
		/// Duplicates are discarded.
		///
		/// Note: In this implementation, only the
		/// external entities are reported.
		/// Every node in this map also implements the
		/// Entity interface.
		/// 
		/// The returned NamedNodeMap must be released with a call
		/// to release() when no longer needed.

	NamedNodeMap* notations() const;
		/// A NamedNodeMap containing the notations declared in the DTD. Duplicates
		/// are discarded. Every node in this map also implements the Notation interface.
		/// The DOM Level 1 does not support editing notations, therefore notations
		/// cannot be altered in any way.
		/// 
		/// The returned NamedNodeMap must be released with a call
		/// to release() when no longer needed.

	// DOM Level 2
	const XMLString& publicId() const;
		/// Returns the public identifier of the external DTD subset.

	const XMLString& systemId() const;
		/// Returns the system identifier of the external DTD subset.

	const XMLString& internalSubset() const;
		/// Returns the internal DTD subset. This implementation
		/// returns an empty string.

	// Node
	const XMLString& nodeName() const;
	unsigned short nodeType() const;

protected:
	DocumentType(Document* pOwner, const XMLString& name, const XMLString& publicId, const XMLString& systemId);
	DocumentType(Document* pOwner, const DocumentType& dt);
	~DocumentType();

	Node* copyNode(bool deep, Document* pOwnerDocument) const;

private:
	XMLString _name;
	XMLString _publicId;
	XMLString _systemId;
	
	friend class DOMImplementation;
	friend class Document;
	friend class DOMBuilder;
};


//
// inlines
//
inline const XMLString& DocumentType::name() const
{
	return _name;
}


inline const XMLString& DocumentType::publicId() const
{
	return _publicId;
}


inline const XMLString& DocumentType::systemId() const
{
	return _systemId;
}


} } // namespace Poco::XML


#endif // DOM_DocumentType_INCLUDED
