1 // Created on: 2001-08-29
2 // Created by: Julia DOROVSKIKH
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 150202: Changed prototype XmlObjMgt::SetStringValue()
22 #include <XmlMDF_TagSourceDriver.ixx>
23 #include <XmlObjMgt.hxx>
24 #include <TDF_TagSource.hxx>
26 //=======================================================================
27 //function : XmlMDF_TagSourceDriver
28 //purpose : Constructor
29 //=======================================================================
31 XmlMDF_TagSourceDriver::XmlMDF_TagSourceDriver
32 (const Handle(CDM_MessageDriver)& theMsgDriver)
33 : XmlMDF_ADriver (theMsgDriver, NULL)
36 //=======================================================================
39 //=======================================================================
40 Handle(TDF_Attribute) XmlMDF_TagSourceDriver::NewEmpty() const
42 return (new TDF_TagSource());
45 //=======================================================================
47 //purpose : persistent -> transient (retrieve)
48 //=======================================================================
49 Standard_Boolean XmlMDF_TagSourceDriver::Paste
50 (const XmlObjMgt_Persistent& theSource,
51 const Handle(TDF_Attribute)& theTarget,
52 XmlObjMgt_RRelocationTable& ) const
54 Standard_Integer aTag;
55 XmlObjMgt_DOMString aTagStr = XmlObjMgt::GetStringValue(theSource.Element());
57 if (aTagStr.GetInteger(aTag) == Standard_False) {
58 TCollection_ExtendedString aMessageString =
59 TCollection_ExtendedString ("Cannot retrieve TagSource attribute from \"")
61 WriteMessage (aMessageString);
62 return Standard_False;
66 TCollection_ExtendedString aMessageString =
67 TCollection_ExtendedString ("Invalid value of TagSource retrieved: ")
69 WriteMessage (aMessageString);
70 return Standard_False;
73 Handle(TDF_TagSource) aT = Handle(TDF_TagSource)::DownCast (theTarget);
79 //=======================================================================
81 //purpose : transient -> persistent (store)
82 //=======================================================================
83 void XmlMDF_TagSourceDriver::Paste (const Handle(TDF_Attribute)& theSource,
84 XmlObjMgt_Persistent& theTarget,
85 XmlObjMgt_SRelocationTable& ) const
87 Handle(TDF_TagSource) aTag = Handle(TDF_TagSource)::DownCast(theSource);
88 // No occurrence of '&', '<' and other irregular XML characters
89 XmlObjMgt::SetStringValue (theTarget.Element(), aTag->Get(), Standard_True);