|
|
|
Re: Marshall XML in Model [message #721363 is a reply to message #721277] |
Thu, 01 September 2011 15:09 |
Konstantin Komissarchik Messages: 1077 Registered: July 2009 |
Senior Member |
|
|
Your original attempt was more correct. You must instantiate your model around the resource you intend to use. You cannot hook it up after the fact.
Sapphire model reads/writes to the resource as you manipulate the model. For instance, XmlResource is implemented on a live XML DOM. As you manipulate the model, the XML DOM is manipulated. When you save, all that happens is that DOM is serialized. This is different from how JAXB operates, where serialization to XML happens on save.
XmlResourceStore store = new XmlResourceStore(new File("/path/to/xmlFile.xml"));
RootXmlResource xmlResource = new RootXmlResource(store);
IDataProcessingUnit dpu = IDataProcessingUnit.TYPE.instantiate(xmlResource);
// Manipulate the model.
dpu.resource.save()
Hope this clarifies.
- Konstantin
[Updated on: Thu, 01 September 2011 15:10] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02361 seconds