1 // Created on: 2001-06-26
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15 
16 #ifndef LDOM_Element_HeaderFile
17 #define LDOM_Element_HeaderFile
18 
19 #include <LDOM_Attr.hxx>
20 #include <LDOM_NodeList.hxx>
21 
22 class LDOMParser;
23 class LDOM_BasicElement;
24 
25 //  Class LDOM_Element
26 //
27 
28 class LDOM_Element : public LDOM_Node
29 {
30  public:
31   // ---------- PUBLIC METHODS ----------
32 
LDOM_Element()33   LDOM_Element () {}
34   //    Empty constructor
35 
LDOM_Element(const LDOM_Element & anOther)36   LDOM_Element (const LDOM_Element& anOther) : LDOM_Node (anOther) {}
37   //    Copy constructor
38 
operator =(const LDOM_Element & anOther)39   LDOM_Element& operator =              (const LDOM_Element& anOther)
40                     { return (LDOM_Element&) LDOM_Node::operator = (anOther); }
41   //    Assignment
42 
operator =(const LDOM_NullPtr * aNull)43   LDOM_Element& operator =              (const LDOM_NullPtr * aNull)
44                     { return (LDOM_Element&) LDOM_Node::operator = (aNull); }
45   //    Nullify
46 
getTagName() const47   LDOMString    getTagName              () const { return getNodeName(); }
48 
49   Standard_EXPORT LDOMString
50                 getAttribute            (const LDOMString& aName) const;
51 
52   Standard_EXPORT LDOM_Attr
53                 getAttributeNode        (const LDOMString& aName) const;
54 
55   Standard_EXPORT LDOM_NodeList
56                 getElementsByTagName    (const LDOMString& aName) const;
57 
58   Standard_EXPORT void  setAttribute    (const LDOMString& aName,
59                                          const LDOMString& aValue);
60 
61   Standard_EXPORT void  setAttributeNode(const LDOM_Attr& aNewAttr);
62 
63   Standard_EXPORT void  removeAttribute (const LDOMString& aName);
64 
65 //      AGV auxiliary API
66   Standard_EXPORT LDOM_Element
67                 GetChildByTagName       (const LDOMString& aTagName) const;
68 
69   Standard_EXPORT LDOM_Element
70                 GetSiblingByTagName     () const;
71 
72   Standard_EXPORT void
73                 ReplaceElement          (const LDOM_Element& anOther);
74   //    The old element is destroyed by the new one
75 
76   Standard_EXPORT LDOM_NodeList
77                 GetAttributesList       () const;
78 
79  protected:
80   friend class LDOM_Document;
81   friend class LDOMParser;
82   // ---------- PROTECTED METHODS ----------
83 
84   LDOM_Element                          (const LDOM_BasicElement&       anElem,
85                                          const Handle(LDOM_MemManager)& aDoc);
86 
87  private:
88   // ---------- PRIVATE FIELDS ----------
89 
90 };
91 
92 
93 #endif
94