I have read som xml into an msxml.IXMLDOMDocument object. However, there is a utility method in an API that I am using, that I would like to call, but it takes an XmlIntf.IXMLNode as an argument.
Is there a simple way to convert an IXMLDOMNode instance from my document to an IXMLNode so I can pass it to the method without having to load the xml into a TXmlDocument object?
For now I have implemented this workaround:
function ConvertNode(const Node: IXMLDOMNode): IXMLNode;
var
Document: IXMLDocument;
begin
Document := NewXMLDocument;
Document.LoadFromXML(Node.xml);
Result := Document.DocumentElement;
end;
You can create an instance of
IXMLDocumentand “attach” it to yourIXMLDOMDocument. Here’s a small example: