/// <summary> /// Replaces an include tag with the contents of the included documentation. /// </summary> /// <param name="element">The element containing the documentation.</param> /// <param name="documentationNode">The documentation node within the documentation.</param> /// <param name="includedDocument">The included document.</param> /// <param name="includedDocumentationNode">The included node within the included document.</param> /// <returns>Returns true on success; false otherwise.</returns> private bool ReplaceIncludeTagWithIncludedDocumentationContents(CsElement element, XmlNode documentationNode, CachedXmlDocument includedDocument, XmlNode includedDocumentationNode) { Param.AssertNotNull(element, "element"); Param.AssertNotNull(documentationNode, "documentationNode"); Param.AssertNotNull(includedDocument, "includedDocument"); Param.AssertNotNull(includedDocumentationNode, "includedDocumentationNode"); try { // Insert the contents of the included documentation node immediately after the 'include' node. XmlNode previousNode = documentationNode; foreach (XmlNode includedDocumentationNodeChild in includedDocumentationNode.ChildNodes) { // Import the linked documentation node into the element's documentation object. XmlNode importedNode = documentationNode.OwnerDocument.ImportNode(includedDocumentationNodeChild, true); // Resolve any 'include' tags within the linked documentation. this.InsertIncludedDocumentationForNode(element, Path.GetDirectoryName(includedDocument.FilePath), importedNode); // Replace the original 'include' tag with the linked documentation contents. documentationNode.ParentNode.InsertAfter(importedNode, previousNode); previousNode = importedNode; } // Remove the original 'include' node. documentationNode.ParentNode.RemoveChild(documentationNode); } catch (XmlException) { return false; } return true; }
} // default constructor public CacheEventArgs(CachedXmlDocument <UiBroadcastDiscovery> cachedDiscovery) { CachedDiscovery = cachedDiscovery; } // constructor
/// <summary> /// Replaces an include tag with the contents of the included documentation. /// </summary> /// <param name="element"> /// The element containing the documentation. /// </param> /// <param name="documentationNode"> /// The documentation node within the documentation. /// </param> /// <param name="includedDocument"> /// The included document. /// </param> /// <param name="includedDocumentationNodes"> /// The included nodes within the included document. /// </param> /// <returns> /// Returns true on success; false otherwise. /// </returns> private bool ReplaceIncludeTagWithIncludedDocumentationContents( CsElement element, XmlNode documentationNode, CachedXmlDocument includedDocument, XmlNodeList includedDocumentationNodes) { Param.AssertNotNull(element, "element"); Param.AssertNotNull(documentationNode, "documentationNode"); Param.AssertNotNull(includedDocument, "includedDocument"); Param.AssertNotNull(includedDocumentationNodes, "includedDocumentationNode"); try { XmlNode previousNode = documentationNode; foreach (XmlNode includedDocumentationNode in includedDocumentationNodes) { XmlNode importedNode = documentationNode.OwnerDocument.ImportNode(includedDocumentationNode, true); // Resolve any 'include' tags within the linked documentation. this.InsertIncludedDocumentationForNode(element, importedNode); // Replace the original 'include' tag with the linked documentation contents. documentationNode.ParentNode.InsertAfter(importedNode, previousNode); previousNode = importedNode; } // Remove the original 'include' node. documentationNode.ParentNode.RemoveChild(documentationNode); } catch (XmlException) { return false; } return true; }