dom_document.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "../api_core.h"
00035 #include "dom_node.h"
00036 #include <vector>
00037 
00038 class CL_IODevice;
00039 class CL_DomDocumentType;
00040 class CL_DomImplementation;
00041 class CL_DomCDATASection;
00042 class CL_DomProcessingInstruction;
00043 class CL_DomElement;
00044 class CL_DomDocumentFragment;
00045 class CL_DomComment;
00046 class CL_DomText;
00047 class CL_DomAttr;
00048 class CL_DomEntityReference;
00049 class CL_DomNodeList;
00050 class CL_DomDocument_Generic;
00051 
00063 class CL_API_CORE CL_DomDocument : public CL_DomNode
00064 {
00067 
00068 public:
00070         CL_DomDocument();
00071 
00076         CL_DomDocument(CL_IODevice &input, bool eat_whitespace = true);
00077 
00078         CL_DomDocument(
00079                 const CL_DomString &namespace_uri,
00080                 const CL_DomString &qualified_name,
00081                 const CL_DomDocumentType &doctype);
00082 
00086         CL_DomDocument(const CL_SharedPtr<CL_DomNode_Generic> &impl);
00087 
00088         ~CL_DomDocument();
00089 
00093 
00094 public:
00096 
00099         CL_DomDocumentType get_doctype();
00100 
00102         CL_DomImplementation get_implementation();
00103 
00105 
00107         CL_DomElement get_document_element();
00108 
00112 
00113 public:
00115 
00118         CL_DomElement create_element(const CL_DomString &tag_name);
00119 
00121         CL_DomElement create_element_ns(
00122                 const CL_DomString &namespace_uri,
00123                 const CL_DomString &qualified_name);
00124 
00126         CL_DomDocumentFragment create_document_fragment();
00127 
00131         CL_DomText create_text_node(const CL_DomString &data);
00132 
00136         CL_DomComment create_comment(const CL_DomString &data);
00137 
00141         CL_DomCDATASection create_cdata_section(const CL_DomString &data);
00142 
00147         CL_DomProcessingInstruction create_processing_instruction(
00148                 const CL_DomString &target,
00149                 const CL_DomString &data);
00150 
00152 
00154         CL_DomAttr create_attribute(const CL_DomString &name);
00155 
00157 
00158         CL_DomAttr create_attribute_ns(
00159                 const CL_DomString &namespace_uri,
00160                 const CL_DomString &qualified_name);
00161 
00165         CL_DomEntityReference create_entity_reference(const CL_DomString &name);
00166 
00168 
00171         CL_DomNodeList get_elements_by_tag_name(const CL_DomString &tag_name);
00172 
00174 
00176         CL_DomNodeList get_elements_by_tag_name_ns(
00177                 const CL_DomString &namespace_uri,
00178                 const CL_DomString &qualified_name);
00179 
00181         CL_DomElement get_element_by_id(const CL_DomString &element_id);
00182 
00184 
00193         CL_DomNode import_node(
00194                 const CL_DomNode &node,
00195                 bool deep);
00196 
00203         std::vector<CL_DomNode> load(
00204                 CL_IODevice &input,
00205                 bool eat_whitespace = true,
00206                 CL_DomNode insert_point = CL_DomNode());
00207 
00212         void save(CL_IODevice &output, bool insert_whitespace = true);
00213 
00215         void clear_all();
00216 
00220 
00221 private:
00223 };
00224