dom_document.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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
29
30#pragma once
31
32#include "dom_node.h"
33#include <vector>
34
35namespace clan
36{
39
40 class IODevice;
41 class DomDocumentType;
43 class DomCDATASection;
45 class DomElement;
47 class DomComment;
48 class DomText;
49 class DomAttr;
51 class DomNodeList;
52 class DomDocument_Impl;
53
64 class DomDocument : public DomNode
65 {
66 public:
69
74 DomDocument(IODevice &input, bool eat_whitespace = true);
75
77 const DomString &namespace_uri,
78 const DomString &qualified_name,
79 const DomDocumentType &doctype);
80
84 DomDocument(const std::shared_ptr<DomNode_Impl> &impl);
85
87
89
93
96
98
101
103
107
110 const DomString &namespace_uri,
111 const DomString &qualified_name);
112
115
120
125
130
136 const DomString &target,
137 const DomString &data);
138
140
143
145
147 const DomString &namespace_uri,
148 const DomString &qualified_name);
149
154
156
160
162
165 const DomString &namespace_uri,
166 const DomString &qualified_name);
167
170
172
182 const DomNode &node,
183 bool deep);
184
191 std::vector<DomNode> load(
192 IODevice &input,
193 bool eat_whitespace = true,
194 DomNode insert_point = DomNode());
195
200 void save(IODevice &output, bool insert_whitespace = true);
201
203 void clear_all();
204 };
205
207}
DOM Attribute class.
Definition dom_attr.h:67
DOM CDATA Section.
Definition dom_cdata_section.h:55
DOM Comment class.
Definition dom_comment.h:45
DOM Document Fragment class.
Definition dom_document_fragment.h:71
DOM Document Type class.
Definition dom_document_type.h:51
DomDocumentFragment create_document_fragment()
Creates an empty DocumentFragment object.
DomImplementation get_implementation()
Returns the DomImplementation object that handles this document.
DomElement create_element(const DomString &tag_name)
Creates an element of the type specified.
std::vector< DomNode > load(IODevice &input, bool eat_whitespace=true, DomNode insert_point=DomNode())
Loads the DOM document as XML from an input source.
DomDocument(const std::shared_ptr< DomNode_Impl > &impl)
Constructs a DomDocument.
DomDocument()
Constructs a DOM Document.
DomCDATASection create_cdata_section(const DomString &data)
Creates a CDATASection node whose value is the specified string.
DomComment create_comment(const DomString &data)
Creates a Comment node given the specified string.
DomDocumentType get_doctype()
Returns the Document Type Declaration (see DomDocumentType)associated with this document.
DomDocument(const DomString &namespace_uri, const DomString &qualified_name, const DomDocumentType &doctype)
DomEntityReference create_entity_reference(const DomString &name)
Creates an EntityReference object.
DomAttr create_attribute_ns(const DomString &namespace_uri, const DomString &qualified_name)
Creates an attribute of the given qualified name and namespace URI.
void save(IODevice &output, bool insert_whitespace=true)
Saves the DOM document as XML to an input source.
DomDocument(IODevice &input, bool eat_whitespace=true)
Constructs a DomDocument.
DomElement create_element_ns(const DomString &namespace_uri, const DomString &qualified_name)
Creates an element of the given qualified name and namespace URI.
void clear_all()
Removes all nodes from the DOM document.
DomNodeList get_elements_by_tag_name(const DomString &tag_name)
Returns a NodeList of all the Elements with a given tag name.
DomAttr create_attribute(const DomString &name)
Creates an Attr of the given name.
DomNodeList get_elements_by_tag_name_ns(const DomString &namespace_uri, const DomString &qualified_name)
Returns a NodeList of all the Elements with a given local name and namespace URI.
DomElement get_element_by_id(const DomString &element_id)
Returns the Element whose ID is given by element_id.
DomProcessingInstruction create_processing_instruction(const DomString &target, const DomString &data)
Creates a ProcessingInstruction node given the specified name and data strings.
DomNode import_node(const DomNode &node, bool deep)
Imports a node from another document to this document.
DomText create_text_node(const DomString &data)
Creates a Text node given the specified string.
DomElement get_document_element()
Returns the root document element node.
DOM Element class.
Definition dom_element.h:60
DOM Entity Reference class.
Definition dom_entity_reference.h:52
DOM Implementation class.
Definition dom_implementation.h:49
DOM Node List class.
Definition dom_node_list.h:51
std::shared_ptr< DomNode_Impl > impl
Definition dom_node.h:396
DOM Processing Instruction class.
Definition dom_processing_instruction.h:44
DOM Text class.
Definition dom_text.h:55
I/O Device interface.
Definition iodevice.h:50
std::string DomString
Definition dom_string.h:37
Definition clanapp.h:36