/// <summary> /// Writes an Xml element containing AutoUpdateHref specified /// </summary> /// <param name="moreInfo"></param> protected virtual void WriteHref(AutoUpdateHref moreInfo) { Debug.Assert(moreInfo != null); // start the element _writer.WriteStartElement(moreInfo.GetType().Name); XmlWriterUtils.WriteAttributes(_writer, new XmlStringPair("Href", moreInfo.Href) ); XmlWriterUtils.WriteCDataElement(_writer, "Text", moreInfo.Text, null); // end the element _writer.WriteEndElement(); }
/// <summary> /// Writes an Xml element containing AutoUpdateHref specified /// </summary> /// <param name="moreInfo"></param> private void WriteHref(AutoUpdateHref moreInfo) { if (moreInfo == null) { throw new ArgumentNullException("moreInfo"); } // start the element _writer.WriteStartElement(moreInfo.GetType().Name); XmlWriterUtils.WriteAttributes(_writer, new XmlStringPair("Href", moreInfo.Href) ); XmlWriterUtils.WriteCDataElement(_writer, "Text", moreInfo.Text, null); // end the element _writer.WriteEndElement(); }
protected virtual void ReadHref(XPathNavigator navigator, out AutoUpdateHref href) { href = new AutoUpdateHref(); // 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 @"Href": href.Href = attributesNavigator.Value; break; } ; }while(attributesNavigator.MoveToNextAttribute()); } } // move inward to the first child if (navigator.MoveToFirstChild()) { do { switch (navigator.Name) { case @"Text": href.Text = navigator.Value; break; } ; }while(navigator.MoveToNext()); } }
/// <summary> /// Writes an Xml element containing AutoUpdateHref specified /// </summary> /// <param name="moreInfo"></param> private void WriteHref(AutoUpdateHref moreInfo) { if (moreInfo == null) throw new ArgumentNullException("moreInfo"); // start the element _writer.WriteStartElement(moreInfo.GetType().Name); XmlWriterUtils.WriteAttributes(_writer, new XmlStringPair("Href", moreInfo.Href) ); XmlWriterUtils.WriteCDataElement(_writer, "Text", moreInfo.Text, null); // end the element _writer.WriteEndElement(); }
protected virtual void ReadHref(XPathNavigator navigator, out AutoUpdateHref href) { href = new AutoUpdateHref(); // 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 @"Href": href.Href = attributesNavigator.Value; break; }; } while(attributesNavigator.MoveToNextAttribute()); } } // move inward to the first child if (navigator.MoveToFirstChild()) { do { switch(navigator.Name) { case @"Text": href.Text = navigator.Value; break; }; } while(navigator.MoveToNext()); } }