Exemplo n.º 1
0
        /// <summary>
        /// Deserializes ChangeDetectionItems from an XML file.
        /// </summary>
        /// <param name="reader">XMLReader where the ChangeDetectionItems are.</param>
        /// <returns>ChangeDetectionItems.</returns>
        public static ChangeDetectionItems Deserialize(XmlReader reader)
        {
            ChangeDetectionItems lResult = null;

            if (reader.IsStartElement(DTD.Request.ServiceRequest.TagChangeDetectionItems))
            {
                lResult = new ChangeDetectionItems();

                if (!reader.IsEmptyElement)
                {
                    reader.ReadStartElement();
                    do
                    {
                        if (reader.IsStartElement(DTD.Request.ServiceRequest.ChangeDetectionItems.TagChangeDetectionItem))
                        {
                            lResult.Add(XMLChangeDetectionItemSerializer.Deserialize(reader.ReadSubtree()));
                        }
                    } while (reader.Read());
                }
                else
                {
                    reader.Skip();
                }
            }
            else
            {
                throw new ArgumentException("Xml Reader don't have the " + DTD.Request.ServiceRequest.TagChangeDetectionItems + "in Start Element.", "XmlReader reader");
            }
            return(lResult);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Serializes ChangeDetectionItems to an XML file.
 /// </summary>
 /// <param name="writer">XMLWriter where the ChangeDetectionItems are stored.</param>
 /// <param name="ChangeDetectionItems">ChangeDetectionItems to serialize.</param>
 /// <returns>Returns the XMLWriter with the ChangeDetectionItems.</returns>
 public static XmlWriter Serialize(XmlWriter writer, ChangeDetectionItems items)
 {
     if ((items != null) && (items.Count > 0))
     {
         writer.WriteStartElement(DTD.Request.ServiceRequest.TagChangeDetectionItems);
         foreach (ChangeDetectionItem i in items.Values)
         {
             XMLChangeDetectionItemSerializer.Serialize(writer, i);
         }
         writer.WriteEndElement();
     }
     return(writer);
 }
 /// <summary>
 /// Serializes ChangeDetectionItems to an XML file.
 /// </summary>
 /// <param name="writer">XMLWriter where the ChangeDetectionItems are stored.</param>
 /// <param name="ChangeDetectionItems">ChangeDetectionItems to serialize.</param>
 /// <returns>Returns the XMLWriter with the ChangeDetectionItems.</returns>
 public static XmlWriter Serialize(XmlWriter writer, ChangeDetectionItems items)
 {
     if ((items != null) && (items.Count > 0 ))
     {
         writer.WriteStartElement(DTD.Request.ServiceRequest.TagChangeDetectionItems);
         foreach (ChangeDetectionItem i in items.Values)
         {
             XMLChangeDetectionItemSerializer.Serialize(writer, i);
         }
         writer.WriteEndElement();
     }
     return writer;
 }
        /// <summary>
        /// Deserializes ChangeDetectionItems from an XML file.
        /// </summary>
        /// <param name="reader">XMLReader where the ChangeDetectionItems are.</param>
        /// <returns>ChangeDetectionItems.</returns>
        public static ChangeDetectionItems Deserialize(XmlReader reader)
        {
            ChangeDetectionItems lResult = null;

            if (reader.IsStartElement(DTD.Request.ServiceRequest.TagChangeDetectionItems))
            {
                lResult = new ChangeDetectionItems();

                if (!reader.IsEmptyElement)
                {
                reader.ReadStartElement();
                do
                {
                    if (reader.IsStartElement(DTD.Request.ServiceRequest.ChangeDetectionItems.TagChangeDetectionItem))
                    {
                    lResult.Add(XMLChangeDetectionItemSerializer.Deserialize(reader.ReadSubtree()));
                    }

                } while (reader.Read());
                }
                else
                {
                reader.Skip();
                }
            }
            else
            {
                throw new ArgumentException("Xml Reader don't have the " + DTD.Request.ServiceRequest.TagChangeDetectionItems + "in Start Element.", "XmlReader reader");
            }
            return lResult;
        }