Working with XML
Before JSON dominated the world, XML was the most popular format for data interchange. With the addition of many new specifications, XML became very complex to process in code, and very cumbersome for a number of use cases. However, at a practical level, XML is still used in many circumstances and it’s important to understand how to process XML in case you need to.
XML processing in Delphi is based on building an in-memory representation of the XML file using XML parsers from different vendors. The key component for working with XML is TXMLDocument
. XML parsing is considerably more difficult than it is with JSON. TXMLDocument
has a pluggable XML parser architecture, and Delphi comes with a number of XML parser implementations from different vendors. There are different vendor implementations available depending on the target platform, as you can see in Figure 3.6 for Windows.
Figure 3.6: The available DOM vendors in the TXMLDocument...