Example #1
0
        private static void VisitPersonConstructUriElement(XmlReader reader, AtomPersonConstruct author)
        {
            if (reader.IsEmptyElement)
                return;

            while (reader.Read())
            {
                if (reader.Name.Equals("uri") && reader.NodeType == XmlNodeType.EndElement)
                    break;

                if (reader.NodeType != XmlNodeType.Text)
                    continue;

                Uri uri;
                Uri.TryCreate(reader.Value, UriKind.Absolute, out uri);
                author.Uri = uri;
            }
        }
Example #2
0
        private static void VisitPersonConstructNameElement(XmlReader reader, AtomPersonConstruct author)
        {
            if (reader.IsEmptyElement)
                return;

            while (reader.Read())
            {
                if (reader.Name.Equals("name") && reader.NodeType == XmlNodeType.EndElement)
                    break;

                if (reader.NodeType == XmlNodeType.Text)
                    author.Name = reader.Value;
            }
        }
 internal void AddContributor(AtomPersonConstruct contributor)
 {
     _contributors.Add(contributor);
 }
Example #4
0
        private static void VisitPersonConstruct(XmlReader reader,
                                                 AtomEntryBase entry,
                                                 String nodeName,
                                                 Action<AtomPersonConstruct, AtomEntryBase> action)
        {
            if (reader.IsEmptyElement)
                return;

            var personConstruct = new AtomPersonConstruct();

            while (reader.Read())
            {
                if (reader.Name.Equals(nodeName) && reader.NodeType == XmlNodeType.EndElement)
                    break;

                if (reader.NodeType != XmlNodeType.Element)
                    continue;

                switch (reader.Name)
                {
                    case "name":
                        VisitPersonConstructNameElement(reader, personConstruct);
                        break;
                    case "uri":
                        VisitPersonConstructUriElement(reader, personConstruct);
                        break;
                    case "email":
                        VisitPersonConstructEmailElement(reader, personConstruct);
                        break;
                }
            }

            action(personConstruct, entry);
        }
 internal void AddAuthor(AtomPersonConstruct author)
 {
     _authors.Add(author);
 }