Menu

#3 Add method to create new DocumentElement

open
nobody
5
2013-01-15
2007-03-13
Anonymous
No

The code required to create a new DocumentElement without introducing a memory leak is non-obvious.

request the following be added as a new public method to TXpObjModel

function TXpObjModel.CreateDocumentElement(const sName : DOMString): TXpElement;
var
root : TXpElement;
begin
ClearDocument;
Root := Document.CreateElement(Root);
Document.AppendChild(Root); // increments Root's reference count
Root.Release; // required to prevent memory leak
result := DocumentElement;
end;

Discussion


Log in to post a comment.

MongoDB Logo MongoDB