protected virtual void ReadChangeSummary(XPathNavigator navigator, out AutoUpdateChangeSummary changeSummary) { changeSummary = new AutoUpdateChangeSummary(); // if the element has attributs if (navigator.HasAttributes) { // clone the current navigator so we can save our position XPathNavigator attributesNavigator = navigator.Clone(); // move to the first attribute if (attributesNavigator.MoveToFirstAttribute()) { do { // parse the attributes from the test element switch (attributesNavigator.Name) { case @"Type": changeSummary.Type = (AutoUpdateChangeTypes)Enum.Parse(typeof(AutoUpdateChangeTypes), attributesNavigator.Value, true); break; case @"PostedBy": changeSummary.PostedBy = attributesNavigator.Value; break; case @"DatePosted": changeSummary.DatePosted = DateTime.Parse(attributesNavigator.Value); break; case @"Id": changeSummary.Id = attributesNavigator.Value; break; } ; }while(attributesNavigator.MoveToNextAttribute()); } } // move inward to the first child if (navigator.MoveToFirstChild()) { do { switch (navigator.Name) { case @"Title": changeSummary.Title = navigator.Value; break; case @"Preview": changeSummary.Preview = navigator.Value; break; } ; }while(navigator.MoveToNext()); } }
/// <summary> /// Writes an Xml element containing the AutoUpdateChangeSummary specified /// </summary> /// <param name="changeSummary"></param> protected virtual void WriteChangeSummary(AutoUpdateChangeSummary changeSummary) { Debug.Assert(changeSummary != null); // start the element _writer.WriteStartElement(changeSummary.GetType().Name); XmlWriterUtils.WriteAttributes(_writer, new XmlStringPair("Type", changeSummary.Type.ToString()), new XmlStringPair("PostedBy", changeSummary.PostedBy), new XmlStringPair("DatePosted", changeSummary.DatePosted.ToString()), new XmlStringPair("Id", changeSummary.Id) ); XmlWriterUtils.WriteCDataElement(_writer, "Title", changeSummary.Title, null); XmlWriterUtils.WriteCDataElement(_writer, "Preview", changeSummary.Preview, null); // end the element _writer.WriteEndElement(); }
/// <summary> /// Writes an Xml element containing the AutoUpdateChangeSummary specified /// </summary> /// <param name="changeSummary"></param> private void WriteChangeSummary(AutoUpdateChangeSummary changeSummary) { if (changeSummary == null) { throw new ArgumentNullException("changeSummary"); } // start the element _writer.WriteStartElement(changeSummary.GetType().Name); XmlWriterUtils.WriteAttributes(_writer, new XmlStringPair("Type", changeSummary.Type.ToString()), new XmlStringPair("PostedBy", changeSummary.PostedBy), new XmlStringPair("DatePosted", changeSummary.DatePosted.ToString()), new XmlStringPair("Id", changeSummary.Id) ); XmlWriterUtils.WriteCDataElement(_writer, "Title", changeSummary.Title, null); XmlWriterUtils.WriteCDataElement(_writer, "Preview", changeSummary.Preview, null); // end the element _writer.WriteEndElement(); }
/// <summary> /// Writes an Xml element containing the AutoUpdateChangeSummary specified /// </summary> /// <param name="changeSummary"></param> private void WriteChangeSummary(AutoUpdateChangeSummary changeSummary) { if (changeSummary == null) throw new ArgumentNullException("changeSummary"); // start the element _writer.WriteStartElement(changeSummary.GetType().Name); XmlWriterUtils.WriteAttributes(_writer, new XmlStringPair("Type", changeSummary.Type.ToString()), new XmlStringPair("PostedBy", changeSummary.PostedBy), new XmlStringPair("DatePosted", changeSummary.DatePosted.ToString()), new XmlStringPair("Id", changeSummary.Id) ); XmlWriterUtils.WriteCDataElement(_writer, "Title", changeSummary.Title, null); XmlWriterUtils.WriteCDataElement(_writer, "Preview", changeSummary.Preview, null); // end the element _writer.WriteEndElement(); }
protected virtual void ReadChangeSummary(XPathNavigator navigator, out AutoUpdateChangeSummary changeSummary) { changeSummary = new AutoUpdateChangeSummary(); // if the element has attributs if (navigator.HasAttributes) { // clone the current navigator so we can save our position XPathNavigator attributesNavigator = navigator.Clone(); // move to the first attribute if (attributesNavigator.MoveToFirstAttribute()) { do { // parse the attributes from the test element switch(attributesNavigator.Name) { case @"Type": changeSummary.Type = (AutoUpdateChangeTypes)Enum.Parse(typeof(AutoUpdateChangeTypes), attributesNavigator.Value, true); break; case @"PostedBy": changeSummary.PostedBy = attributesNavigator.Value; break; case @"DatePosted": changeSummary.DatePosted = DateTime.Parse(attributesNavigator.Value); break; case @"Id": changeSummary.Id = attributesNavigator.Value; break; }; } while(attributesNavigator.MoveToNextAttribute()); } } // move inward to the first child if (navigator.MoveToFirstChild()) { do { switch(navigator.Name) { case @"Title": changeSummary.Title = navigator.Value; break; case @"Preview": changeSummary.Preview = navigator.Value; break; }; } while(navigator.MoveToNext()); } }