dom_element.h
00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * (C) 1999 Lars Knoll (knoll@kde.org) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 * Boston, MA 02111-1307, USA. 00020 * 00021 * This file includes excerpts from the Document Object Model (DOM) 00022 * Level 1 Specification (Recommendation) 00023 * http://www.w3.org/TR/REC-DOM-Level-1/ 00024 * Copyright © World Wide Web Consortium , (Massachusetts Institute of 00025 * Technology , Institut National de Recherche en Informatique et en 00026 * Automatique , Keio University ). All Rights Reserved. 00027 * 00028 * $Id: dom_element.h,v 1.26.2.1 2003/05/18 12:34:37 mueller Exp $ 00029 */ 00030 #ifndef _DOM_ELEMENT_h_ 00031 #define _DOM_ELEMENT_h_ 00032 00033 #include <dom/dom_node.h> 00034 #include <dom/css_value.h> 00035 00036 namespace DOM { 00037 00038 class DOMString; 00039 class AttrImpl; 00040 class Element; 00041 class ElementImpl; 00042 class NamedAttrMapImpl; 00043 class DocumentImpl; 00044 00088 class Attr : public Node 00089 { 00090 friend class Element; 00091 friend class Document; 00092 friend class DocumentImpl; 00093 friend class HTMLDocument; 00094 friend class ElementImpl; 00095 friend class NamedAttrMapImpl; 00096 00097 public: 00098 Attr(); 00099 Attr(const Node &other) : Node() 00100 {(*this)=other;} 00101 Attr(const Attr &other); 00102 00103 Attr & operator = (const Node &other); 00104 Attr & operator = (const Attr &other); 00105 00106 ~Attr(); 00107 00112 DOMString name() const; 00113 00144 bool specified() const; 00145 00155 DOMString value() const; 00156 00160 void setValue( const DOMString & ); 00161 00168 Element ownerElement() const; 00169 00170 protected: 00171 00172 Attr( AttrImpl *_impl ); 00173 }; 00174 00175 class NodeList; 00176 class Attr; 00177 class DOMString; 00178 00207 class Element : public Node 00208 { 00209 friend class Document; 00210 friend class HTMLDocument; 00211 // friend class AttrImpl; 00212 friend class Attr; 00213 00214 public: 00215 Element(); 00216 Element(const Node &other) : Node() 00217 {(*this)=other;} 00218 Element(const Element &other); 00219 00220 Element & operator = (const Node &other); 00221 Element & operator = (const Element &other); 00222 00223 ~Element(); 00224 00235 DOMString tagName() const; 00236 00247 DOMString getAttribute ( const DOMString &name ); 00248 00276 void setAttribute ( const DOMString &name, const DOMString &value ); 00277 00290 void removeAttribute ( const DOMString &name ); 00291 00302 Attr getAttributeNode ( const DOMString &name ); 00303 00329 Attr setAttributeNode ( const Attr &newAttr ); 00330 00347 Attr removeAttributeNode ( const Attr &oldAttr ); 00348 00361 NodeList getElementsByTagName ( const DOMString &name ); 00362 00377 NodeList getElementsByTagNameNS ( const DOMString &namespaceURI, 00378 const DOMString &localName ); 00379 00395 DOMString getAttributeNS ( const DOMString &namespaceURI, 00396 const DOMString &localName ); 00397 00436 void setAttributeNS ( const DOMString &namespaceURI, 00437 const DOMString &qualifiedName, 00438 const DOMString &value ); 00439 00457 void removeAttributeNS ( const DOMString &namespaceURI, 00458 const DOMString &localName ); 00459 00473 Attr getAttributeNodeNS ( const DOMString &namespaceURI, 00474 const DOMString &localName ); 00475 00501 Attr setAttributeNodeNS ( const Attr &newAttr ); 00502 00513 bool hasAttribute( const DOMString& name ); 00514 00529 bool hasAttributeNS ( const DOMString &namespaceURI, 00530 const DOMString &localName ); 00531 00538 CSSStyleDeclaration style ( ); 00539 00544 bool isHTMLElement() const; 00545 00552 Element form() const; 00553 00554 static bool khtmlValidAttrName(const DOMString &name); 00555 static bool khtmlValidPrefix(const DOMString &name); 00556 static bool khtmlValidQualifiedName(const DOMString &name); 00557 00558 static bool khtmlMalformedQualifiedName(const DOMString &name); 00559 static bool khtmlMalformedPrefix(const DOMString &name); 00560 protected: 00561 Element(ElementImpl *_impl); 00562 }; 00563 00564 } //namespace 00565 #endif