/// <summary>
        /// parses a single error element
        /// </summary>
        /// <param name="reader">XmlReader positioned at the start of the status element</param>
        /// <param name="parser">the feedparser to be used</param>
        /// <returns>GDataBatchError</returns>
        public static GDataBatchError ParseBatchError(XmlReader reader, AtomFeedParser parser)
        {
            if (reader == null)
            {
                throw new System.ArgumentNullException("reader");
            }

            object          localname = reader.LocalName;
            GDataBatchError error     = null;

            if (localname.Equals(parser.Nametable.BatchError))
            {
                error = new GDataBatchError();
                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        localname = reader.LocalName;
                        if (localname.Equals(parser.Nametable.BatchReason))
                        {
                            error.Reason = Utilities.DecodedValue(reader.Value);
                        }
                        else if (localname.Equals(parser.Nametable.Type))
                        {
                            error.Type = Utilities.DecodedValue(reader.Value);
                        }
                        else if (localname.Equals(parser.Nametable.BatchField))
                        {
                            error.Field = Utilities.DecodedValue(reader.Value);
                        }
                    }
                }
            }
            return(error);
        }
Beispiel #2
0
 public void TypeTest()
 {
     GDataBatchError target = new GDataBatchError(); // TODO: Initialize to an appropriate value
     string expected = "TestValue";            
     string actual;
     target.Type = expected;
     actual = target.Type;
     Assert.AreEqual(expected, actual);
 }
        /// <summary>
        /// reads the current positioned reader and creates a batchstatus element
        /// </summary>
        /// <param name="reader">XmlReader positioned at the start of the status element</param>
        /// <param name="parser">The Feedparser to be used</param>
        /// <returns>GDataBatchStatus</returns>
        public static GDataBatchStatus ParseBatchStatus(XmlReader reader, AtomFeedParser parser)
        {
            Tracing.Assert(reader != null, "reader should not be null");
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            GDataBatchStatus status = null;

            object localname = reader.LocalName;

            if (localname.Equals(parser.Nametable.BatchStatus))
            {
                status = new GDataBatchStatus();
                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        localname = reader.LocalName;
                        if (localname.Equals(parser.Nametable.BatchReason))
                        {
                            status.Reason = Utilities.DecodedValue(reader.Value);
                        }
                        else if (localname.Equals(parser.Nametable.BatchContentType))
                        {
                            status.ContentType = Utilities.DecodedValue(reader.Value);
                        }
                        else if (localname.Equals(parser.Nametable.BatchStatusCode))
                        {
                            status.Code = int.Parse(Utilities.DecodedValue(reader.Value), CultureInfo.InvariantCulture);
                        }
                    }
                }

                reader.MoveToElement();

                // FIX: THIS CODE SEEMS TO MAKE AN INFINITE LOOP WITH NextChildElement()

                int lvl = -1;
                // status can have one child element, errors
                while (Utilities.NextChildElement(reader, ref lvl))
                {
                    localname = reader.LocalName;

                    if (localname.Equals(parser.Nametable.BatchErrors))
                    {
                        GDataBatchError.ParseBatchErrors(reader, parser, status);
                    }
                }
            }
            return(status);
        }
Beispiel #4
0
        /// <summary>
        /// parses a single error element
        /// </summary>
        /// <param name="reader">XmlReader positioned at the start of the status element</param>
        /// <param name="parser">the feedparser to be used</param>
        /// <returns>GDataBatchError</returns>
        public static GDataBatchError ParseBatchError(XmlReader reader, AtomFeedParser parser) {
            if (reader == null) {
                throw new System.ArgumentNullException("reader");
            }

            object localname = reader.LocalName;
            GDataBatchError error = null;
            if (localname.Equals(parser.Nametable.BatchError)) {
                error = new GDataBatchError();
                if (reader.HasAttributes) {
                    while (reader.MoveToNextAttribute()) {
                        localname = reader.LocalName;
                        if (localname.Equals(parser.Nametable.BatchReason)) {
                            error.Reason = Utilities.DecodedValue(reader.Value);
                        } else if (localname.Equals(parser.Nametable.Type)) {
                            error.Type = Utilities.DecodedValue(reader.Value);
                        } else if (localname.Equals(parser.Nametable.BatchField)) {
                            error.Field = Utilities.DecodedValue(reader.Value);
                        }
                    }
                }
            }
            return error;
        }
Beispiel #5
0
 /// <summary>
 /// parses a single error element
 /// </summary>
 /// <param name="reader">XmlReader positioned at the start of the status element</param>
 /// <returns>GDataBatchError</returns>
 protected GDataBatchError ParseBatchError(XmlReader reader)
 {
     object localname = reader.LocalName;
     GDataBatchError error = null;
     if (localname.Equals(this.nameTable.BatchError))
     {
         error = new GDataBatchError(); 
         if (reader.HasAttributes)
         {
             while (reader.MoveToNextAttribute())
             {
                 localname = reader.LocalName;
                 if (localname.Equals(this.nameTable.BatchReason))
                 {
                     error.Reason = Utilities.DecodedValue(reader.Value);
                 }
                 else if (localname.Equals(this.nameTable.Type))
                 {
                     error.Type = Utilities.DecodedValue(reader.Value); 
                 }
                 else if (localname.Equals(this.nameTable.BatchField))
                 {
                     error.Field = Utilities.DecodedValue(reader.Value); 
                 }
             }
         }
     }
     return error; 
 }
Beispiel #6
0
 /// <summary>standard typed accessor method </summary> 
 public bool Contains( GDataBatchError value )  
 {
     // If value is not of type AtomPerson, this will return false.
     return( List.Contains( value ) );
 }
Beispiel #7
0
 /// <summary>standard typed accessor method </summary> 
 public void Remove( GDataBatchError value )  
 {
     List.Remove( value );
 }
Beispiel #8
0
 /// <summary>standard typed accessor method </summary> 
 public void Insert( int index, GDataBatchError value )  
 {
     List.Insert( index, value );
 }
Beispiel #9
0
 /// <summary>standard typed accessor method </summary> 
 public int IndexOf( GDataBatchError value )  
 {
     return( List.IndexOf( value ) );
 }
Beispiel #10
0
 /// <summary>standard typed accessor method </summary> 
 public int Add( GDataBatchError value )  
 {
     return( List.Add( value ) );
 }