Example #1
0
        /// <summary>
        /// Parses an element.
        /// </summary>
        private AtomElement ParseElement(XmlReader parser)
        {
            string uri   = parser.NamespaceURI;
            string local = parser.LocalName;

            if (uri == XmlConstants.NamespaceRestAtom)
            {
                if (local == XmlConstants.TAG_OBJECT)
                {
                    return(new AtomElement(uri, local, XmlConverter.ConvertObject(parser)));
                }
                else if (local == XmlConstants.TAG_PATH_SEGMENT ||
                         local == XmlConstants.TAG_RELATIVE_PATH_SEGMENT)
                {
                    return(ParseText(parser));
                }
                else if (local == XmlConstants.TAG_TYPE)
                {
                    return(new AtomElement(uri, local, XmlConverter.ConvertTypeDefinition(parser)));
                }
                else if (local == XmlConstants.TAG_CHILDREN)
                {
                    return(ParseChildren(parser));
                }
            }
            else if (uri == XmlConstants.NamespaceAtom)
            {
                if (local == XmlConstants.TAG_LINK)
                {
                    return(ParseLink(parser));
                }
                else if (local == XmlConstants.TAG_CONTENT)
                {
                    return(ParseAtomContentSrc(parser));
                }
            }

            // we don't know it - skip it
            XmlUtils.Skip(parser);

            return(null);
        }