////////////////////////////////////////////////////////////////////// /// <summary>Parses an xml node to create a Where object.</summary> /// <param name="node">the node to parse node</param> /// <param name="parser">the xml parser to use if we need to dive deeper</param> /// <returns>the created Where object</returns> ////////////////////////////////////////////////////////////////////// public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser) { Tracing.TraceCall(); RecurrenceException exception = null; if (node != null) { object localname = node.LocalName; if (localname.Equals(this.XmlName) == false || node.NamespaceURI.Equals(this.XmlNameSpace) == false) { return(null); } } exception = new RecurrenceException(); if (node != null) { if (node.Attributes != null) { if (node.Attributes[GDataParserNameTable.XmlAttributeSpecialized] != null) { exception.Specialized = bool.Parse(node.Attributes[GDataParserNameTable.XmlAttributeSpecialized].Value); } } if (node.HasChildNodes) { XmlNode childNode = node.FirstChild; while (childNode != null && childNode is XmlElement) { if (childNode.LocalName == GDataParserNameTable.XmlEntryLinkElement) { exception.EntryLink = EntryLink.ParseEntryLink(childNode, parser); } childNode = childNode.NextSibling; } } if (exception.EntryLink == null) { throw new ArgumentException("g:recurringException/entryLink is required."); } } return(exception); }
////////////////////////////////////////////////////////////////////// /// <summary>Parses an xml node to create a Where object.</summary> /// <param name="node">the node to parse node</param> /// <param name="parser">the xml parser to use if we need to dive deeper</param> /// <returns>the created Where object</returns> ////////////////////////////////////////////////////////////////////// public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser) { Tracing.TraceCall(); RecurrenceException exception = null; if (node != null) { object localname = node.LocalName; if (localname.Equals(this.XmlName) == false || node.NamespaceURI.Equals(this.XmlNameSpace) == false) { return null; } } exception = new RecurrenceException(); if (node != null) { if (node.Attributes != null) { if (node.Attributes[GDataParserNameTable.XmlAttributeSpecialized] != null) { exception.Specialized = bool.Parse(node.Attributes[GDataParserNameTable.XmlAttributeSpecialized].Value); } } if (node.HasChildNodes) { XmlNode childNode = node.FirstChild; while (childNode != null && childNode is XmlElement) { if (childNode.LocalName == GDataParserNameTable.XmlEntryLinkElement) { exception.EntryLink = EntryLink.ParseEntryLink(childNode, parser); } childNode = childNode.NextSibling; } } if (exception.EntryLink == null) { throw new ArgumentException("g:recurringException/entryLink is required."); } } return exception; }
////////////////////////////////////////////////////////////////////// /// <summary>parses an xml node to create a Recurrence object</summary> /// <param name="node">Recurrence node</param> /// <param name="parser">AtomFeedParser to use</param> /// <returns> the created Recurrence object</returns> ////////////////////////////////////////////////////////////////////// public static RecurrenceException ParseRecurrenceException(XmlNode node, AtomFeedParser parser) { Tracing.TraceCall(); RecurrenceException exception = null; Tracing.Assert(node != null, "node should not be null"); if (node == null) { throw new ArgumentNullException("node"); } object localname = node.LocalName; if (localname.Equals(GDataParserNameTable.XmlRecurrenceExceptionElement)) { exception = new RecurrenceException(); if (node.Attributes != null) { if (node.Attributes[GDataParserNameTable.XmlAttributeSpecialized] != null) { exception.Specialized = bool.Parse(node.Attributes[GDataParserNameTable.XmlAttributeSpecialized].Value); } } if (node.HasChildNodes) { XmlNode childNode = node.FirstChild; while (childNode != null && childNode is XmlElement) { if (childNode.LocalName == GDataParserNameTable.XmlEntryLinkElement) { exception.EntryLink = EntryLink.ParseEntryLink(childNode, parser); } childNode = childNode.NextSibling; } } } if (exception.EntryLink == null) { throw new ArgumentException("g:recurringException/entryLink is required."); } return exception; }