示例#1
0
        private static void VisitLinkElement(XmlReader reader, AtomEntryBase entry)
        {
            var rel = reader.GetAttribute("rel");
            var type = reader.GetAttribute("type");
            var hreflang = reader.GetAttribute("hreflang");
            var title = reader.GetAttribute("title");
            var length = reader.GetAttribute("length");
            Int64 l;
            Int64.TryParse(length, out l);
            Uri href;
            Uri.TryCreate(reader.GetAttribute("href"), UriKind.Absolute, out href);

            var link = new AtomLink
                {
                    Rel = rel,
                    Type = type,
                    HRef = href,
                    HRefLang = hreflang,
                    Title = title,
                    Length = l
                };

            entry.AddLink(link);

            if (reader.IsEmptyElement)
                return;

            while (reader.Read())
                if (reader.Name.Equals("link") && reader.NodeType == XmlNodeType.EndElement)
                    break;
        }
 internal void AddLink(AtomLink link)
 {
     _links.Add(link);
 }