Add XML Fragment to Existing XML

Find and share HowTos to various installations / configurations!
Search

Post Reply
3 posts • Page 1 of 1
Nils.Bunje
Posts: 1
Joined: Wed May 30, 2018 10:15 am

Add XML Fragment to Existing XML

Post by Nils.Bunje »

Hi all,

i want to add an XML fragment to an existing XML document and can't find a way.

e.g.:

Code: Select all

string xml ="<foo><bar/></foo>";
string subxml = "<coockie>chocolate</coockie>"; 

string result = "<foo><bar><coockie>chocolate</coockie></bar></foo>";
does anybody have an idea how to solve this problem?

Best Regards,
Nils Bunje.

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: Add XML Fragment to Existing XML

Post by leoknipp »

If you want to modify the content of a text file you can use the file functions in WinCC OA.
For details please have a look at the WinCC OA Documentation: CONTROL --> Types of functions --> File functions.

Best Regards
Leopold Knipp
Senior Support Specialist

LIGO
Posts: 27
Joined: Tue Aug 02, 2016 1:57 pm

Re: Add XML Fragment to Existing XML

Post by LIGO »

Hi Nils,

There is a set of functions for manipulating XML data in a more convenient way than parsing it by yourself.
Take a look at the chapter "CONTROL --> Types of functions --> XML Control Extension". At first glance, those functions are not obvious but they are quite handy.

Regards,
Leonid Solovev

Post Reply
3 posts • Page 1 of 1