/// <summary>
        /// Visits the record set.
        /// </summary>
        /// <param name="rs">The record set to visit.</param>
        public virtual void VisitRecordSet(RecordSet rs)
        {
            this.contextStack.Push(rs);
            if (rs.Records != null)
            {
                foreach (Gedcomx record in rs.Records)
                {
                    VisitGedcomx(record);
                }
            }

            //we're going to avoid visiting the metadata so that visitors don't get confused about the context
            //of the visit.
            //if (rs.Metadata != null) {
            //		visitGedcomx(rs.Metadata);
            //}
            this.contextStack.Pop();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Builds a table of records for a given record set.
 /// </summary>
 /// <returns>
 /// The table of records.
 /// </returns>
 /// <param name='recordSet'>
 /// The record set.
 /// </param>
 public static DataTable BuildTableOfRecords(RecordSet recordSet)
 {
     var table = new DataTable();
     var values = new FieldValueTableBuildingVisitor(recordSet);
     foreach (string column in values.ColumnNames)
     {
         table.Columns.Add(column, typeof(string));
     }
     foreach (Dictionary<string, string> fieldSet in values.Rows)
     {
         DataRow row = table.NewRow();
         foreach (KeyValuePair<string, string> entry in fieldSet)
         {
             row[entry.Key] = string.Format("\"{0}\"", entry.Value.Replace("\"", "\\\""));
         }
         table.Rows.Add(row);
     }
     return table;
 }
 /// <summary>
 /// Initializes an id dictionary for the specified record set.
 /// </summary>
 /// <param name='rs'>
 /// The record set.
 /// </param>
 public GedcomxIdDictionary(RecordSet rs)
 {
     VisitRecordSet(rs);
 }
        /// <summary>
        /// Visits the specified record set.
        /// </summary>
        /// <param name="rs">The record set to visit.</param>
        public override void VisitRecordSet(RecordSet rs)
        {
            if (rs.Id != null)
            {
                this.dictionary.Add(rs.Id, rs);
            }

            base.VisitRecordSet(rs);
        }
Ejemplo n.º 5
0
 public FieldValueTableBuildingVisitor(RecordSet records)
 {
     VisitRecordSet(records);
 }