• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • khtml
  • dom
dom_node.h
Go to the documentation of this file.
1/*
2 * This file is part of the DOM implementation for KDE.
3 *
4 * Copyright 1999 Lars Knoll (knoll@kde.org)
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 * http://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_Node_h_
30#define _DOM_Node_h_
31
32#include <khtml_export.h>
33#include <QtCore/QString>
34
35class QRect;
36
37namespace KJS {
38 class HTMLDocument;
39 class Window;
40}
41namespace DOM {
42
43class Node;
44class DOMString;
45class NodeImpl;
46class NamedNodeMapImpl;
47class EventListener;
48class Event;
49
62class KHTML_EXPORT NamedNodeMap
63{
64public:
65 NamedNodeMap();
66 NamedNodeMap(const NamedNodeMap &other);
67
68 NamedNodeMap & operator = (const NamedNodeMap &other);
69
70 ~NamedNodeMap();
71
77 unsigned long length() const;
78
89 Node getNamedItem ( const DOMString &name ) const;
90
123 Node setNamedItem ( const Node &arg );
124
140 Node removeNamedItem ( const DOMString &name );
141
154 Node item ( unsigned long index ) const;
155
169 Node getNamedItemNS( const DOMString &namespaceURI,
170 const DOMString &localName ) const;
171
196 Node setNamedItemNS( const Node &arg );
197
222 Node removeNamedItemNS( const DOMString &namespaceURI,
223 const DOMString &localName );
224
229 NamedNodeMapImpl *handle() const { return impl; }
230 bool isNull() const { return !impl; }
231
232protected:
233 NamedNodeMap( NamedNodeMapImpl *i);
234 NamedNodeMapImpl *impl;
235
236 friend class Node;
237 friend class DocumentType;
238 friend class NodeImpl;
239};
240
241class NamedNodeMap;
242class NodeList;
243class Document;
244class DOMString;
245class StyleSheet;
246
247class NodeImpl;
248
270class KHTML_EXPORT Node
271{
272 friend class NamedNodeMap;
273 friend class NodeList;
274 friend class HTMLCollection;
275 friend class StyleSheet;
276
277public:
278 Node() : impl(0) {}
279 Node(const Node &other);
280
284 Node( NodeImpl *_impl);
285
286 Node & operator = (const Node &other);
287
288 bool operator == (const Node &other) const;
289
290 bool operator != (const Node &other) const;
291
292 virtual ~Node();
381 enum NodeType {
382 ELEMENT_NODE = 1,
383 ATTRIBUTE_NODE = 2,
384 TEXT_NODE = 3,
385 CDATA_SECTION_NODE = 4,
386 ENTITY_REFERENCE_NODE = 5,
387 ENTITY_NODE = 6,
388 PROCESSING_INSTRUCTION_NODE = 7,
389 COMMENT_NODE = 8,
390 DOCUMENT_NODE = 9,
391 DOCUMENT_TYPE_NODE = 10,
392 DOCUMENT_FRAGMENT_NODE = 11,
393 NOTATION_NODE = 12,
394 XPATH_NAMESPACE_NODE = 13 //< Part of DOM L3 XPath, @since 4.5
395 };
396
402 DOMString nodeName() const;
403
414 DOMString nodeValue() const;
415
422 void setNodeValue( const DOMString & );
423
429 unsigned short nodeType() const;
430
439 Node parentNode() const;
440
454 NodeList childNodes() const;
455
461 Node firstChild() const;
462
468 Node lastChild() const;
469
475 Node previousSibling() const;
476
482 Node nextSibling() const;
483
490 NamedNodeMap attributes() const;
491
499 Document ownerDocument() const;
500
535 Node insertBefore ( const Node &newChild, const Node &refChild );
536
565 Node replaceChild ( const Node &newChild, const Node &oldChild );
566
582 Node removeChild ( const Node &oldChild );
583
610 Node appendChild ( const Node &newChild );
611
620 bool hasChildNodes ( );
621
642 Node cloneNode ( bool deep );
643
661 void normalize ( );
662
680 bool isSupported( const DOMString &feature,
681 const DOMString &version ) const;
682
699 DOMString namespaceURI( ) const;
700
716 DOMString prefix( ) const;
717
735 void setPrefix(const DOMString &prefix );
736
745 DOMString localName( ) const;
746
752 bool hasAttributes ( );
753
782 void addEventListener(const DOMString &type,
783 EventListener *listener,
784 const bool useCapture);
785
811 void removeEventListener(const DOMString &type,
812 EventListener *listener,
813 bool useCapture);
814
838 bool dispatchEvent(const Event &evt);
839
857 DOMString textContent() const;
858
865 void setTextContent(const DOMString& text);
866
875 enum DocumentPosition {
876 DOCUMENT_POSITION_DISCONNECTED = 0x01,
877 DOCUMENT_POSITION_PRECEDING = 0x02,
878 DOCUMENT_POSITION_FOLLOWING = 0x04,
879 DOCUMENT_POSITION_CONTAINS = 0x08,
880 DOCUMENT_POSITION_CONTAINED_BY = 0x10,
881 DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
882 };
883
899 unsigned compareDocumentPosition(const DOM::Node& other);
900
906 quint32 elementId() const;
907
920 bool isNull() const { return !impl; }
921
925 NodeImpl *handle() const { return impl; }
926
930 unsigned long index() const;
931#ifndef KDE_NO_DEPRECATED
932 KDE_DEPRECATED QString toHTML();
933#endif
934 void applyChanges();
938#ifndef KDE_NO_DEPRECATED
939 KDE_DEPRECATED void getCursor(int offset, int &_x, int &_y, int &height);
940#endif
945 QRect getRect();
946
947protected:
948 NodeImpl *impl;
949};
950
951
952class NodeListImpl;
953
963class KHTML_EXPORT NodeList
964{
965 friend class Element;
966 friend class Node;
967 friend class Document;
968 friend class DocumentFragment;
969 friend class HTMLDocument;
970 friend class KJS::HTMLDocument;
971 friend class KJS::Window;
972
973public:
974 NodeList();
975 NodeList(const NodeList &other);
976
977 NodeList & operator = (const NodeList &other);
978
979 ~NodeList();
980
986 unsigned long length() const;
987
1000 Node item ( unsigned long index ) const;
1001
1006 NodeListImpl *handle() const { return impl; }
1007 bool isNull() const { return !impl; }
1008
1009protected:
1010 NodeList(const NodeListImpl *i);
1011 NodeListImpl *impl;
1012};
1013
1014
1015
1020typedef unsigned long long DOMTimeStamp;
1021
1022
1023} //namespace
1024#endif
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::DocumentFragment
DocumentFragment is a "lightweight" or "minimal" Document object.
Definition: dom_doc.h:1042
DOM::DocumentType
Each Document has a doctype attribute whose value is either null or a DocumentType object.
Definition: dom_doc.h:1100
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
DOM::Element
By far the vast majority of objects (apart from text) that authors encounter when traversing a docume...
Definition: dom_element.h:210
DOM::EventListener
Introduced in DOM Level 2.
Definition: dom2_events.h:70
DOM::Event
Introduced in DOM Level 2.
Definition: dom2_events.h:117
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:131
DOM::HTMLDocument
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
Definition: html_document.h:74
DOM::NamedNodeMap
Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can b...
Definition: dom_node.h:63
DOM::NamedNodeMap::handle
NamedNodeMapImpl * handle() const
Definition: dom_node.h:229
DOM::NamedNodeMap::impl
NamedNodeMapImpl * impl
Definition: dom_node.h:234
DOM::NamedNodeMap::isNull
bool isNull() const
Definition: dom_node.h:230
DOM::NodeList
The NodeList interface provides the abstraction of an ordered collection of nodes,...
Definition: dom_node.h:964
DOM::NodeList::impl
NodeListImpl * impl
Definition: dom_node.h:1011
DOM::NodeList::handle
NodeListImpl * handle() const
Definition: dom_node.h:1006
DOM::NodeList::isNull
bool isNull() const
Definition: dom_node.h:1007
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:271
DOM::Node::handle
NodeImpl * handle() const
Definition: dom_node.h:925
DOM::Node::Node
Node()
Definition: dom_node.h:278
DOM::Node::NodeType
NodeType
An integer indicating which type of node this is.
Definition: dom_node.h:381
DOM::Node::impl
NodeImpl * impl
Definition: dom_node.h:948
DOM::Node::isNull
bool isNull() const
tests if this Node is 0.
Definition: dom_node.h:920
DOM::Node::DocumentPosition
DocumentPosition
Introduced in DOM Level 3.
Definition: dom_node.h:875
DOM::StyleSheet
The StyleSheet interface is the abstract base interface for any type of style sheet.
Definition: css_stylesheet.h:59
khtml_export.h
prefix
QString prefix()
DOM
This library provides a full-featured HTML parser and widget.
Definition: design.h:55
DOM::DOMTimeStamp
unsigned long long DOMTimeStamp
A DOMTimeStamp represents a number of milliseconds.
Definition: dom_node.h:1020
isSupported
bool isSupported(const QString &mimeType, Mode mode=Writing)
KJS
Definition: dom_node.h:37
name
const char * name(StandardAction id)
Window
Window
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal