1 // File: XmlObjMgt_Persistent.cxx
2 // Created: Tue Jul 17 12:30:46 2001
3 // Author: Julia DOROVSKIKH <jfa@hotdox.nnov.matra-dtv.fr>
4 // Copyright: Matra Datavision 2001
5 // History: AGV 130202: Changed prototype LDOM_Node::getOwnerDocument()
7 #include <XmlObjMgt_Persistent.ixx>
8 #include <XmlObjMgt_Document.hxx>
9 #include <XmlObjMgt.hxx>
10 #include <TCollection_AsciiString.hxx>
12 //=======================================================================
13 //function : XmlObjMgt_Persistent
14 //purpose : empty constructor
15 //=======================================================================
17 XmlObjMgt_Persistent::XmlObjMgt_Persistent ()
21 //=======================================================================
22 //function : XmlObjMgt_Persistent
24 //=======================================================================
25 XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement)
26 : myElement (theElement), myID (0)
28 if (theElement != NULL)
29 theElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
32 //=======================================================================
33 //function : XmlObjMgt_Persistent
35 //=======================================================================
36 XmlObjMgt_Persistent::XmlObjMgt_Persistent (const XmlObjMgt_Element& theElement,
37 const XmlObjMgt_DOMString& theRef)
40 if (theElement != NULL) {
41 Standard_Integer aRefID;
42 if (theElement.getAttribute (theRef).GetInteger (aRefID)) {
43 myElement = XmlObjMgt::FindChildElement (theElement, aRefID);
44 if (myElement != NULL)
45 myElement.getAttribute(XmlObjMgt::IdString()).GetInteger(myID);
50 //=======================================================================
51 //function : CreateElement
52 //purpose : <theType id="theID"/>
53 //=======================================================================
54 void XmlObjMgt_Persistent::CreateElement (XmlObjMgt_Element& theParent,
55 const XmlObjMgt_DOMString& theType,
56 const Standard_Integer theID)
58 //AGV XmlObjMgt_Document& anOwnerDoc =
59 //AGV (XmlObjMgt_Document&)theParent.getOwnerDocument();
60 XmlObjMgt_Document anOwnerDoc =
61 XmlObjMgt_Document (theParent.getOwnerDocument());
62 myElement = anOwnerDoc.createElement (theType);
63 theParent.appendChild (myElement);
67 //=======================================================================
70 //=======================================================================
71 void XmlObjMgt_Persistent::SetId(const Standard_Integer theId)
74 myElement.setAttribute (XmlObjMgt::IdString(), theId);