Problems archiving to XML
Timothy Davison <[email protected]> Sun, 20 Mar 2005 23:59:28 -0700
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <[email protected]> |
Hi,
We are trying to archive an object containing a list of objects (we
have done the dependencies correctly I think). The resulting XML file
will not load correctly when we dearchive it. The problem seems to be
the indexes in the archived XML which are not being incremented
correctly. If we manually edit the file, it will load correctly. Is
this a bug? Or have we done something wrong.
I hope posting this code isn't a bad thing (i simplified it for length)
@use Object.
@use Control.
Controller TestArchive.
Control : TestArchive {
+ to init :
file (EvolveFile object).
fileIdx (FileIndex object).
fileIdx = new FileIndex.
# add a EvolveFile with name hi and fitness 100 to fildIx
file = (1 new EvolveFile).
file set-file-name to "hi".
file set-fitness to 100.
# add it
fileIdx add-file the file.
# add a EvolveFile with name hi and fitness 100 to fildIx
file = (1 new EvolveFile).
file set-file-name to "bye".
file set-fitness to 200.
# add it
fileIdx add-file the file.
fileIdx archive-as-xml file "testArchive".
free fileIdx.
self dearchive-xml file "testArchive".
fileIdx = (all FileIndex){0}.
# select in viewer to debug (OS X)
self click on fileIdx.
}
Object : FileIndex {
+ variables:
fileList (list).
+ to add-file the file (EvolveFile object):
push file onto fileList.
self add-dependency on file.
}
Object : EvolveFile {
+ variables:
fitness (int).
fileName (string).
+ to set-file-name to name (string):
fileName = name.
+ to set-fitness to fit (int):
fitness = fit.
}
_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve