예제 #1
0
        public AtomDocument CreateEntryDocument()
        {
            var atomEntryDocument = new AtomDocument();

            atomEntryDocument.AppendChild(atomEntryDocument.ImportNode(this, true));

            if (!(ParentNode is AtomFeedElement))
            {
                return(atomEntryDocument);
            }
            var orignalFeed = (AtomFeedElement)ParentNode;
            var entry       = (AtomEntryElement)atomEntryDocument.DocumentElement;

            if (entry.Source == null)
            {
                var source = (AtomSourceElement)atomEntryDocument.DocumentElement.AppendChild(atomEntryDocument.CreateElement("source", AtomNS));
                foreach (XmlNode node in orignalFeed.ChildNodes)
                {
                    if (node.NodeType == XmlNodeType.Element && !(node.NamespaceURI == AtomNS && node.Name == "entry"))
                    {
                        source.AppendChild(atomEntryDocument.ImportNode(node, true));
                    }
                }
            }

            if (entry.Authors.Count != 0)
            {
                return(atomEntryDocument);
            }
            var nsManager = new XmlNamespaceManager(atomEntryDocument.NameTable);

            nsManager.AddNamespace("atom", AtomNS);

            foreach (XmlNode author in orignalFeed.SelectNodes(nsManager.LookupPrefix(AtomNS) + ":author", nsManager))
            {
                atomEntryDocument.DocumentElement.AppendChild(atomEntryDocument.ImportNode(author, true));
            }

            return(atomEntryDocument);
        }
 internal AtomLinkElement(string prefix, string localname, string ns, AtomDocument doc)
     : base(prefix, localname, ns, doc)
 {
 }
예제 #3
0
 internal AtomDateConstruct(string prefix, string localname, string ns, AtomDocument doc)
     : base(prefix, localname, ns, doc)
 {
 }