[Lazarus] Read/write records from/to XML
Michael Van Canneyt
michael at freepascal.org
Mon Jan 12 09:27:22 CET 2015
On Sun, 11 Jan 2015, Anthony Walter wrote:
> Have you considered xpath? It's a core feature of all xml engines (msxml, libxml2, whatever else).
>
> Syntax overview:
>
> http://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx
>
> In my wrapper would look like this:
>
> Person := Document.FindNode('//Person[@Index = "0001"]');
>
> Other examples
>
> // All persons in a city that start with the letter A
> Document.FindNodes('//Person[starts-with(City, "A")]');
> // Or to processing save time, select the Persons node
> People := Document.FindNode('//Persons');
> // And now xpath is evaluated relative to that
> People.FindNode('Person[Name = "Jan"]');
>
> And so on
Free Pascal comes with the XPath unit, which implements the XPath spec.
It does not drag in anything except the dom unit.
Michael.
More information about the Lazarus
mailing list