KHtml

dom_xml.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * This file includes excerpts from the Document Object Model (DOM)
22  * Level 1 Specification (Recommendation)
23  * https://www.w3.org/TR/REC-DOM-Level-1/
24  * Copyright © World Wide Web Consortium , (Massachusetts Institute of
25  * Technology , Institut National de Recherche en Informatique et en
26  * Automatique , Keio University ). All Rights Reserved.
27  *
28  */
29 #ifndef _DOM_XML_h
30 #define _DOM_XML_h
31 
32 #include <dom/dom_text.h>
33 #include <dom/css_stylesheet.h>
34 
35 namespace DOM
36 {
37 
38 class CDATASectionImpl;
39 class EntityImpl;
40 class EntityReferenceImpl;
41 class NotationImpl;
42 class ProcessingInstructionImpl;
43 
44 /**
45  * CDATA sections are used to escape blocks of text containing
46  * characters that would otherwise be regarded as markup. The only
47  * delimiter that is recognized in a CDATA section is the "]]&gt;"
48  * string that ends the CDATA section. CDATA sections can not be
49  * nested. The primary purpose is for including material such as XML
50  * fragments, without needing to escape all the delimiters.
51  *
52  * The \c DOMString attribute of the \c Text
53  * node holds the text that is contained by the CDATA section. Note
54  * that this may contain characters that need to be escaped outside of
55  * CDATA sections and that, depending on the character encoding
56  * ("charset") chosen for serialization, it may be impossible to write
57  * out some characters as part of a CDATA section.
58  *
59  * The \c CDATASection interface inherits the
60  * \c CharacterData interface through the \c Text
61  * interface. Adjacent \c CDATASections nodes are not
62  * merged by use of the Element.normalize() method.
63  *
64  */
65 class KHTML_EXPORT CDATASection : public Text
66 {
67  friend class Document;
68 public:
69  CDATASection();
70  CDATASection(const CDATASection &other);
71  CDATASection(const Node &other) : Text()
72  {
73  (*this) = other;
74  }
75 
76  CDATASection &operator = (const Node &other);
77  CDATASection &operator = (const CDATASection &other);
78 
79  ~CDATASection();
80 protected:
81  CDATASection(CDATASectionImpl *i);
82 };
83 
84 class DOMString;
85 
86 /**
87  * This interface represents an entity, either parsed or unparsed, in
88  * an XML document. Note that this models the entity itself not the
89  * entity declaration. \c Entity declaration modeling has
90  * been left for a later Level of the DOM specification.
91  *
92  * The \c nodeName attribute that is inherited from
93  * \c Node contains the name of the entity.
94  *
95  * An XML processor may choose to completely expand entities before
96  * the structure model is passed to the DOM; in this case there will
97  * be no \c EntityReference nodes in the document tree.
98  *
99  * XML does not mandate that a non-validating XML processor read and
100  * process entity declarations made in the external subset or declared
101  * in external parameter entities. This means that parsed entities
102  * declared in the external subset need not be expanded by some
103  * classes of applications, and that the replacement value of the
104  * entity may not be available. When the replacement value is
105  * available, the corresponding \c Entity node's child
106  * list represents the structure of that replacement text. Otherwise,
107  * the child list is empty.
108  *
109  * The resolution of the children of the \c Entity (the
110  * replacement value) may be lazily evaluated; actions by the user
111  * (such as calling the \c childNodes method on the
112  * \c Entity Node) are assumed to trigger the evaluation.
113  *
114  * The DOM Level 1 does not support editing \c Entity
115  * nodes; if a user wants to make changes to the contents of an
116  * \c Entity , every related \c EntityReference node
117  * has to be replaced in the structure model by a clone of the
118  * \c Entity 's contents, and then the desired changes must be
119  * made to each of those clones instead. All the descendants of an
120  * \c Entity node are readonly.
121  *
122  * An \c Entity node does not have any parent.
123  *
124  */
125 class KHTML_EXPORT Entity : public Node
126 {
127 public:
128  Entity();
129  Entity(const Entity &other);
130  Entity(const Node &other) : Node()
131  {
132  (*this) = other;
133  }
134 
135  Entity &operator = (const Node &other);
136  Entity &operator = (const Entity &other);
137 
138  ~Entity();
139 
140  /**
141  * The public identifier associated with the entity, if specified.
142  * If the public identifier was not specified, this is \c null .
143  *
144  */
145  DOMString publicId() const;
146 
147  /**
148  * The system identifier associated with the entity, if specified.
149  * If the system identifier was not specified, this is \c null .
150  *
151  */
152  DOMString systemId() const;
153 
154  /**
155  * For unparsed entities, the name of the notation for the entity.
156  * For parsed entities, this is \c null .
157  *
158  */
159  DOMString notationName() const;
160 protected:
161  Entity(EntityImpl *i);
162 };
163 
164 /**
165  * \c EntityReference objects may be inserted into the
166  * structure model when an entity reference is in the source document,
167  * or when the user wishes to insert an entity reference. Note that
168  * character references and references to predefined entities are
169  * considered to be expanded by the HTML or XML processor so that
170  * characters are represented by their Unicode equivalent rather than
171  * by an entity reference. Moreover, the XML processor may completely
172  * expand references to entities while building the structure model,
173  * instead of providing \c EntityReference objects. If it
174  * does provide such objects, then for a given \c EntityReference
175  * node, it may be that there is no \c Entity node
176  * representing the referenced entity; but if such an \c Entity
177  * exists, then the child list of the \c EntityReference
178  * node is the same as that of the \c Entity node.
179  * As with the \c Entity node, all descendants of the
180  * \c EntityReference are readonly.
181  *
182  * The resolution of the children of the \c EntityReference
183  * (the replacement value of the referenced \c Entity
184  * ) may be lazily evaluated; actions by the user (such as
185  * calling the \c childNodes method on the
186  * \c EntityReference node) are assumed to trigger the
187  * evaluation.
188  *
189  */
190 class KHTML_EXPORT EntityReference : public Node
191 {
192  friend class Document;
193 public:
194  EntityReference();
195  EntityReference(const EntityReference &other);
196  EntityReference(const Node &other) : Node()
197  {
198  (*this) = other;
199  }
200 
201  EntityReference &operator = (const Node &other);
202  EntityReference &operator = (const EntityReference &other);
203 
204  ~EntityReference();
205 protected:
206  EntityReference(EntityReferenceImpl *i);
207 };
208 
209 class DOMString;
210 
211 /**
212  * This interface represents a notation declared in the DTD. A
213  * notation either declares, by name, the format of an unparsed entity
214  * (see section 4.7 of the XML 1.0 specification), or is used for
215  * formal declaration of Processing Instruction targets (see section
216  * 2.6 of the XML 1.0 specification). The \c nodeName
217  * attribute inherited from \c Node is set to the declared
218  * name of the notation.
219  *
220  * The DOM Level 1 does not support editing \c Notation
221  * nodes; they are therefore readonly.
222  *
223  * A \c Notation node does not have any parent.
224  *
225  */
226 class KHTML_EXPORT Notation : public Node
227 {
228 public:
229  Notation();
230  Notation(const Notation &other);
231  Notation(const Node &other) : Node()
232  {
233  (*this) = other;
234  }
235 
236  Notation &operator = (const Node &other);
237  Notation &operator = (const Notation &other);
238 
239  ~Notation();
240 
241  /**
242  * The public identifier of this notation. If the public
243  * identifier was not specified, this is \c null .
244  *
245  */
246  DOMString publicId() const;
247 
248  /**
249  * The system identifier of this notation. If the system
250  * identifier was not specified, this is \c null .
251  *
252  */
253  DOMString systemId() const;
254 protected:
255  Notation(NotationImpl *i);
256 };
257 
258 /**
259  * The \c ProcessingInstruction interface represents a
260  * &quot;processing instruction&quot;, used in XML as a way to keep
261  * processor-specific information in the text of the document.
262  *
263  */
264 class KHTML_EXPORT ProcessingInstruction : public Node
265 {
266  friend class Document;
267 public:
270  ProcessingInstruction(const Node &other) : Node()
271  {
272  (*this) = other;
273  }
274 
275  ProcessingInstruction &operator = (const Node &other);
276  ProcessingInstruction &operator = (const ProcessingInstruction &other);
277 
279 
280  /**
281  * The target of this processing instruction. XML defines this as
282  * being the first token following the markup that begins the
283  * processing instruction.
284  *
285  */
286  DOMString target() const;
287 
288  /**
289  * The content of this processing instruction. This is from the
290  * first non white space character after the target to the
291  * character immediately preceding the \c ?&gt; .
292  *
293  */
294  DOMString data() const;
295 
296  /**
297  * see data
298  * @exception DOMException
299  * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
300  *
301  */
302  void setData(const DOMString &);
303 
304  /**
305  * Introduced in DOM Level 2
306  * This method is from the LinkStyle interface
307  *
308  * The style sheet.
309  */
310  StyleSheet sheet() const;
311 
312 protected:
313  ProcessingInstruction(ProcessingInstructionImpl *i);
314 };
315 
316 } //namespace
317 #endif
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
This interface represents an entity, either parsed or unparsed, in an XML document.
Definition: dom_xml.h:125
EntityReference objects may be inserted into the structure model when an entity reference is in the s...
Definition: dom_xml.h:190
The Text interface represents the textual content (termed character data in XML) of an Element or At...
Definition: dom_text.h:273
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
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
This library provides a full-featured HTML parser and widget.
The StyleSheet interface is the abstract base interface for any type of style sheet.
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-2021 The KDE developers.
Generated on Fri Nov 26 2021 22:49:30 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.