//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ namespace System.IdentityModel { using System.Xml; /// /// Class wraps a given reader and delegates all XmlDictionaryReader calls /// to the inner wrapped reader. /// public class DelegatingXmlDictionaryReader : XmlDictionaryReader { XmlDictionaryReader _innerReader; /// /// Initializes a new instance of /// protected DelegatingXmlDictionaryReader() { } /// /// Initializes the Inner reader that this instance wraps. /// /// XmlDictionaryReader to wrap. protected void InitializeInnerReader(XmlDictionaryReader innerReader) { if (innerReader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("innerReader"); } _innerReader = innerReader; } /// /// Gets the wrapped inner reader. /// protected XmlDictionaryReader InnerReader { get { return _innerReader; } } /// /// Gets the value of the attribute with the specified index. /// /// index of the attribute. /// Attribute value at the specified index. public override string this[int i] { get { return _innerReader[i]; } } /// /// Gets the value of the attribute with the specified System.Xml.XmlReader.Name. /// /// The qualified name of the attribute. /// The value of the specified attribute. If the attribute is not found, /// null is returned. public override string this[string name] { get { return _innerReader[name]; } } /// /// Gets the value of the attribute with the specified System.Xml.XmlReader.LocalName and /// System.Xml.XmlReader.NamespaceURI from the wrapped reader. /// /// The local name of the attribute. /// The namespace URI of the attribute. /// The value of the specified attribute. If the attribute is not found, /// null is returned. public override string this[string name, string namespaceURI] { get { return _innerReader[name, namespaceURI]; } } /// /// Gets the number of Attributes at the current reader position. /// public override int AttributeCount { get { return _innerReader.AttributeCount; } } /// /// Gets the base Uri of the current node. /// public override string BaseURI { get { return _innerReader.BaseURI; } } /// /// Gets the Depth of the current node. /// public override int Depth { get { return _innerReader.Depth; } } /// /// Gets a value indicating if reader is positioned at the end of the stream. /// public override bool EOF { get { return _innerReader.EOF; } } /// /// Gets a value indicating if the current node can have a /// System.Xml.XmlReader.Value. /// public override bool HasValue { get { return _innerReader.HasValue; } } /// /// Gets a value indicating if the current node is an attribute that /// was generated from the default value defined in the DTD or Schema. /// public override bool IsDefault { get { return _innerReader.IsDefault; } } /// /// Gets a value indicating if the current node. /// public override bool IsEmptyElement { get { return _innerReader.IsEmptyElement; } } /// /// Gets the local name of the current node. /// public override string LocalName { get { return _innerReader.LocalName; } } /// /// Gets the qualified name of the current node. /// public override string Name { get { return _innerReader.Name; } } /// /// Gets the namespace URI of the current node. /// public override string NamespaceURI { get { return _innerReader.NamespaceURI; } } /// /// Gets the System.Xml.XmlNameTable associated with this instance. /// public override XmlNameTable NameTable { get { return _innerReader.NameTable; } } /// /// Gets the type of the current node. /// public override XmlNodeType NodeType { get { return _innerReader.NodeType; } } /// /// Gets the prefix of the current node. /// public override string Prefix { get { return _innerReader.Prefix; } } /// /// Gets the quotation mark character used to enclose the attribute node. (" or ') /// public override char QuoteChar { get { return _innerReader.QuoteChar; } } /// /// Gets the System.Xml.ReadState of the reader. /// public override ReadState ReadState { get { return _innerReader.ReadState; } } /// /// Gets the text value of the current node. /// public override string Value { get { return _innerReader.Value; } } /// /// Gets the Common Language Runtime (CLR) type of the curent node. /// public override Type ValueType { get { return _innerReader.ValueType; } } /// /// Gets the xml:lang scope. /// public override string XmlLang { get { return _innerReader.XmlLang; } } /// /// Gets the current xml:space scope. If no xml:space scope exists, this property /// defaults to XmlSpace.None. /// public override XmlSpace XmlSpace { get { return _innerReader.XmlSpace; } } /// /// Closes the reader and changes the System.Xml.XmlReader.ReadState /// to Closed. /// public override void Close() { _innerReader.Close(); } /// /// Gets the value of the attribute at the given index. /// /// The index of the attribute. The index is 0 based index. /// The value of the attribute at the specified index. /// The method does not move the reader position. public override string GetAttribute(int i) { return _innerReader.GetAttribute(i); } /// /// Gets the value of the attribute with the given name. /// /// The qualified name of the attribute. /// The value of the attribute. If the attribute is not found null /// is returned. /// The method does not move the reader position. public override string GetAttribute(string name) { return _innerReader.GetAttribute(name); } /// /// Gets the value of the attribute with the given name and namespace Uri. /// /// The local name of the attribute. /// The namespace of the attribute. /// The value of the attribute. If the attribute is not found /// null is returned. /// The method does not move the reader. public override string GetAttribute(string name, string namespaceURI) { return _innerReader.GetAttribute(name, namespaceURI); } /// /// Resolves a namespace prefix in the current element scope. /// /// Prefix whose namespace Uri to be resolved. /// The namespace Uri to which the prefix matches or null if no matching /// prefix is found. public override string LookupNamespace(string prefix) { return _innerReader.LookupNamespace(prefix); } /// /// Moves to the attribute with the specified index. /// /// The index of the attribute. public override void MoveToAttribute(int i) { _innerReader.MoveToAttribute(i); } /// /// Moves to the attribute with the given local name. /// /// The qualified name of the attribute. /// true if the attribute is found; otherwise, false. public override bool MoveToAttribute(string name) { return _innerReader.MoveToAttribute(name); } /// /// Moves to the attribute with the specified System.Xml.XmlReader.LocalName and /// System.Xml.XmlReader.NamespaceURI. /// /// The local name of the attribute. /// The namespace URI of the attribute. /// true if the attribute is found; otherwise, false. public override bool MoveToAttribute(string name, string ns) { return _innerReader.MoveToAttribute(name, ns); } /// /// Moves to a node of type Element. /// /// true if the reader is positioned on an element else false public override bool MoveToElement() { return _innerReader.MoveToElement(); } /// /// Moves to the first attribute. /// /// Returns true if the reader is positioned at a attribute else false. /// When returning false the reader position will not be changed. public override bool MoveToFirstAttribute() { return _innerReader.MoveToFirstAttribute(); } /// /// Moves the reader to the next attribute. /// /// Returns true if the reader is positioned at an attribute else false. /// When returning false the reader position will not be changed. public override bool MoveToNextAttribute() { return _innerReader.MoveToNextAttribute(); } /// /// Reads the next node from the stream. /// /// true if the next node was read successfully. public override bool Read() { return _innerReader.Read(); } /// /// Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes. /// /// true if there are nodes to return.false if the reader is not positioned on /// an attribute node when the initial call is made or if all the attribute values /// have been read. public override bool ReadAttributeValue() { return _innerReader.ReadAttributeValue(); } /// /// Reads the content and returns the Base64 decoded binary bytes. /// /// The buffer into which to copy the resulting text. This value cannot be null. /// The offset into the buffer where to start copying the result. /// The maximum number of bytes to copy into the buffer. /// The number of bytes written to the buffer. public override int ReadContentAsBase64(byte[] buffer, int index, int count) { return _innerReader.ReadContentAsBase64(buffer, index, count); } /// /// Reads the content and returns the BinHex decoded binary bytes. /// /// The buffer into which to copy the resulting text. This value cannot be null. /// The offset into the buffer where to start copying the result. /// The maximum number of bytes to copy into the buffer. /// The number of bytes written to the buffer. public override int ReadContentAsBinHex(byte[] buffer, int index, int count) { return _innerReader.ReadContentAsBinHex(buffer, index, count); } /// /// Reads the content and returns the contained string. /// public override System.Xml.UniqueId ReadContentAsUniqueId() { return _innerReader.ReadContentAsUniqueId(); } /// /// Reads large streams of text embedded in an XML document. /// /// The array of characters that serves as the buffer to which the text contents /// are written. This value cannot be null. /// The offset within the buffer where the System.Xml.XmlReader can start to /// copy the results. /// The maximum number of characters to copy into the buffer. The actual number /// of characters copied is returned from this method. /// The number of characters read into the buffer. The value zero is returned /// when there is no more text content. public override int ReadValueChunk(char[] buffer, int index, int count) { return _innerReader.ReadValueChunk(buffer, index, count); } /// /// Resolves the entity reference for EntityReference nodes. /// public override void ResolveEntity() { _innerReader.ResolveEntity(); } } }