/// <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) { 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) { 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) { 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; } }
private EAD_Transfer_Container_Info ead_copy_container_to_transfer(Container_Info Source) { // If null, just return null if (Source == null) return null; // Start to build the return container and copy over basic information EAD_Transfer_Container_Info returnObj = new EAD_Transfer_Container_Info { Did = ead_copy_did_to_transfer(Source.Did), Level = Source.Level, Has_Complex_Children = Source.Has_Complex_Children, Biographical_History = Source.Biographical_History, Scope_And_Content = Source.Scope_And_Content }; // Now, need to recursively copy the child containers if (Source.Children_Count > 0) { foreach (Container_Info thisInfo in Source.Children) { returnObj.Children.Add(ead_copy_container_to_transfer(thisInfo)); } } return returnObj; }