GoDigram for .NET Framework and .NET Core
Northwoods.Go.Xml Namespace / GoXmlReaderWriterBase Class / ObjectStack Property
In This Topic
    ObjectStack Property
    In This Topic
    Gets an List of Object acting as a stack of Objects that have been created during the walking of the XML tree during Consume, or that have been seen during Generate.
    Syntax
    public List<object> ObjectStack {get;}
    Remarks

    During a GoXmlReader.Consume, the bottom object, at index zero, will be the result of ConsumeRootElement. ConsumeObject will push the result of InvokeAllocate onto this stack just before calling InvokeConsumeBody, and then pop it off immediately afterwards. Hence during the processing of an element's body, i.e. during calls to IGoXmlTransformer.ConsumeBody, the value of ParentObject will be that parent element. Access to the whole stack of objects may be needed for establishing the context in which objects should be searched for, created, or modified. For example, when reading an element representing a node that has nested elements representing parts of the node, such as ports, the transformer for ports may need to implement GoXmlTransformer.Allocate to return an existing port of the node, rather than blindly allocating a new one that would conflict with the existing port.

    During a GoXmlWriter.Generate, the bottom object, at index zero, will be the value of Objects. GenerateObject will push the argument Object onto this stack just before calling GoXmlWriter.InvokeGenerateBody, and the pop it off immediately afterwards. Hence during the processing of an element's body, i.e. during calls to IGoXmlTransformer.GenerateBody, the value of ParentObject will be that "parent" object. Access to the whole stack of objects may be needed for establishing the context in which objects should generated, or to permit communication between the transformers for those objects.

    See Also