Forum

Make an XML from a value spread

Hi,

I want to do the following:

  1. Read a XML with a list of coordinates
  2. Edit some of these coordinates interactively
  3. Save the XML

In Java this would be very easy because I can edit node values on the original XML DOM structure and then just save it. Can this be done in vvvv? I am using XPath node to extract values from the XML string, but how could I use it to update them in the XML string?

The only possible solution I thought of is by using XSLT node to build an completely new XML string based on the extracted data. But while XSLT node gets an XML as input I have my coordinates in spreads of values. So, if I need an XML, how can I convert a spread into an XML structure/string?

Still, I’d rather be able to modify the original XML file.

Thank you!

Nuno

Setting parts of an XML document with XPath style syntax would be a good feature in vvvv - for now it is not possible. You could use AsString and string nodes to create some XML fragements and use XSLT to morph these into something resembling your original file - Although XSLT is cool, it might be easier to use RegExpr or Substitute (String).

For your editing application: Use a XML string as a temporary storage for values is most probably slow. Recommended technique would be a FrameDelay feedback loop holding the current positions of your coordinates, which can be replaced to the contents of your read file (use a Switch), or flushed into file when saving.