1 // Created on: 2001-06-26
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //AGV 140202: Repl.(const char *) for (LDOMBasicString) => myTagName
18 #ifndef LDOM_BasicElement_HeaderFile
19 #define LDOM_BasicElement_HeaderFile
21 #include <LDOM_BasicNode.hxx>
22 #include <LDOMBasicString.hxx>
23 #include <LDOM_Node.hxx>
29 class LDOM_BasicAttribute;
31 // Class LDOM_BasicElement
34 class LDOM_BasicElement : public LDOM_BasicNode
38 // ---------- PUBLIC METHODS ----------
41 : LDOM_BasicNode (LDOM_Node::UNKNOWN),
44 myFirstChild (NULL) {}
47 static LDOM_BasicElement& Create (const char * aName,
48 const Standard_Integer aLength,
49 const Handle(LDOM_MemManager)& aDoc);
51 // Standard_EXPORT LDOM_BasicElement (const LDOM_BasicElement& theOther);
54 Standard_EXPORT LDOM_BasicElement&
55 operator = (const LDOM_NullPtr * aNull);
58 Standard_EXPORT ~LDOM_BasicElement ();
61 const char * GetTagName () const { return myTagName; }
63 const LDOM_BasicNode *
64 GetFirstChild () const { return myFirstChild; }
66 Standard_EXPORT const LDOM_BasicNode *
67 GetLastChild () const;
69 Standard_EXPORT const LDOM_BasicAttribute&
70 GetAttribute (const LDOMBasicString& aName,
71 const LDOM_BasicNode * aLastCh) const;
72 // Search for attribute name, using or setting myFirstAttribute
75 // ---------- PROTECTED METHODS ----------
77 // LDOM_BasicElement (const LDOM_Element& anElement);
80 Standard_EXPORT const LDOM_BasicNode *
81 AddAttribute (const LDOMBasicString& anAttrName,
82 const LDOMBasicString& anAttrValue,
83 const Handle(LDOM_MemManager)& aDoc,
84 const LDOM_BasicNode * aLastCh);
85 // add or replace an attribute to the element
87 Standard_EXPORT const LDOM_BasicNode *
88 RemoveAttribute (const LDOMBasicString& aName,
89 const LDOM_BasicNode * aLastCh) const;
92 RemoveChild (const LDOM_BasicNode * aChild) const;
93 // remove a child element
96 AppendChild (const LDOM_BasicNode * aChild,
97 const LDOM_BasicNode *& aLastCh) const;
98 // append a child node to the end of the list
101 friend class LDOMParser;
102 friend class LDOM_XmlReader;
103 friend class LDOM_Document;
104 friend class LDOM_Element;
105 friend class LDOM_Node;
106 // ---------- PRIVATE METHODS ----------
108 const LDOM_BasicAttribute *
109 GetFirstAttribute (const LDOM_BasicNode *& aLastCh,
110 const LDOM_BasicNode **& thePrN) const;
114 void ReplaceElement (const LDOM_BasicElement& anOther,
115 const Handle(LDOM_MemManager)& aDoc);
118 void AddElementsByTagName (LDOM_NodeList& aList,
119 const LDOMBasicString& aTagName) const;
122 void AddAttributes (LDOM_NodeList& aList,
123 const LDOM_BasicNode * aLastCh) const;
124 // add attributes to list
127 // ---------- PRIVATE FIELDS ----------
129 // LDOMBasicString myTagName;
130 const char * myTagName;
131 unsigned long myAttributeMask;
132 LDOM_BasicNode * myFirstChild;