Link to home
Start Free TrialLog in
Avatar of starhu
starhu

asked on

Delphi Xml question

Hello,

I need to add an "ntCData" type xml child to a sub-child.

My problem is that
1. XMLDoc.CreateNode((FieldByName('Product').AsString), ntCData, '');
allows it but it would put it to top level.

2.        With NodeProducts.AddChild('Product', -1) Do
         Begin
           Text := (FieldByName('Termek_Product').AsString);
         End;
... will put the node where I want, but it won't be ntCData type.

So I want to know how to put an "ntCData" type child under a chosen another child.

Thank you very much
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Try this:
Parentnode, NodeCData: IXMLNode;
....
NodeCData := XMLDoc.CreateNode(FieldByName('Product').AsString, ntCData, '');
Parentnode.ChildNodes.Add(NodeCData);
....

Open in new window

Hi, try this.

Node := XMLDoc.CreateNode((FieldByName('Product').AsString), ntCData, '');
NodeProducts.ChildNodes.Add(Node);
Avatar of starhu
starhu

ASKER

Hello,

sinisav: I tried it and it correctly puts:
<![CDATA[BlackJacket]]>

but I need
<Name><![CDATA[BlackJacket]]></Name>

so I need to include in a <Name> tag
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial