1 // Created on: 2001-06-26
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 //AGV 140202: Repl.(const char *) for (LDOMBasicString) => myTagName
22 #ifndef LDOM_BasicElement_HeaderFile
23 #define LDOM_BasicElement_HeaderFile
25 #include <LDOM_BasicNode.hxx>
26 #include <LDOMBasicString.hxx>
27 #include <LDOM_Node.hxx>
33 class LDOM_BasicAttribute;
35 // Class LDOM_BasicElement
38 class LDOM_BasicElement : public LDOM_BasicNode
42 // ---------- PUBLIC METHODS ----------
45 : LDOM_BasicNode (LDOM_Node::UNKNOWN),
48 myFirstChild (NULL) {}
51 static LDOM_BasicElement& Create (const char * aName,
52 const Standard_Integer aLength,
53 const Handle(LDOM_MemManager)& aDoc);
55 // Standard_EXPORT LDOM_BasicElement (const LDOM_BasicElement& theOther);
58 Standard_EXPORT LDOM_BasicElement&
59 operator = (const LDOM_NullPtr * aNull);
62 Standard_EXPORT ~LDOM_BasicElement ();
65 const char * GetTagName () const { return myTagName; }
67 const LDOM_BasicNode *
68 GetFirstChild () const { return myFirstChild; }
70 Standard_EXPORT const LDOM_BasicNode *
71 GetLastChild () const;
73 Standard_EXPORT const LDOM_BasicAttribute&
74 GetAttribute (const LDOMBasicString& aName,
75 const LDOM_BasicNode * aLastCh) const;
76 // Search for attribute name, using or setting myFirstAttribute
79 // ---------- PROTECTED METHODS ----------
81 // LDOM_BasicElement (const LDOM_Element& anElement);
84 Standard_EXPORT const LDOM_BasicNode *
85 AddAttribute (const LDOMBasicString& anAttrName,
86 const LDOMBasicString& anAttrValue,
87 const Handle(LDOM_MemManager)& aDoc,
88 const LDOM_BasicNode * aLastCh);
89 // add or replace an attribute to the element
91 Standard_EXPORT const LDOM_BasicNode *
92 RemoveAttribute (const LDOMBasicString& aName,
93 const LDOM_BasicNode * aLastCh) const;
96 RemoveChild (const LDOM_BasicNode * aChild) const;
97 // remove a child element
100 AppendChild (const LDOM_BasicNode * aChild,
101 const LDOM_BasicNode *& aLastCh) const;
102 // append a child node to the end of the list
105 friend class LDOMParser;
106 friend class LDOM_XmlReader;
107 friend class LDOM_Document;
108 friend class LDOM_Element;
109 friend class LDOM_Node;
110 // ---------- PRIVATE METHODS ----------
112 const LDOM_BasicAttribute *
113 GetFirstAttribute (const LDOM_BasicNode *& aLastCh,
114 const LDOM_BasicNode **& thePrN) const;
118 void ReplaceElement (const LDOM_BasicElement& anOther,
119 const Handle(LDOM_MemManager)& aDoc);
122 void AddElementsByTagName (LDOM_NodeList& aList,
123 const LDOMBasicString& aTagName) const;
126 void AddAttributes (LDOM_NodeList& aList,
127 const LDOM_BasicNode * aLastCh) const;
128 // add attributes to list
131 // ---------- PRIVATE FIELDS ----------
133 // LDOMBasicString myTagName;
134 const char * myTagName;
135 unsigned long myAttributeMask;
136 LDOM_BasicNode * myFirstChild;