Read() public method

Reads the information about this container in the container list from the EAD XML Reader
public Read ( XmlTextReader Reader ) : void
Reader System.Xml.XmlTextReader EAD XML Text Reader
return void
Ejemplo n.º 1
0
        /// <summary> Reads the information about this container in the container list from the EAD XML Reader</summary>
        /// <param name="reader"> EAD XML Text Reader </param>
        public void Read(XmlTextReader reader)
        {
            String tagname = reader.Name;

            for (int i = 0; i < reader.AttributeCount; i++)
            {
                reader.MoveToAttribute(i);
                if (reader.Name.Equals("type"))
                {
                    type = reader.Value;
                }
            }
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "head")
                    {
                        reader.Read();
                        head = reader.Value;
                    }
                    else if (reader.Name == "did")
                    {
                        did = new Descriptive_Identification();
                        did.Read(reader);
                    }
                    else if (reader.Name == "c01")
                    {
                        Container_Info c_tag = new Container_Info();
                        c_tag.Read(reader);
                        containers.Add(c_tag);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.Name.Equals(tagname))
                    {
                        break;
                    }
                }
            }
        }
 /// <summary> Reads the information about this container in the container list from the EAD XML Reader</summary>
 /// <param name="Reader"> EAD XML Text Reader </param>
 public void Read(XmlTextReader Reader)
 {
     String tagname = Reader.Name;
     for (int i = 0; i < Reader.AttributeCount; i++)
     {
         Reader.MoveToAttribute(i);
         if (Reader.Name.Equals("type"))
             Type = Reader.Value;
     }
     while (Reader.Read())
     {
         if (Reader.NodeType == XmlNodeType.Element)
         {
             if (Reader.Name == "head")
             {
                 Reader.Read();
                 Head = Reader.Value;
             }
             else if (Reader.Name == "did")
             {
                 Did = new Descriptive_Identification();
                 Did.Read(Reader);
             }
             else if (Reader.Name == "c01")
             {
                 Container_Info c_tag = new Container_Info();
                 c_tag.Read(Reader);
                 Containers.Add(c_tag);
             }
         }
         else if (Reader.NodeType == XmlNodeType.EndElement)
         {
             if (Reader.Name.Equals(tagname))
                 break;
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary> Reads the information about this container in the container list from the EAD XML Reader</summary>
        /// <param name="reader"> EAD XML Text Reader </param>
        public void Read(XmlTextReader reader)
        {
            Regex rgx1 = new Regex("xmlns=\"[^\"]*\"");
            Regex rgx2 = new Regex("[ ]*>");
            Regex rgx3 = new Regex("[ ]*/>");

            string tagname     = reader.Name;
            Regex  ctagPattern = new Regex("c[0-9][0-9]");

            if (reader.MoveToAttribute("level"))
            {
                level = reader.Value;
            }

            // Read all the information under this component
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (ctagPattern.IsMatch(reader.Name))
                    {
                        // Read this child component
                        Container_Info c_tag = new Container_Info();
                        c_tag.Read(reader);
                        if (c_tags == null)
                        {
                            c_tags = new List <Container_Info>();
                        }
                        c_tags.Add(c_tag);

                        // Set this flag to determine if this has a complex child
                        if (c_tag.is_Complex_Or_Has_Complex_Children)
                        {
                            has_complex_child = true;
                        }
                    }
                    else
                    {
                        switch (reader.Name)
                        {
                        case "did":
                            did = new Descriptive_Identification();
                            did.Read(reader);
                            break;

                        case "bioghist":
                            string InnerXml_bioghist  = reader.ReadInnerXml();
                            string InnerXml_bioghist2 = rgx1.Replace(InnerXml_bioghist, "");
                            string InnerXml_bioghist3 = rgx2.Replace(InnerXml_bioghist2, ">");
                            biogHist = rgx3.Replace(InnerXml_bioghist3, "/>");
                            break;

                        case "scopecontent":
                            string InnerXml_scopecontent  = reader.ReadInnerXml();
                            string InnerXml_scopecontent2 = rgx1.Replace(InnerXml_scopecontent, "");
                            string InnerXml_scopecontent3 = rgx2.Replace(InnerXml_scopecontent2, ">");
                            scope = rgx3.Replace(InnerXml_scopecontent3, "/>");
                            break;
                        }
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement && reader.Name.Equals(tagname))
                {
                    break;
                }
            }
        }
        /// <summary> Reads the information about this container in the container list from the EAD XML Reader</summary>
        /// <param name="reader"> EAD XML Text Reader </param>
        public void Read(XmlTextReader reader)
        {
            Regex rgx1 = new Regex("xmlns=\"[^\"]*\"");
            Regex rgx2 = new Regex("[ ]*>");
            Regex rgx3 = new Regex("[ ]*/>");

            string tagname = reader.Name;
            Regex ctagPattern = new Regex("c[0-9][0-9]");
            if (reader.MoveToAttribute("level"))
                level = reader.Value;

            // Read all the information under this component
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (ctagPattern.IsMatch(reader.Name))
                    {
                        // Read this child component
                        Container_Info c_tag = new Container_Info();
                        c_tag.Read(reader);
                        if (c_tags == null)
                            c_tags = new List<Container_Info>();
                        c_tags.Add(c_tag);

                        // Set this flag to determine if this has a complex child
                        if (c_tag.is_Complex_Or_Has_Complex_Children)
                            has_complex_child = true;
                    }
                    else
                    {
                        switch (reader.Name)
                        {
                            case "did":
                                did = new Descriptive_Identification();
                                did.Read(reader);
                                break;

                            case "bioghist":
                                string InnerXml_bioghist = reader.ReadInnerXml();
                                string InnerXml_bioghist2 = rgx1.Replace(InnerXml_bioghist, "");
                                string InnerXml_bioghist3 = rgx2.Replace(InnerXml_bioghist2, ">");
                                biogHist = rgx3.Replace(InnerXml_bioghist3, "/>");
                                break;

                            case "scopecontent":
                                string InnerXml_scopecontent = reader.ReadInnerXml();
                                string InnerXml_scopecontent2 = rgx1.Replace(InnerXml_scopecontent, "");
                                string InnerXml_scopecontent3 = rgx2.Replace(InnerXml_scopecontent2, ">");
                                scope = rgx3.Replace(InnerXml_scopecontent3, "/>");
                                break;
                        }
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement && reader.Name.Equals(tagname))
                    break;
            }
        }