Changeset 30 for trunk/Packages/Common/XML.pas
- Timestamp:
- Jun 28, 2024, 11:08:43 PM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/XML.pas
r29 r30 1 unit UXMLUtils;1 unit XML; 2 2 3 3 interface … … 14 14 procedure WriteString(Node: TDOMNode; Name: string; Value: string); 15 15 procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime); 16 procedure WriteDouble(Node: TDOMNode; Name: string; Value: Double); 16 17 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 17 18 function ReadInt64(Node: TDOMNode; Name: string; DefaultValue: Int64): Int64; … … 19 20 function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string; 20 21 function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime): TDateTime; 22 function ReadDouble(Node: TDOMNode; Name: string; DefaultValue: Double): Double; 21 23 procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string); 22 24 23 25 24 26 implementation 27 28 function ReadDouble(Node: TDOMNode; Name: string; DefaultValue: Double): Double; 29 var 30 NewNode: TDOMNode; 31 begin 32 Result := DefaultValue; 33 NewNode := Node.FindNode(DOMString(Name)); 34 if Assigned(NewNode) then 35 Result := StrToFloat(string(NewNode.TextContent)); 36 end; 25 37 26 38 procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string); … … 200 212 end; 201 213 214 procedure WriteDouble(Node: TDOMNode; Name: string; Value: Double); 215 var 216 NewNode: TDOMNode; 217 begin 218 NewNode := Node.OwnerDocument.CreateElement(DOMString(Name)); 219 NewNode.TextContent := DOMString(FloatToStr(Value)); 220 Node.AppendChild(NewNode); 221 end; 222 202 223 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 203 224 var … … 252 273 253 274 end. 254
Note:
See TracChangeset
for help on using the changeset viewer.