findShared() function not working properly?

Hello!

I have a problem in the GoXmlTransformer classes with the search of the GoLabeledLink objects. I have to have a pointer from some certain objects to my links. The problem occures while loading. When I save the schemma to the xml file, everything works fine. I use writer.findShared() function to write down the id number of the link to use. When I want to read it, the reader.findShared() returns the null value. I used it the same way I used it for the ports, but it seems it doesn't work. Is it maybe because the links are created the last (so they couldn't have been found), or maybe something else? How could I fix this?
P.S. Every one of my transformers has IdAttributeUsedForSharedObjects set to true.
Thank you in advance.

The first thing you need to figure out is whether or not that link is supposed to exist at that time that you call GoXmlReader.FindShared. You imply that perhaps it shouldn’t exist yet. But you should make sure. Perhaps just looking at the source XML data will be sufficient to confirm that.

So if you are trying to refer to something that doesn’t exist yet, because it hasn’t been read in yet, you’ll either need to make do some other way, or (more commonly) you’ll need to fix up the missing reference in a second pass.

GoXmlReader and GoXmlTransformer provide support for this for your convenience. Where you find that the thing you want doesn’t exist yet, you can call GoXmlReader.AddDelayedRef, passing it the transformer’s object, some property identification, and unresolved ID. Then, in a second pass, the reader will call your GoXmlTransformer.UpdateReference method with the transformer’s object, that property identification, and the resolved reference object.

Please read the documentation for these methods. There are a few examples of this, but I hope they aren’t too complicated to understand quickly.