xpath
Just an XPath implementation. Should be fairly complete, but there hasn't been further development recently.
Example
ts.xml
<?xml version="1.0" ?><!DOCTYPE TS><TS language="es_ES" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../src/lib/other/aboutdialog.ui" line="60"/>
<source>Authors</source>
<translation>Autores</translation>
</message>
<message>
<location filename="../src/lib/other/aboutdialog.cpp" line="56"/>
<source>Authors and Contributors</source>
<translation>Autores y contribuidores</translation>
</message>
</context>
</TS>uses
DOM, XMLRead, XPath;
var
Xml: TXMLDocument;
XPathResult: TXPathVariable;
begin
ReadXMLFile(Xml, 'ts.xml');
//Get text inside <translation> tag
XPathResult := EvaluateXPathExpression('/TS/context[name="AboutDialog"]/message[source="Authors"]/translation', Xml.DocumentElement);
ShowMessage(String(XPathResult.AsText));
XPathResult.Free;
Xml.Free;
end;Back to fcl-xml overview.
From the Free Pascal wiki, page "xpath", as it stood on 2020-03-03 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
