I have a XML enabled persistent class and a XML representation of some object of this class (object ID is available).
How can I use XML Reader (or some other mechanism) to automatically update this object?
The example in the documentation to %XML.Reader, does not work for you?
#include %occStatus // Create a new XML Reader class Set reader = ##class(%XML.Reader).%New() // Begin processing of the XML input Set sc=reader.OpenFile(filename) If $$$ISERR(sc) Do $system.OBJ.DisplayError(sc) Quit // Associate a class name with the XML element name Do reader.Correlate("Person","Sample.Person") // read Sample.Person objects from xml file Set Count=0 While reader.Next(.person,.sc) { Write person.Name_" imported.",! Set Count=Count+1 Set sc=person.%Save() If $$$ISERR(sc) Do $system.OBJ.DisplayError(sc) Quit } If $$$ISERR(sc) Do $system.OBJ.DisplayError(sc) Quit Write Count_" Sample.Person instances found."
It would create a new object.
I want to update already existing object.