1 // Created on: 2001-07-17
2 // Created by: Julia DOROVSKIKH
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
8 // under the terms of the GNU Lesser General Public 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 130202: Changed prototype LDOM_Node::getOwnerDocument()
18 #include <XmlObjMgt_Persistent.ixx>
19 #include <XmlObjMgt_Document.hxx>
20 #include <XmlObjMgt.hxx>
21 #include <TCollection_AsciiString.hxx>
23 //=======================================================================
24 //function : XmlObjMgt_Persistent
25 //purpose : empty constructor
26 //=======================================================================
28 XmlObjMgt_Persistent::XmlObjMgt_Persistent ()
32 //=======================================================================
33 //function : XmlObjMgt_Persistent
35 //=======================================================================
36 XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement)
37 : myElement (theElement), myID (0)
39 if (theElement != NULL)
40 theElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
43 //=======================================================================
44 //function : XmlObjMgt_Persistent
46 //=======================================================================
47 XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement,
48 const XmlObjMgt_DOMString& theRef)
51 if (theElement != NULL) {
52 Standard_Integer aRefID;
53 if (theElement.getAttribute (theRef).GetInteger (aRefID)) {
54 myElement = XmlObjMgt::FindChildElement (theElement, aRefID);
55 if (myElement != NULL)
56 myElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
61 //=======================================================================
62 //function : CreateElement
63 //purpose : <theType id="theID"/>
64 //=======================================================================
65 void XmlObjMgt_Persistent::CreateElement (XmlObjMgt_Element& theParent,
66 const XmlObjMgt_DOMString& theType,
67 const Standard_Integer theID)
69 //AGV XmlObjMgt_Document& anOwnerDoc =
70 //AGV (XmlObjMgt_Document&)theParent.getOwnerDocument();
71 XmlObjMgt_Document anOwnerDoc =
72 XmlObjMgt_Document (theParent.getOwnerDocument());
73 myElement = anOwnerDoc.createElement (theType);
74 theParent.appendChild (myElement);
78 //=======================================================================
81 //=======================================================================
82 void XmlObjMgt_Persistent::SetId(const Standard_Integer theId)
85 myElement.setAttribute (XmlObjMgt::IdString(), theId);