GoDigram for .NET Framework and .NET Core
Northwoods.Go.Xml Namespace / GoXmlTransformer Class / ConsumeBody Method
In This Topic
    ConsumeBody Method (GoXmlTransformer)
    In This Topic
    Consume elements that help define more details or parts of an object.
    Syntax
    public virtual void ConsumeBody( 
       object obj
    )

    Parameters

    obj
    Remarks

    If you want to read child (nested) XML elements and have transformer(s) defined for those kinds of elements, it is sufficient to set BodyConsumesChildElements to true and to override ConsumeChild to add those child objects to the parent object. For more sophisticated parsing/traversing of the child XML elements, you may want to override this method to do what you need.

    This is called by GoXmlReader.ConsumeObject. If BodyConsumesChildElements is true, this method iterates through the child elements of this XML node, calls ConsumeObject on each one, and then passes the resulting object to ConsumeChild. If XmlReader is available, because UseDOM is false, this method keeps reading until it encounters an EndElement XML node. Otherwise, if we are traversing a DOM, this method enumerates each of the ReaderNode's XML ChildNodes. If BodyConsumesChildElements is false, this calls ConsumeBody on the InheritsFromTransformer, to allow another specific transformer to implement this behavior, or else calls GoXmlWriter.InvokeConsumeBody, to allow this TransformerType's base Type to provide a default behavior.

    See Also