diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-10-31 16:27:49 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-10-31 16:27:49 -0700 |
commit | 55d6e4be43225184f9a656e6d9cc8fc1e8e7387b (patch) | |
tree | c382ef957455af8a39f80789dff9b112e97c2fe6 /tools/Sandcastle/Source/BuildAssembler/BuildComponents/DisplayComponent.cs | |
parent | 07a8ecbc4fc50d11179f7e0b3fadb9f2be430ae5 (diff) | |
parent | ebf5efb48cddbfaf08aec24117b7c5f9626f1c02 (diff) | |
download | DotNetOpenAuth-55d6e4be43225184f9a656e6d9cc8fc1e8e7387b.zip DotNetOpenAuth-55d6e4be43225184f9a656e6d9cc8fc1e8e7387b.tar.gz DotNetOpenAuth-55d6e4be43225184f9a656e6d9cc8fc1e8e7387b.tar.bz2 |
Merge branch 'contracts'
Diffstat (limited to 'tools/Sandcastle/Source/BuildAssembler/BuildComponents/DisplayComponent.cs')
-rw-r--r-- | tools/Sandcastle/Source/BuildAssembler/BuildComponents/DisplayComponent.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/DisplayComponent.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/DisplayComponent.cs new file mode 100644 index 0000000..33f0934 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/DisplayComponent.cs @@ -0,0 +1,46 @@ +// Copyright © Microsoft Corporation. +// This source file is subject to the Microsoft Permissive License. +// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. +// All other rights reserved. + +using System; +using System.Xml; +using System.Xml.XPath; + +namespace Microsoft.Ddue.Tools { + + + public class DisplayComponent : BuildComponent { + + private string xpath_format = "/"; + + public DisplayComponent (BuildAssembler assembler, XPathNavigator configuration) : base(assembler, configuration) { + XPathNavigator xpath_format_node = configuration.SelectSingleNode("xpath"); + if (xpath_format_node != null) xpath_format = xpath_format_node.Value; + } + + public override void Apply (XmlDocument document, string key) { + string xpath = String.Format(xpath_format, key); + + Object result = document.CreateNavigator().Evaluate(xpath); + + if (result == null) { + Console.WriteLine("null result"); + return; + } + + XPathNodeIterator nodes = result as XPathNodeIterator; + if (nodes != null) { + foreach (XPathNavigator node in nodes) { + Console.WriteLine(node.OuterXml); + } + return; + } + + Console.WriteLine(result.ToString()); + + } + + } + +} |