Delphi Xml question


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
           Text := (FieldByName('Termek_Product').AsString);
... 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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
Try this:
Parentnode, NodeCData: IXMLNode;
NodeCData := XMLDoc.CreateNode(FieldByName('Product').AsString, ntCData, '');

Open in new window

Hi, try this.

Node := XMLDoc.CreateNode((FieldByName('Product').AsString), ntCData, '');
starhuAuthor Commented:

sinisav: I tried it and it correctly puts:

but I need

so I need to include in a <Name> tag
Sinisa VukSoftware architectCommented:
RootNode := XMLDoc.CreateNode('Name', ntElement, '');
NodeCData := XMLDoc.CreateNode('BlackJacket', ntCData, '');

Open in new window

... is this correct?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.