//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation, Scott Hanselman. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Xrds { using System; using System.Xml; using System.Xml.XPath; using DotNetOpenAuth.Messaging; using Validation; /// /// A node in an XRDS document. /// internal class XrdsNode { /// /// The XRD namespace xri://$xrd*($v*2.0) /// internal const string XrdNamespace = "xri://$xrd*($v*2.0)"; /// /// The XRDS namespace xri://$xrds /// internal const string XrdsNamespace = "xri://$xrds"; /// /// Initializes a new instance of the class. /// /// The node represented by this instance. /// The parent node. protected XrdsNode(XPathNavigator node, XrdsNode parentNode) { Requires.NotNull(node, "node"); Requires.NotNull(parentNode, "parentNode"); this.Node = node; this.ParentNode = parentNode; this.XmlNamespaceResolver = this.ParentNode.XmlNamespaceResolver; } /// /// Initializes a new instance of the class. /// /// The document's root node, which this instance represents. protected XrdsNode(XPathNavigator document) { Requires.NotNull(document, "document"); Requires.That(document.NameTable != null, "document", "requires document.NameTable != null"); this.Node = document; this.XmlNamespaceResolver = new XmlNamespaceManager(document.NameTable); } /// /// Gets the node. /// internal XPathNavigator Node { get; private set; } /// /// Gets the parent node, or null if this is the root node. /// protected internal XrdsNode ParentNode { get; private set; } /// /// Gets the XML namespace resolver to use in XPath expressions. /// protected internal XmlNamespaceManager XmlNamespaceResolver { get; private set; } } }