Hi,
 
this is working code:
 
...
if not assigned(XMLDoc) then XMLDoc:=TXMLDocument.Create;
  with XMLDoc do
    begin
      if not assigned(DocumentElement) then
        begin
          aNode:=CreateElement(cRoot);
          AppendChild(aNode); 
        end;  
      if ASchemeNode='' then ASchemeNode:=cScheme;
      aNode:=DocumentElement.FindNode(ASchemeNode); 
      if not assigned(aNode) then
        begin
          aNode:=CreateElement(ASchemeNode);
          DocumentElement.AppendChild(aNode);
        end;  
   ...
end;  
 
so simply you have to create DocumentElement (i.e. root node) and append 
children there.
 
Vojtěch 
______________________________________________________________
Od: Felipe Monteiro de Carvalho <felipemonteiro.carva...@gmail.com>
Komu: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org>
Datum: 22.09.2014 12:38
Předmět: [fpc-pascal] TDomNode to text and/or document

Hello,

I have a TDomNode (laz2_dom, but I guess it should be the same for all
implementations).

Is it possible to get a TXMLDocument from it? I tried:

 lDoc := TXMLDocument.Create;
 try
   lDoc.AppendChild(ANode);

but it crashes =(

Is it possible to get the full text of this node? something like:

<svg bla bla><sub item>etc etc etc</subitem></svg>

TextContent doesn't help at all here.

thanks,
--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 
<http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to