pkXML
 
pkXML is simple and free XML parser for Pascal/Delphi. No need extra files, no installation. It's just source and nothing more.

Features:
  • it's suports Unicode (read/write)
  • can parse/save:
    • <xxx />
    • <xxx> ... <xxx />
    • attributes: <xxx attr1="aaa" attr2="bbb"/><?xxx?>
    • <!-- xxx -->
    • <![CDATA[ <xyz> <xyz2> ]]>
  • can handle many root nodes
  • it formats output file
  • can save whole objects
  • can read empty attributes and attributes without names
  • can parse nodes without ending (ex. HTML)
  • easy to use:
    						/WRITE/
    
    						var xml : TpkXML;
    						begin
    						xml := TpkXML.Create;
    						try
    						  // every "costam" is for the same node
    						 xml.NodeByName('costam').Value := 'TEST';
    						 xml.NodeByName('costam').AttrByName('id').Value := '1';
    						 xml.NodeByName('costam').NodeByName('pole1').Value := 'xyz';
    						 xml.NodeByName('costam').NodeByName('pole2').Value := 'xyz2';
    
    						 // faster (library doesn't check if node with that name exists)
    						 with xml.Append('costam2') do
    						  begin
    						   Append('costam').ValueInt := 1;
    						   Append('costam').ValueBool := false; // create next node with name 'costam'
    						   Append('costam innego').ValueExt := 1.6;
    						  end;
    
    						 xml.unicode := true; // force to use unicode
    
    						 xml.SaveToFile('c:	est.xml');
    
    						finally
    						 xml.free;
    						end;
    
    
    						/READ/
    
    						var xml : TpkXML;
    						    i : Integer;
    						begin
    						xml := TpkXML.Create;
    						try
    						 xml.LoadFromFile('c:	est.xml');
    
    						 // in xml.unicode is information if it's unicode XML or not
    
    						 i := xml.NodeByName('costam').GetValueIntDf(0));
    
    						 ShowMessage(xml.NodeByAttr('costam').NodeByAttr('pol2').Value);
    						 ShowMessage(xml.NodeByAttr('costam', ['id'], ['1']).Value);
    
    						finally
    						 xml.free;
    						end;
    					

Copyright 2009-2013 Paweł Konarski