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
______________________________________________________________
Show quoted text 5 lines
Od: Felipe Monteiro de Carvalho
Komu: "FPC-Pascal users discussions"
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