How can I indent a node in a XML-file

Posted on 2009-12-27
Medium Priority
Last Modified: 2013-11-23
How can I indent a node in a XML-file?
See attached file
Question by:Boogaard
  • 2
LVL 19

Accepted Solution

MerijnB earned 500 total points
ID: 26129909
I think you're asking the question wrong, I think what you want is (something like):

procedure TAVN_doorboekform01.cxButton7Click(Sender: TObject);
  ExportName: string;
  iNode, iOrder, iChild: IXMLNode;
  i: Integer;
  ExportName := 'C:\test.xml';
  XMLDoc1.Active := False;
  XMLDoc1.XML.Text := '';
  XMLDoc1.Active := True;
  XMLDoc1.DocumentElement := XMLDoc1.CreateNode('Bericht');
  iNode := XMLDoc1.DocumentElement.AddChild('Verzender');
  iChild := iNode.AddChild('Name');
  iChild.Text := 'Bill';
  iChild := iNode.AddChild('Gender');
  iChild.Text := 'Male';
  iChild := iNode.AddChild('Country');
  iChild.Text := 'Holland';
  iNode := XMLDoc1.DocumentElement.AddChild('Ontvanger');
  iChild := iNode.AddChild('Identificatie');
  iChild.Text := '456';
  iOrder := iNode.AddChild('Orders');
  iOrder.Text := '789';
  //the next nodes should be Indent
  //Order1, Order2 and Order3 should be a sub of Orders
  //how can I do that
  iChild := iOrder.AddChild('Order1');
  iChild.Text := '12';
  iChild := iOrder.AddChild('Order2');
  iChild.Text := '34';
  iChild := iOrder.AddChild('Order3');
  iChild.Text := '56';

Open in new window


Author Comment

ID: 26130006
Tanks, thats what I looked for.
Now I can try to make a file from 2 db tables.

LVL 19

Expert Comment

ID: 26130061
succes ermee! :)

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question