Example #1
0
 public override void Close()
 {
     this.source = null;
     this.parent = null;
     this.root   = null;
     this.state  = System.Xml.ReadState.Closed;
 }
 public override void Close()
 {
     this.source = null;
     this.parent = null;
     this.root = null;
     this.state = System.Xml.ReadState.Closed;
 }
        public override bool Read()
        {
            if ((this.nodeType != XmlNodeType.Attribute) || !this.MoveToNextAttribute())
            {
                this.MoveNext(this.element.dataNode);
                switch (this.internalNodeType)
                {
                case ExtensionDataNodeType.None:
                    if (this.depth != 0)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.Runtime.Serialization.SR.GetString("InvalidXmlDeserializingExtensionData")));
                    }
                    this.nodeType       = XmlNodeType.None;
                    this.prefix         = string.Empty;
                    this.ns             = string.Empty;
                    this.localName      = string.Empty;
                    this.value          = string.Empty;
                    this.attributeCount = 0;
                    this.readState      = System.Xml.ReadState.EndOfFile;
                    return(false);

                case ExtensionDataNodeType.Element:
                case ExtensionDataNodeType.ReferencedElement:
                case ExtensionDataNodeType.NullElement:
                    this.PushElement();
                    this.SetElement();
                    break;

                case ExtensionDataNodeType.EndElement:
                    this.nodeType       = XmlNodeType.EndElement;
                    this.prefix         = string.Empty;
                    this.ns             = string.Empty;
                    this.localName      = string.Empty;
                    this.value          = string.Empty;
                    this.attributeCount = 0;
                    this.attributeIndex = -1;
                    this.PopElement();
                    break;

                case ExtensionDataNodeType.Text:
                    this.nodeType       = XmlNodeType.Text;
                    this.prefix         = string.Empty;
                    this.ns             = string.Empty;
                    this.localName      = string.Empty;
                    this.attributeCount = 0;
                    this.attributeIndex = -1;
                    break;

                case ExtensionDataNodeType.Xml:
                    break;

                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SerializationException(System.Runtime.Serialization.SR.GetString("InvalidStateInExtensionDataReader")));
                }
                this.readState = System.Xml.ReadState.Interactive;
            }
            return(true);
        }
 public override void Close()
 {
     if (this.IsXmlDataNode)
     {
         this.xmlNodeReader.Close();
     }
     else
     {
         this.Reset();
         this.readState = System.Xml.ReadState.Closed;
     }
 }
Example #5
0
        public override bool Read()
        {
            switch (this.state)
            {
            case System.Xml.ReadState.Initial:
            {
                this.state = System.Xml.ReadState.Interactive;
                XDocument source = this.source as XDocument;
                return((source == null) || this.ReadIntoDocument(source));
            }

            case System.Xml.ReadState.Interactive:
                return(this.Read(false));
            }
            return(false);
        }
 public override void Close()
 {
     if (this.IsXmlDataNode)
     {
         this.xmlNodeReader.Close();
     }
     else
     {
         this.Reset();
         this.readState = System.Xml.ReadState.Closed;
     }
 }
        public override bool Read()
        {
            if ((this.nodeType != XmlNodeType.Attribute) || !this.MoveToNextAttribute())
            {
                this.MoveNext(this.element.dataNode);
                switch (this.internalNodeType)
                {
                    case ExtensionDataNodeType.None:
                        if (this.depth != 0)
                        {
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.Runtime.Serialization.SR.GetString("InvalidXmlDeserializingExtensionData")));
                        }
                        this.nodeType = XmlNodeType.None;
                        this.prefix = string.Empty;
                        this.ns = string.Empty;
                        this.localName = string.Empty;
                        this.value = string.Empty;
                        this.attributeCount = 0;
                        this.readState = System.Xml.ReadState.EndOfFile;
                        return false;

                    case ExtensionDataNodeType.Element:
                    case ExtensionDataNodeType.ReferencedElement:
                    case ExtensionDataNodeType.NullElement:
                        this.PushElement();
                        this.SetElement();
                        break;

                    case ExtensionDataNodeType.EndElement:
                        this.nodeType = XmlNodeType.EndElement;
                        this.prefix = string.Empty;
                        this.ns = string.Empty;
                        this.localName = string.Empty;
                        this.value = string.Empty;
                        this.attributeCount = 0;
                        this.attributeIndex = -1;
                        this.PopElement();
                        break;

                    case ExtensionDataNodeType.Text:
                        this.nodeType = XmlNodeType.Text;
                        this.prefix = string.Empty;
                        this.ns = string.Empty;
                        this.localName = string.Empty;
                        this.attributeCount = 0;
                        this.attributeIndex = -1;
                        break;

                    case ExtensionDataNodeType.Xml:
                        break;

                    default:
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SerializationException(System.Runtime.Serialization.SR.GetString("InvalidStateInExtensionDataReader")));
                }
                this.readState = System.Xml.ReadState.Interactive;
            }
            return true;
        }
Example #8
0
 private bool ReadToEnd()
 {
     this.state = System.Xml.ReadState.EndOfFile;
     return(false);
 }
 private bool ReadToEnd()
 {
     this.state = System.Xml.ReadState.EndOfFile;
     return false;
 }
 public override bool Read()
 {
     switch (this.state)
     {
         case System.Xml.ReadState.Initial:
         {
             this.state = System.Xml.ReadState.Interactive;
             XDocument source = this.source as XDocument;
             return ((source == null) || this.ReadIntoDocument(source));
         }
         case System.Xml.ReadState.Interactive:
             return this.Read(false);
     }
     return false;
 }