1

Hello I made this function which allows me to create a document from the selected object in a geckobowser:

function  TForm6.creer_doc(node:nsIDOMNode):nsIDOMDocument;
var
  Next: nsIDOMNode;
  nName: IInterfacedString;
  TN: TTreeNode;
begin
  node:=GeckoBrowser1.ContentWindow.GetSelection.GetRangeAt(0).StartContainer;
  if not Assigned(node) then exit;
  nName:=NewString;
  Next:=node;
  while Assigned(Next) do
   begin
     Fdoc.DocumentElement.AppendChild(Next);
     if Next.HasChildNodes then
      begin
       creer_doc(Next.FirstChild);
      end;
     Next:=Next.NextSibling;
   end;      
  Result:=Fdoc;
end;

But apparently I have nothing in my paper Fdoc.Merci help me to create a nsIDOMDocument.

RRUZ
  • 134,889
  • 20
  • 356
  • 483
user653395
  • 59
  • 1
  • 9
  • Edited your code to align it properly. – Cosmin Prund Apr 19 '11 at 13:50
  • Which Units/Components are you using to access GeckoBrowser1 and nsI* interfaces? – Stijn Sanders Apr 19 '11 at 16:45
  • I use the XPCOM interfaces, especially the interfaces: nsIDOMNode, nsidomdocument, nsiDomwindows, component geckoSDK. You can find this component in the following link: http://d-gecko.svn.sourceforge.net/viewvc/d-gecko/ for Delphi or http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus -ccr/components/geckoport / for lazarus. – user653395 Apr 19 '11 at 18:52
  • the problem is that the elements are not added in the (FDOC). I do not know what I'm es am obliged to create an item before the addition of a child (FDOC. DocumentElement. AppendChild (Next);) . when I draw the performance I noticed that my program exits the loop immediately following this line of code: FDOC. DocumentElement. AppendChild (Next); – user653395 Apr 20 '11 at 09:01

0 Answers0