testxmlconf.lpr 603 B

12345678910111213141516171819202122232425262728293031
  1. program testxmlconf;
  2. uses xmlconf;
  3. begin
  4. With TXMLConfig.Create(Nil) do
  5. try
  6. FileName:='test.xml';
  7. OpenKey('General');
  8. SetValue('one',1);
  9. SetValue('two',2);
  10. SetValue('extra/name','michael');
  11. Flush;
  12. finally
  13. Free;
  14. end;
  15. With TXMLConfig.Create(Nil) do
  16. try
  17. FileName:='test.xml';
  18. OpenKey('General');
  19. If GetValue('one',0)<>1 then
  20. Writeln('One does not match');
  21. If GetValue('two',0)<>2 then
  22. Writeln('Two does not match');
  23. if GetValue('extra/name','')<>'michael' then
  24. Writeln('Name does not match');
  25. finally
  26. Free;
  27. end;
  28. end.