Welcome to the second part of a four-part series on Delphi and the DOM. In the first article, we discussed Delphi and XML. Now that you have some idea of the core elements of XML documents, we can talk about how to manipulate them in Delphi.
function getAttributeNodeNS(const namespaceURI, localName: DOMString): IDOMAttr; safecall; { DOM Level 2 }
function setAttributeNodeNS(const newAttr: IDOMAttr): IDOMAttr; safecall; { DOM Level 2 }
function getElementsByTagNameNS(const namespaceURI,
localName: DOMString): IDOMNodeList; safecall; { DOM Level 2 }
function hasAttribute(const name: DOMString): WordBool; safecall; { DOM Level 2 }
function hasAttributeNS(const namespaceURI, localName: DOMString): WordBool; safecall; { DOM Level 2 }
{ Properties }
property tagName: DOMString read get_tagName;
end;
{ IDOMText }
IDOMText = interface(IDOMCharacterData)
['{2BF4C0E7-096E-11D4-83DA-00C04F60B2DD}']
function splitText(offset: Integer): IDOMText; safecall;
end;
{ IDOMComment }
IDOMComment = interface(IDOMCharacterData)
['{2BF4C0E8-096E-11D4-83DA-00C04F60B2DD}']
end;
{ IDOMCDATASection }
IDOMCDATASection = interface(IDOMText)
['{2BF4C0E9-096E-11D4-83DA-00C04F60B2DD}']
end;
In the next 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.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.