Strange problem with multiple layers

Hello!

I have a strange problem with loading a document with two layers. I have the bottom layer, which serves for holding multiple GoSheets, which represent the pages for printing. This layer is "locked" (AllowSelect and AllowEdit are false), so it can't be changed directly. All other objects are placed on the top layer, which is "normal". After that, my intention was to implement a custom PrintController, like it was explained in one other thread. I have also considdered your proposals in that topic about using multiple GoViews. Unfortunately, my bosses would like to have everything on the same GoView, because of the better understanding of the drawn schemmas, and for consistency with the older version of the same tool.
My problem is placing the objects on the right layers while loading the xml file. When I had only one layer, everything was placed on it, and I haven't had any problems. Now, when I decided do separate the changable and unchangable objects on separate layers, load function places all parsed objects on the same (top) layer. I have checked the documentation, but wasn't able to find the right function to override. Can you please elaborate on my problem and perhaps provide some suggestions how to do it? Thanks.

We don’t have any samples that demonstrate layers & XML.

There are different ways to accomplish this...
1) actually store a tag (like a layer name) in each of the objects when you write it to XML. (this may be overkill if you are just adding sheets to the other layers)

2) (easier) do it implicitly by having classes that know what layer to put themselves in... (i.e. GoSheetLayer1)
3) (easiest) just override GoDocument.Add to see if the argument object is a GoSheet, and if so, add it to the background layer, and if not, call the base method, assuming the GoDocument.DefaultLayer is the regular layer.

I like the third choice . The genuine problem was I have put the GoSheet in the right layer inside the page XMLTransformer’s overriden ConsumeObjectFinish function, but after the ending of the function, the sheet’s (page’s) position has changed, it was moved to the front layer.

I haven't tried the first two choices, but I have tried something similar, using the GetType and typeof constructs to detect the objects which go to the back layer and putting everything else in the front one.
I will try the third choice tomorrow, and I hope to succeed. Thank you for your trouble. If I fail I will post again with the more detailed explanation of everything I've tried.
EDIT:
Yeah, it worked! I used the third method, overrode the GoDocument's Add method to choose the right layer for each object. If anyone else has this problem, this method works fine.