Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can start by looking at Delphi's TXMLDocument component. This will provide you with the basics of working with XML/DOM. It's simple and can be added by dropping it onto your Form. It has LoadFromFile and SaveToFile methods and is easily navigated.</p> <p>However, at some point you will exhaust TXMLDocument's features, especially if you want to work with things like XPath.</p> <p>I suggest you look at IXMLDOMDocument2 which is part of MSXML2_TLB, e.g.</p> <pre><code> XML := CreateOleObject('MSXML2.DOMDocument.3.0') as IXMLDOMDocument2; XML.async := false; XML.SetProperty('SelectionLanguage','XPath'); </code></pre> <p>You will need to add msxmldom, xmldom, XMLIntf, XMLDoc &amp; MSXML2_TLB to your uses section.</p> <p>There are a few component libraries out there but I would suggest writing your own helper class or functions. Here's an example of one we wrote and use:</p> <pre><code>function XMLCreateRoot(var xml: IXMLDOMDocument2; RootName: string; xsl: string = ''; encoding: string = 'ISO-8859-1'; language: string = 'XPath'): IXMLDOMNode; var NewPI: IXMLDOMProcessingInstruction; begin if language&lt;&gt;'' then xml.SetProperty('SelectionLanguage','XPath'); if encoding&lt;&gt;'' then begin NewPI:=xml.createProcessingInstruction('xml', 'version="1.0" encoding="'+encoding+'"'); xml.appendChild(NewPI); end; if xsl&lt;&gt;'' then begin NewPI:=xml.createProcessingInstruction('xml-stylesheet','type="text/xsl" href="'+xsl+'"'); xml.appendChild(NewPI) end; xml.async := false; xml.documentElement:=xml.createElement(RootName); Result:=xml.documentElement; end; </code></pre> <p>Take it from there.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload