Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 3
0
 internal void AddContributor(AtomPersonConstruct contributor)
 {
     _contributors.Add(contributor);
 }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 internal void AddAuthor(AtomPersonConstruct author)
 {
     _authors.Add(author);
 }