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 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 130202: Changed prototype LDOM_Node::getOwnerDocument()
18 #include <TCollection_AsciiString.hxx>
19 #include <XmlObjMgt.hxx>
20 #include <XmlObjMgt_Document.hxx>
21 #include <XmlObjMgt_Persistent.hxx>
23 //=======================================================================
24 //function : XmlObjMgt_Persistent
25 //purpose : empty constructor
26 //=======================================================================
27 XmlObjMgt_Persistent::XmlObjMgt_Persistent ()
31 //=======================================================================
32 //function : XmlObjMgt_Persistent
34 //=======================================================================
35 XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement)
36 : myElement (theElement), myID (0)
38 if (theElement != NULL)
39 theElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
42 //=======================================================================
43 //function : XmlObjMgt_Persistent
45 //=======================================================================
46 XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement,
47 const XmlObjMgt_DOMString& theRef)
50 if (theElement != NULL) {
51 Standard_Integer aRefID;
52 if (theElement.getAttribute (theRef).GetInteger (aRefID)) {
53 myElement = XmlObjMgt::FindChildElement (theElement, aRefID);
54 if (myElement != NULL)
55 myElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
60 //=======================================================================
61 //function : CreateElement
62 //purpose : <theType id="theID"/>
63 //=======================================================================
64 void XmlObjMgt_Persistent::CreateElement (XmlObjMgt_Element& theParent,
65 const XmlObjMgt_DOMString& theType,
66 const Standard_Integer theID)
68 //AGV XmlObjMgt_Document& anOwnerDoc =
69 //AGV (XmlObjMgt_Document&)theParent.getOwnerDocument();
70 XmlObjMgt_Document anOwnerDoc =
71 XmlObjMgt_Document (theParent.getOwnerDocument());
72 myElement = anOwnerDoc.createElement (theType);
73 theParent.appendChild (myElement);
77 //=======================================================================
80 //=======================================================================
81 void XmlObjMgt_Persistent::SetId(const Standard_Integer theId)
84 myElement.setAttribute (XmlObjMgt::IdString(), theId);