foDoc: IXMLDOMDocument;
foFind: IXMLDOMNode;
foNew: IXMLDOMNode;
foAttr: IXMLDOMNode;
FoFiles: TStringList;
begin
GetFilesInDirectory(fsSearchDir, fsFileMask, FoFiles, fiSubfolder = 1);
try
CoInitialize(
Nil);
foDoc := CoDOMDocument.Create;
foDoc.async := False;
if foDoc.load(FoFiles.Strings[0])
then
begin
foFind := foDoc.documentElement.selectSingleNode(fsFindNode);
if Assigned(foFind)
then
begin
Writeln(foFind.text);
fsSnippet1 := copy(foFind.text, fiExtract11, fiExtract12);
fsSnippet2 := copy(foFind.text, fiExtract21, fiExtract22);
fsTag := fsSnippet1 + fsDelimiter + fsSnippet2;
foFind := foDoc.documentElement.selectSingleNode(fsSaveNode);
if Assigned(foFind)
then
begin
foNew := foDoc.createNode(1, fsNodeName, '
');
foNew.text := fsTag;
foAttr := foDoc.createNode(2, '
name', '
');
foAttr.text := fsNodeAttribut;
foNew.attributes.setNamedItem(foAttr);
foFind.appendChild(foNew);
foDoc.save(FoFiles.Strings[0]);
end;
end;
end
else
begin
Writeln('
fehler');
Readln;
end;
// foDoc._Release;
// CoUninitialize;
except
on E:
Exception do
begin
Writeln(E.ClassName, '
: ', E.
Message);
end;
end;
FreeandNil(Foini);
FoFiles.Free;
end.