How can I indent a node in a XML-file

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

    Accepted Solution

    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

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

    LVL 19

    Expert Comment

    succes ermee! :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now