Saturday, 26 March 2016

XML : Updating existing XML files in PowerShell with new elements

I'm currently writing a GUI with PowerShell which stores most of its data in a XML file.

Every now and then I get new ideas what to store in the XML file. This means most of the time that I add new elements and attributes. (sometimes I also delete a few)

The result is always that I delete the old .XML and let my code generate a new one. With this way however I loose all the data stored in the old .XML

Are there any other (easy and lightweight) solutions than writing a complex UpdateXML function for a complex .XML file?

While searching I stumbled upon XML schemas (.XSD files). Do I understand this right, that I can use the .XSD Files to validate the .xml and even add new elements and attributes to it? Could they help me updating my existing .xml files? Or are there other ways?

No comments:

Post a Comment