TXMLDocumentNodeIndentStr (Delphi)
Description
The following example uses the NodeIndentStr property.
Code
procedure Test_NodeIndentStr;
const
CIndentation = ' ';
var
LDocument: IXMLDocument;
LNode: IXMLNode;
begin
LDocument := TXMLDocument.Create(nil);
LDocument.Active := True;
LDocument.NodeIndentStr := CIndentation;
LDocument.Options := LDocument.Options + [doNodeAutoIndent];
{ Uncomment the following line to see the formatting difference. }
//LDocument.Options := LDocument.Options - [doNodeAutoIndent];
{ Create some nodes. }
LDocument.DocumentElement := LDocument.CreateNode('GMC', ntElement);
LNode := LDocument.DocumentElement.AddChild('SUV');
LNode.Text := 'Typhoon';
{ Display document content. }
Writeln(LDocument.XML.Text);
end;
Uses
- Xml.XMLDoc.TXMLDocument.Active ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.NodeIndentStr ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.Options ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.CreateNode ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.XML ( fr | de | ja )