Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. function TMetroApplicationParams.LoadFromXML(const AXML: String): Boolean;
  2. var
  3. d: ixmldomdocument;
  4.  
  5. procedure _load_values(AName: String; AValues: TFastKeyValues);
  6. var
  7. x: ixmldomnode;
  8. begin
  9. x := d.documentElement.selectSingleNode(AName);
  10. if assigned(x) then begin
  11. if not assigned(AValues) then
  12. AValues := TFastKeyValues.Create;
  13. x := x.firstChild;
  14. while x <> nil do begin
  15. AValues.AddValue(x.nodeName, x.text);
  16. x := x.nextSibling;
  17. end;
  18. end;
  19. end;
  20. begin
  21. Result := False;
  22. d := codomdocument.create;
  23. try
  24. if d.loadxml(AXML) then begin
  25. if d.documentElement = nil then
  26. Exit;
  27. _load_values('colorscheme', FColorscheme);
  28. _load_values('properties', FProperties);
  29. _load_values('behaviour', FBehaviour);
  30. _load_values('data', FData);
  31. Result := True;
  32. end;
  33. finally
  34. d := nil;
  35. end;
  36. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement