KHtml

dom_xml.cpp
1 
23 #include "dom/dom_xml.h"
24 #include "dom/dom_exception.h"
25 #include "xml/dom_textimpl.h"
26 #include "xml/dom_xmlimpl.h"
27 
28 using namespace DOM;
29 
30 CDATASection::CDATASection()
31 {
32 }
33 
34 CDATASection::CDATASection(const CDATASection &) : Text()
35 {
36 }
37 
38 CDATASection &CDATASection::operator = (const Node &other)
39 {
40  NodeImpl *ohandle = other.handle();
41  if (impl != ohandle) {
42  if (!ohandle || ohandle->nodeType() != CDATA_SECTION_NODE) {
43  if (impl) {
44  impl->deref();
45  }
46  impl = nullptr;
47  } else {
48  Node::operator =(other);
49  }
50  }
51  return *this;
52 }
53 
54 CDATASection &CDATASection::operator = (const CDATASection &other)
55 {
56  Node::operator =(other);
57  return *this;
58 }
59 
60 CDATASection::~CDATASection()
61 {
62 }
63 
64 CDATASection::CDATASection(CDATASectionImpl *i) : Text(i)
65 {
66 }
67 
68 // ----------------------------------------------------------------------------
69 Entity::Entity()
70 {
71 }
72 
73 Entity::Entity(const Entity &) : Node()
74 {
75 }
76 
77 Entity &Entity::operator = (const Node &other)
78 {
79  NodeImpl *ohandle = other.handle();
80  if (impl != ohandle) {
81  if (!ohandle || ohandle->nodeType() != ENTITY_NODE) {
82  if (impl) {
83  impl->deref();
84  }
85  impl = nullptr;
86  } else {
87  Node::operator =(other);
88  }
89  }
90  return *this;
91 }
92 
93 Entity &Entity::operator = (const Entity &other)
94 {
95  Node::operator =(other);
96  return *this;
97 }
98 
99 Entity::~Entity()
100 {
101 }
102 
104 {
105  if (!impl) {
106  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
107  }
108 
109  return ((EntityImpl *)impl)->publicId();
110 }
111 
113 {
114  if (!impl) {
115  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
116  }
117 
118  return ((EntityImpl *)impl)->systemId();
119 }
120 
122 {
123  if (!impl) {
124  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
125  }
126 
127  return ((EntityImpl *)impl)->notationName();
128 }
129 
130 Entity::Entity(EntityImpl *i) : Node(i)
131 {
132 }
133 
134 // ----------------------------------------------------------------------------
135 
136 EntityReference::EntityReference()
137 {
138 }
139 
140 EntityReference::EntityReference(const EntityReference &) : Node()
141 {
142 }
143 
144 EntityReference &EntityReference::operator = (const Node &other)
145 {
146  NodeImpl *ohandle = other.handle();
147  if (impl != ohandle) {
148  if (!ohandle || ohandle->nodeType() != ENTITY_REFERENCE_NODE) {
149  if (impl) {
150  impl->deref();
151  }
152  impl = nullptr;
153  } else {
154  Node::operator =(other);
155  }
156  }
157  return *this;
158 }
159 
160 EntityReference &EntityReference::operator = (const EntityReference &other)
161 {
162  Node::operator =(other);
163  return *this;
164 }
165 
166 EntityReference::~EntityReference()
167 {
168 }
169 
170 EntityReference::EntityReference(EntityReferenceImpl *i) : Node(i)
171 {
172 }
173 
174 // ----------------------------------------------------------------------------
175 
176 Notation::Notation()
177 {
178 }
179 
180 Notation::Notation(const Notation &) : Node()
181 {
182 }
183 
184 Notation &Notation::operator = (const Node &other)
185 {
186  NodeImpl *ohandle = other.handle();
187  if (impl != ohandle) {
188  if (!ohandle || ohandle->nodeType() != NOTATION_NODE) {
189  if (impl) {
190  impl->deref();
191  }
192  impl = nullptr;
193  } else {
194  Node::operator =(other);
195  }
196  }
197  return *this;
198 }
199 
200 Notation &Notation::operator = (const Notation &other)
201 {
202  Node::operator =(other);
203  return *this;
204 }
205 
206 Notation::~Notation()
207 {
208 }
209 
211 {
212  if (!impl) {
213  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
214  }
215 
216  return ((NotationImpl *)impl)->publicId();
217 }
218 
220 {
221  if (!impl) {
222  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
223  }
224 
225  return ((NotationImpl *)impl)->systemId();
226 }
227 
228 Notation::Notation(NotationImpl *i) : Node(i)
229 {
230 }
231 
232 // ----------------------------------------------------------------------------
233 
234 ProcessingInstruction::ProcessingInstruction()
235 {
236 }
237 
238 ProcessingInstruction::ProcessingInstruction(const ProcessingInstruction &)
239  : Node()
240 {
241 }
242 
243 ProcessingInstruction &ProcessingInstruction::operator = (const Node &other)
244 {
245  NodeImpl *ohandle = other.handle();
246  if (impl != ohandle) {
247  if (!ohandle || ohandle->nodeType() != PROCESSING_INSTRUCTION_NODE) {
248  if (impl) {
249  impl->deref();
250  }
251  impl = nullptr;
252  } else {
253  Node::operator =(other);
254  }
255  }
256  return *this;
257 }
258 
259 ProcessingInstruction &ProcessingInstruction::operator = (const ProcessingInstruction &other)
260 {
261  Node::operator =(other);
262  return *this;
263 }
264 
265 ProcessingInstruction::~ProcessingInstruction()
266 {
267 }
268 
270 {
271  if (!impl) {
272  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
273  }
274 
275  return ((ProcessingInstructionImpl *)impl)->target();
276 }
277 
279 {
280  if (!impl) {
281  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
282  }
283 
284  return ((ProcessingInstructionImpl *)impl)->data();
285 }
286 
288 {
289  if (!impl) {
290  return; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
291  }
292 
293  int exceptioncode = 0;
294  ((ProcessingInstructionImpl *)impl)->setData(_data, exceptioncode);
295  if (exceptioncode) {
296  throw DOMException(exceptioncode);
297  }
298 }
299 
300 ProcessingInstruction::ProcessingInstruction(ProcessingInstructionImpl *i) : Node(i)
301 {
302 }
303 
305 {
306  if (impl) {
307  return ((ProcessingInstructionImpl *)impl)->sheet();
308  }
309  return nullptr;
310 }
311 
DOMString systemId() const
The system identifier associated with the entity, if specified.
Definition: dom_xml.cpp:112
The ProcessingInstruction interface represents a "processing instruction", used in XML as a way to ke...
Definition: dom_xml.h:264
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
DOMString notationName() const
For unparsed entities, the name of the notation for the entity.
Definition: dom_xml.cpp:121
DOMString target() const
The target of this processing instruction.
Definition: dom_xml.cpp:269
void setData(const DOMString &)
see data NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
Definition: dom_xml.cpp:287
DOMString data() const
The content of this processing instruction.
Definition: dom_xml.cpp:278
This interface represents an entity, either parsed or unparsed, in an XML document.
Definition: dom_xml.h:125
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
EntityReference objects may be inserted into the structure model when an entity reference is in the s...
Definition: dom_xml.h:190
DOMString publicId() const
The public identifier of this notation.
Definition: dom_xml.cpp:210
DOMString publicId() const
The public identifier associated with the entity, if specified.
Definition: dom_xml.cpp:103
The Text interface represents the textual content (termed character data in XML) of an Element or At...
Definition: dom_text.h:273
DOMString systemId() const
The system identifier of this notation.
Definition: dom_xml.cpp:219
StyleSheet sheet() const
Introduced in DOM Level 2 This method is from the LinkStyle interface.
Definition: dom_xml.cpp:304
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
CDATA sections are used to escape blocks of text containing characters that would otherwise be regard...
Definition: dom_xml.h:65
This library provides a full-featured HTML parser and widget.
The StyleSheet interface is the abstract base interface for any type of style sheet.
NodeImpl * handle() const
Definition: dom_node.h:936
This interface represents a notation declared in the DTD.
Definition: dom_xml.h:226
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 22:44:52 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.