 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
RT Guest
|
Posted: Sun May 06, 2007 10:49 pm Post subject: Newbie question |
|
|
New to XML and am getting an 'invalid character' message when I try to add a
child node based on a counter. Also, if you notice anything in my coding
that should be done differently please fell free to suggest a better way.
procedure TWrap.WriteToXML(parent:IXMLNode);
var
baseNode,Node,segNode:IXMLNode;
seg:TWrapSegment;
i:integer;
s:wideString;
begin
if parent.HasChildNodes then
baseNode:=parent.ChildNodes.FindNode('Wrap');
if baseNode<>nil then //delete old data if it exists
parent.ChildNodes.Delete('Wrap');
if segmentCount=0 then
exit;
BaseNode:=parent.AddChild('Wrap');
node:=baseNode.AddChild('Position');
node.NodeValue:=position;
node:=baseNode.AddChild('SegmentCount');
node.NodeValue:=segmentCount;
node:=baseNode.AddChild('Segments');
seg:=TWrapSegment.Create;
for i:=0 to segmentCount-1 do
begin
s:=intToStr(i);
this is where I get an 'invalid character' message
segNode:=node.AddChild(s);
seg:=segments[i];
seg.writeToXML(segNode);
end;
end; |
|
| Back to top |
|
 |
Rob Cooke Guest
|
Posted: Mon May 07, 2007 1:09 am Post subject: Re: Newbie question |
|
|
On Sun, 6 May 2007 12:49:45 -0500, "RT" <ralph.tuttle (AT) visi (DOT) com> wrote:
| Quote: | begin
s:=intToStr(i);
this is where I get an 'invalid character' message
segNode:=node.AddChild(s);
Element names can't begin with a number. You might instead use something like <segment index="1" |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|