[fpc-pascal] TDomNode to text and/or document

Vojtěch Čihák vojtech.cihak at atlas.cz
Mon Sep 22 12:53:41 CEST 2014


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.carvalho at gmail.com>
> Komu: "FPC-Pascal users discussions" <fpc-pascal at 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 at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal <http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140922/4446789f/attachment.html>


More information about the fpc-pascal mailing list