XmlDocRepository.ResolveInheritDoc Method

Namespace
Kampute.DocToolkit.XmlDoc
Assembly
  • Kampute.DocToolkit.dll

Definition

Resolves the inheritdoc elements in the specified XML element.
protected virtual bool ResolveInheritDoc(XElement element)

Parameters

element XElement
The element to resolve its inheritdoc element.

Returns

bool
true if the inheritdoc element was resolved; otherwise, false.

Exceptions

ArgumentNullException
Thrown when element is null.

Remarks

This method attempts to resolve each inheritdoc element by finding the base member's documentation and merging it into the current element.

If an inheritdoc element has a cref attribute, it uses that to find the base member. If not, it attempts to infer the inherited member from the current element's name attribute. If the base member's documentation is found, its child elements are copied into the current element, and the inheritdoc element is removed.

If an inheritdoc element has a path attribute, only the elements its XPath expression selects from the base member's documentation are copied. The expression is evaluated against a document whose root element is the base member's member element, with that element as the context node; a rooted expression is taken relative to the member element, so /summary and summary both select the base member's summary. An invalid expression, or one that selects no elements, inherits nothing.

Inherited elements do not override locally defined elements. An inherited element is skipped when the current element locally defines an element with the same name that refers to the same target through its name, cref, or href attribute, or, for elements without such an attribute, any element with the same name.

Distinct inherited elements are preserved even when they refer to the same target, such as multiple exception conditions for the same exception type. Identical inherited elements are copied only once.