
Untitled
By: a guest on
Aug 7th, 2012 | syntax:
None | size: 1.09 KB | hits: 8 | expires: Never
Is this XML valid, and how to create it with TXMLDocument
<?xml version="1.0"?>
<p class="leaders">
Todd
<span class="leader-type">.</span>
R
<span class="leader-type">.</span>
Colas
</p>
p
|_ attributes
| |_ "class"="leaders"
|
|_ children
|_ #text "Todd"
|
|_ span
| |_ attributes
| | |_ "class"="leader-type"
| |
| |_ children
| |_ #text "."
|
|_ #text "R"
|
|_ span
| |_ attributes
| | |_ "class"="leader-type"
| |
| |_ children
| |_ #text "."
|
|_ #text "Colas"
Doc.Active := False;
Doc.Active := True;
Node := Doc.AddChild('p');
Node.Attributes['class'] := 'leaders';
Child := Doc.CreateNode('Todd', ntText);
Node.ChildNodes.Add(Child);
Child := Node.AddChild('span');
Child.Attributes['class'] := 'leader-type';
Child.Text := '.';
Child := Doc.CreateNode('R', ntText);
Node.ChildNodes.Add(Child);
Child := Node.AddChild('span');
Child.Attributes['class'] := 'leader-type';
Child.Text := '.';
Child := Doc.CreateNode('Colas', ntText);
Node.ChildNodes.Add(Child);
Doc.SaveTo...(...); // generate the XML to your preferred output