Changeset 64 for trunk/Packages
- Timestamp:
- Sep 26, 2014, 9:01:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UXMLUtils.pas
r43 r64 7 7 uses 8 8 {$IFDEF WINDOWS}Windows,{$ENDIF} 9 Classes, SysUtils, DateUtils ;9 Classes, SysUtils, DateUtils, XMLRead, XMLWrite, DOM; 10 10 11 11 function XMLTimeToDateTime(XMLDateTime: string): TDateTime; 12 12 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString; 13 procedure WriteInteger(Node: TDOMNode; Name: string; Value: Integer); 14 procedure WriteBoolean(Node: TDOMNode; Name: string; Value: Boolean); 15 procedure WriteString(Node: TDOMNode; Name: string; Value: string); 16 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 17 function ReadBoolean(Node: TDOMNode; Name: string; DefaultValue: Boolean): Boolean; 18 function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string; 13 19 14 20 … … 123 129 end; 124 130 131 procedure WriteInteger(Node: TDOMNode; Name: string; Value: Integer); 132 var 133 NewNode: TDOMNode; 134 begin 135 NewNode := Node.OwnerDocument.CreateElement(Name); 136 NewNode.TextContent := IntToStr(Value); 137 Node.AppendChild(NewNode); 138 end; 139 140 procedure WriteBoolean(Node: TDOMNode; Name: string; Value: Boolean); 141 var 142 NewNode: TDOMNode; 143 begin 144 NewNode := Node.OwnerDocument.CreateElement(Name); 145 NewNode.TextContent := BoolToStr(Value); 146 Node.AppendChild(NewNode); 147 end; 148 149 procedure WriteString(Node: TDOMNode; Name: string; Value: string); 150 var 151 NewNode: TDOMNode; 152 begin 153 NewNode := Node.OwnerDocument.CreateElement(Name); 154 NewNode.TextContent := Value; 155 Node.AppendChild(NewNode); 156 end; 157 158 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 159 var 160 NewNode: TDOMNode; 161 begin 162 Result := DefaultValue; 163 NewNode := Node.FindNode(Name); 164 if Assigned(NewNode) then 165 Result := StrToInt(NewNode.TextContent); 166 end; 167 168 function ReadBoolean(Node: TDOMNode; Name: string; DefaultValue: Boolean): Boolean; 169 var 170 NewNode: TDOMNode; 171 begin 172 Result := DefaultValue; 173 NewNode := Node.FindNode(Name); 174 if Assigned(NewNode) then 175 Result := StrToBool(NewNode.TextContent); 176 end; 177 178 function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string; 179 var 180 NewNode: TDOMNode; 181 begin 182 Result := DefaultValue; 183 NewNode := Node.FindNode(Name); 184 if Assigned(NewNode) then 185 Result := NewNode.TextContent; 186 end; 187 125 188 end. 126 189
Note:
See TracChangeset
for help on using the changeset viewer.