Exemplo n.º 1
0
        private void ParseDocumentInfoAuthor(XmlReader xml, Authors author)
        {
            string lastNodeName = "";

            while (xml.Read())
            {
                switch (xml.NodeType)
                {
                case XmlNodeType.Element:
                    if (xml.Name == "first-name")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "last-name")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "middle-name")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "nickname")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "email")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "home-page")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "id")
                    {
                        lastNodeName = xml.Name;
                    }
                    break;

                case XmlNodeType.Text:
                    if (lastNodeName == "first-name")
                    {
                        author.First_name += xml.Value;
                    }
                    else if (lastNodeName == "last-name")
                    {
                        author.Last_name += xml.Value;
                    }
                    else if (lastNodeName == "middle-name")
                    {
                        author.Middle_name += xml.Value;
                    }
                    else if (lastNodeName == "nickname")
                    {
                        author.Nickname += xml.Value;
                    }
                    else if (lastNodeName == "email")
                    {
                        author.Email += xml.Value;
                    }
                    else if (lastNodeName == "home-page")
                    {
                        author.Home_page += xml.Value;
                    }
                    else if (lastNodeName == "id")
                    {
                        author.UniqID += xml.Value;
                    }
                    break;
                }
            }
        }
Exemplo n.º 2
0
        private void ParseDocumentInfo(XmlReader xml)
        {
            string  lastNodeName = "";
            Authors author       = null;

            while (xml.Read())
            {
                switch (xml.NodeType)
                {
                case XmlNodeType.Element:
                    if (xml.Name == "history")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "program-used")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "src-ocr")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "id")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "version")
                    {
                        lastNodeName = xml.Name;
                    }
                    else if (xml.Name == "author")
                    {
                        if (xml.IsStartElement())
                        {
                            author = new Authors();
                        }
                        ParseDocumentInfoAuthor(xml.ReadSubtree(), author);
                        //if (xml.NodeType == XmlNodeType.EndElement)
                        //    DocumentInfo_authors.Add(author);
                    }
                    break;

                case XmlNodeType.Text:
                    if (lastNodeName == "history")
                    {
                        DocumentInfo_history += xml.Value;
                    }
                    else if (lastNodeName == "program-used")
                    {
                        DocumentInfo_program_used += xml.Value;
                    }
                    else if (lastNodeName == "src-ocr")
                    {
                        DocumentInfo_src_ocr += xml.Value;
                    }
                    else if (lastNodeName == "id")
                    {
                        DocumentInfo_id += xml.Value;
                    }
                    else if (lastNodeName == "version")
                    {
                        DocumentInfo_version += xml.Value;
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (xml.Name == "author")
                    {
                        DocumentInfo_authors.Add(author);
                    }
                    break;
                }
            }
        }