ClanLib  2.3.7
dom_document.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_core.h"
35 #include "dom_node.h"
36 #include <vector>
37 
38 class CL_IODevice;
39 class CL_DomDocumentType;
41 class CL_DomCDATASection;
43 class CL_DomElement;
45 class CL_DomComment;
46 class CL_DomText;
47 class CL_DomAttr;
49 class CL_DomNodeList;
50 class CL_DomDocument_Generic;
51 
64 {
67 
68 public:
71 
76  CL_DomDocument(CL_IODevice &input, bool eat_whitespace = true);
77 
79  const CL_DomString &namespace_uri,
80  const CL_DomString &qualified_name,
81  const CL_DomDocumentType &doctype);
82 
86  CL_DomDocument(const CL_SharedPtr<CL_DomNode_Generic> &impl);
87 
88  ~CL_DomDocument();
89 
93 
94 public:
96 
99  CL_DomDocumentType get_doctype();
100 
102  CL_DomImplementation get_implementation();
103 
105 
107  CL_DomElement get_document_element();
108 
112 
113 public:
115 
118  CL_DomElement create_element(const CL_DomString &tag_name);
119 
121  CL_DomElement create_element_ns(
122  const CL_DomString &namespace_uri,
123  const CL_DomString &qualified_name);
124 
126  CL_DomDocumentFragment create_document_fragment();
127 
131  CL_DomText create_text_node(const CL_DomString &data);
132 
136  CL_DomComment create_comment(const CL_DomString &data);
137 
141  CL_DomCDATASection create_cdata_section(const CL_DomString &data);
142 
147  CL_DomProcessingInstruction create_processing_instruction(
148  const CL_DomString &target,
149  const CL_DomString &data);
150 
152 
154  CL_DomAttr create_attribute(const CL_DomString &name);
155 
157 
158  CL_DomAttr create_attribute_ns(
159  const CL_DomString &namespace_uri,
160  const CL_DomString &qualified_name);
161 
165  CL_DomEntityReference create_entity_reference(const CL_DomString &name);
166 
168 
171  CL_DomNodeList get_elements_by_tag_name(const CL_DomString &tag_name);
172 
174 
176  CL_DomNodeList get_elements_by_tag_name_ns(
177  const CL_DomString &namespace_uri,
178  const CL_DomString &qualified_name);
179 
181  CL_DomElement get_element_by_id(const CL_DomString &element_id);
182 
184 
193  CL_DomNode import_node(
194  const CL_DomNode &node,
195  bool deep);
196 
203  std::vector<CL_DomNode> load(
204  CL_IODevice &input,
205  bool eat_whitespace = true,
206  CL_DomNode insert_point = CL_DomNode());
207 
212  void save(CL_IODevice &output, bool insert_whitespace = true);
213 
215  void clear_all();
216 
220 
221 private:
223 };
224