In this article we will look at a partial listing of the xmlintf unit and then write a program to demonstrate how to use DOM in Delphi. We began our discussion of this topic in the previous article. This is part three of a four-part series.
Below is a listing of the xmlintf unit that we discussed in the previous article. It is one of the main XML units that form part of the wrapper classes in Delphi. I will only show the functions, procedures and properties definitions and not their implementation, because it would fill the entire article if I did:
unit XMLIntf;
interface
{$IFDEF MSWINDOWS}
{ MSXML.H defines another IXMLDocument and references the type...
The compiler must see this before it sees the IXMLDocument
introduced in this unit - otherwise, references will cause
Below I've defined the interface to the XML wrapper class. It will be used by the other classes and units to interface. The methods and properties are also defined:
IXMLNodeList = interface
['{395950C1-7E5D-11D4-83DA-00C04F60B2DD}']
{ Property Accessors }
function GetCount: Integer;
function GetNode(const IndexOrName: OleVariant): IXMLNode;
function GetUpdateCount: Integer;
{ Methods }
function Add(const Node: IXMLNode): Integer;
procedure BeginUpdate;
procedure Clear;
function Delete(const Index: Integer): Integer; overload;
function Delete(const Name: DOMString): Integer; overload;
function Delete(const Name, NamespaceURI: DOMString): Integer; overload;
procedure EndUpdate;
function First: IXMLNode;
function FindNode(NodeName: DOMString): IXMLNode; overload;
function FindNode(NodeName, NamespaceURI: DOMString): IXMLNode; overload;
function FindNode(ChildNodeType: TGuid): IXMLNode; overload;
function FindSibling(const Node: IXMLNode; Delta: Integer): IXMLNode;
function Get(Index: Integer): IXMLNode;
function IndexOf(const Node: IXMLNode): Integer; overload;
function IndexOf(const Name: DOMString): Integer; overload;
function IndexOf(const Name, NamespaceURI: DOMString): Integer; overload;