Changeset 167 for branches/generator/Packages/Common/UXMLUtils.pas
- Timestamp:
- Aug 9, 2018, 3:43:27 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Packages/Common/UXMLUtils.pas
r136 r167 7 7 uses 8 8 {$IFDEF WINDOWS}Windows,{$ENDIF} 9 Classes, SysUtils, DateUtils, XMLRead, DOM;9 Classes, SysUtils, DateUtils, DOM, XMLRead; 10 10 11 11 function XMLTimeToDateTime(XMLDateTime: string): TDateTime; 12 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString;12 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): string; 13 13 procedure WriteInteger(Node: TDOMNode; Name: string; Value: Integer); 14 14 procedure WriteInt64(Node: TDOMNode; Name: string; Value: Int64); … … 50 50 TimeZoneInfo: TTimeZoneInformation; 51 51 begin 52 {$push}{$warn 5057 off} 52 53 case GetTimeZoneInformation(TimeZoneInfo) of 53 TIME_ZONE_ID_STANDARD: Result := TimeZoneInfo.Bias + TimeZoneInfo.StandardBias;54 TIME_ZONE_ID_DAYLIGHT: Result := TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias;54 TIME_ZONE_ID_STANDARD: Result := TimeZoneInfo.Bias + TimeZoneInfo.StandardBias; 55 TIME_ZONE_ID_DAYLIGHT: Result := TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias; 55 56 else 56 57 Result := 0; 57 58 end; 59 {$pop} 58 60 end; 59 61 {$ELSE} … … 65 67 function LeftCutString(var Source: string; out Output: string; Delimiter: string; Allowed: string = ''): Boolean; 66 68 var 67 I , J: Integer;69 I: Integer; 68 70 Matched: Boolean; 69 71 begin … … 119 121 if Pos('Z', XMLDateTime) > 0 then 120 122 LeftCutString(XMLDateTime, Part, 'Z'); 121 SecondFraction := StrToFloat('0' + De cimalSeparator + Part);123 SecondFraction := StrToFloat('0' + DefaultFormatSettings.DecimalSeparator + Part); 122 124 Millisecond := Trunc(SecondFraction * 1000); 123 125 end else begin … … 138 140 end; 139 141 140 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString;142 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): string; 141 143 const 142 144 Neg: array[Boolean] of string = ('+', '-'); … … 159 161 NewNode: TDOMNode; 160 162 begin 161 NewNode := Node.OwnerDocument.CreateElement( Name);162 NewNode.TextContent := IntToStr(Value);163 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 164 NewNode.TextContent := DOMString(IntToStr(Value)); 163 165 Node.AppendChild(NewNode); 164 166 end; … … 168 170 NewNode: TDOMNode; 169 171 begin 170 NewNode := Node.OwnerDocument.CreateElement( Name);171 NewNode.TextContent := IntToStr(Value);172 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 173 NewNode.TextContent := DOMString(IntToStr(Value)); 172 174 Node.AppendChild(NewNode); 173 175 end; … … 177 179 NewNode: TDOMNode; 178 180 begin 179 NewNode := Node.OwnerDocument.CreateElement( Name);180 NewNode.TextContent := BoolToStr(Value);181 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 182 NewNode.TextContent := DOMString(BoolToStr(Value)); 181 183 Node.AppendChild(NewNode); 182 184 end; … … 186 188 NewNode: TDOMNode; 187 189 begin 188 NewNode := Node.OwnerDocument.CreateElement( Name);189 NewNode.TextContent := Value;190 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 191 NewNode.TextContent := DOMString(Value); 190 192 Node.AppendChild(NewNode); 191 193 end; … … 195 197 NewNode: TDOMNode; 196 198 begin 197 NewNode := Node.OwnerDocument.CreateElement( Name);198 NewNode.TextContent := D ateTimeToXMLTime(Value);199 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 200 NewNode.TextContent := DOMString(DateTimeToXMLTime(Value)); 199 201 Node.AppendChild(NewNode); 200 202 end; … … 205 207 begin 206 208 Result := DefaultValue; 207 NewNode := Node.FindNode( Name);208 if Assigned(NewNode) then 209 Result := StrToInt( NewNode.TextContent);209 NewNode := Node.FindNode(DOMString(Name)); 210 if Assigned(NewNode) then 211 Result := StrToInt(string(NewNode.TextContent)); 210 212 end; 211 213 … … 215 217 begin 216 218 Result := DefaultValue; 217 NewNode := Node.FindNode( Name);218 if Assigned(NewNode) then 219 Result := StrToInt64( NewNode.TextContent);219 NewNode := Node.FindNode(DOMString(Name)); 220 if Assigned(NewNode) then 221 Result := StrToInt64(string(NewNode.TextContent)); 220 222 end; 221 223 … … 225 227 begin 226 228 Result := DefaultValue; 227 NewNode := Node.FindNode( Name);228 if Assigned(NewNode) then 229 Result := StrToBool( NewNode.TextContent);229 NewNode := Node.FindNode(DOMString(Name)); 230 if Assigned(NewNode) then 231 Result := StrToBool(string(NewNode.TextContent)); 230 232 end; 231 233 … … 235 237 begin 236 238 Result := DefaultValue; 237 NewNode := Node.FindNode( Name);238 if Assigned(NewNode) then 239 Result := NewNode.TextContent;239 NewNode := Node.FindNode(DOMString(Name)); 240 if Assigned(NewNode) then 241 Result := string(NewNode.TextContent); 240 242 end; 241 243 … … 246 248 begin 247 249 Result := DefaultValue; 248 NewNode := Node.FindNode( Name);249 if Assigned(NewNode) then 250 Result := XMLTimeToDateTime( NewNode.TextContent);250 NewNode := Node.FindNode(DOMString(Name)); 251 if Assigned(NewNode) then 252 Result := XMLTimeToDateTime(string(NewNode.TextContent)); 251 253 end; 252 254
Note:
See TracChangeset
for help on using the changeset viewer.