09-06-2010 06:18 AM
I am struggling to find an example of how to update an already existing elment text value. I can load the XML string without a problem, but I would like to change that single element of the XML string and output the whole string with the change. Can someone point me in the right direction?
<?xml version="1.0" encoding="utf-8"?> <TestStructure> <Sample>0</Sample> </TestStructure>
as the input, and then
<?xml version="1.0" encoding="utf-8"?> <TestStructure> <Sample>[UPDATED VALUE]</Sample> </TestStructure>
as the output.
Thank you.
09-06-2010 06:51 AM
If your XML-string format is fixed then you can easily insert the new value with "Format Into String" -function and then feeding the changed XML-string into the Write method.
Note: The "New value" can naturally also be text. In that case replace the Numeric control with String control and use %s instead of %d in string format..
BR,
Cerati
09-06-2010 06:55 AM
Thanks, but unfortunately I can't count on the XML structure being that consistent. I was just using a small example. I'm working with a rather large XML file and I was hoping there was a way to do this a little more dynamically. For example, find the existing node I want to edit, update the value, then output the new DOM document. I can't seem to get the right combination of property and method nodes to perform this function.
09-06-2010 07:15 AM
Okey. Parsing and updating the XML-content itself is easy. The updating-part I do dynamically myself using the Match pattern -function and recreating the XML-output string. I'm not sure if there's any good general help on finding the right nodes and properties. I know the methods and structure of my own WebService, so that part is no problem for me.
BR,
Cerati
09-23-2010 03:55 PM
This example replaces the Sample's value. It is not a complete solution, but maybe can help you
09-24-2010 05:44 AM
Hi,
You can update the xml by using labVIEW drivers also.
This is also one of the way...
Try it.
<<Kudos are welcome>>