XmlUnspecifiedAttribute.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Xml / System / Xml / Dom / XmlUnspecifiedAttribute.cs / 1 / XmlUnspecifiedAttribute.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Xml 
{
    using System; 

    internal class XmlUnspecifiedAttribute: XmlAttribute {
        bool fSpecified = false;
 

        protected internal XmlUnspecifiedAttribute( string prefix, string localName, string namespaceURI, XmlDocument doc ) 
        : base( prefix, localName, namespaceURI, doc ) { 
        }
 
        public override bool Specified
        {
            get { return fSpecified;}
        } 

 
        public override XmlNode CloneNode(bool deep) { 
            //CloneNode is deep for attributes irrespective of parameter
            XmlDocument doc = OwnerDocument; 
            XmlUnspecifiedAttribute attr = (XmlUnspecifiedAttribute)doc.CreateDefaultAttribute(Prefix, LocalName, NamespaceURI);
            attr.CopyChildren( doc, this, true );
            attr.fSpecified = true; //When clone, should return the specifed attribute as default
            return attr; 
        }
 
        public override string InnerText { 
            set {
                base.InnerText = value; 
                fSpecified = true;
            }
        }
 
        public override XmlNode InsertBefore(XmlNode newChild, XmlNode refChild) {
            XmlNode node = base.InsertBefore( newChild, refChild ); 
            fSpecified = true; 
            return node;
        } 

        public override XmlNode InsertAfter(XmlNode newChild, XmlNode refChild) {
            XmlNode node = base.InsertAfter( newChild, refChild );
            fSpecified = true; 
            return node;
        } 
 
        public override XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild) {
            XmlNode node = base.ReplaceChild( newChild, oldChild ); 
            fSpecified = true;
            return node;
        }
 
        public override XmlNode RemoveChild(XmlNode oldChild) {
            XmlNode node = base.RemoveChild(oldChild); 
            fSpecified = true; 
            return node;
        } 

        public override XmlNode AppendChild(XmlNode newChild) {
            XmlNode node = base.AppendChild(newChild);
            fSpecified = true; 
            return node;
        } 
 
        public override void WriteTo(XmlWriter w) {
            if (fSpecified) 
                base.WriteTo( w );
        }

        internal void SetSpecified(bool f) { 
            fSpecified = f;
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Xml 
{
    using System; 

    internal class XmlUnspecifiedAttribute: XmlAttribute {
        bool fSpecified = false;
 

        protected internal XmlUnspecifiedAttribute( string prefix, string localName, string namespaceURI, XmlDocument doc ) 
        : base( prefix, localName, namespaceURI, doc ) { 
        }
 
        public override bool Specified
        {
            get { return fSpecified;}
        } 

 
        public override XmlNode CloneNode(bool deep) { 
            //CloneNode is deep for attributes irrespective of parameter
            XmlDocument doc = OwnerDocument; 
            XmlUnspecifiedAttribute attr = (XmlUnspecifiedAttribute)doc.CreateDefaultAttribute(Prefix, LocalName, NamespaceURI);
            attr.CopyChildren( doc, this, true );
            attr.fSpecified = true; //When clone, should return the specifed attribute as default
            return attr; 
        }
 
        public override string InnerText { 
            set {
                base.InnerText = value; 
                fSpecified = true;
            }
        }
 
        public override XmlNode InsertBefore(XmlNode newChild, XmlNode refChild) {
            XmlNode node = base.InsertBefore( newChild, refChild ); 
            fSpecified = true; 
            return node;
        } 

        public override XmlNode InsertAfter(XmlNode newChild, XmlNode refChild) {
            XmlNode node = base.InsertAfter( newChild, refChild );
            fSpecified = true; 
            return node;
        } 
 
        public override XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild) {
            XmlNode node = base.ReplaceChild( newChild, oldChild ); 
            fSpecified = true;
            return node;
        }
 
        public override XmlNode RemoveChild(XmlNode oldChild) {
            XmlNode node = base.RemoveChild(oldChild); 
            fSpecified = true; 
            return node;
        } 

        public override XmlNode AppendChild(XmlNode newChild) {
            XmlNode node = base.AppendChild(newChild);
            fSpecified = true; 
            return node;
        } 
 
        public override void WriteTo(XmlWriter w) {
            if (fSpecified) 
                base.WriteTo( w );
        }

        internal void SetSpecified(bool f) { 
            fSpecified = f;
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.

                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK