RichGomes wrote:
Thanks! You've been very helpful.
Would you say it's the way Gramps is exporting the gedcom files or something
else?
I have submitted to them as a possible bug.
No this is not a bug or if it is it is in the GEDCOM standard. GEDCOM
has multiple ways that data can be placed in the file, in part because
it has evolved over time to meet the needs of different users and to
avoid problems and issues present in earlier versions. But sadly they
never deprecated or removed the older stuff. So now you can not assume
that data is placed in any one particular way into the GEDCOM file. In
fact, in my version of Family Tree Maker I have the ability to select
from 3-4 different ways to generate a GEDCOM file depending on what
software is the intended target.
So we all just have to deal with this.
-Steve
Rich
-----Original Message-----
From: Bill Anderson [mailto:b...@anderson-ent.com]
Sent: Tuesday, April 27, 2010 9:13 PM
To: perl-gedcom@perl.org
Subject: Re: Reading Notes field in gedcom files
Here is the script, modified to give the results expected. Notice the
use of resolve_xrefs and ref.
#!/bin/perl -w
use strict;
use Gedcom;
my $ged = Gedcom->new(shift);
$ged->resolve_xrefs;
for my $i ( $ged->individuals )
{
for my $n ( $i->note )
{
print "========================================\n";
print $i->name, "\n";
if (ref $n)
{
print $n->get_value, "\n";
}
else
{
print "$n\n";
}
#print "========================================\n";
}
}
On 4/26/2010 6:25 PM, Bill Anderson wrote:
I believe your script and the GEDCOM module are working correctly, but
you do not get the results you expect because of the way your GEDCOM
file is constructed.
To illustrate, consider two sample files. The first is at
http://www.ged-gen.com/download/lincoln.ged
If you run your script against this file, you will see what you expect.
The second is at http://www.genealogyforum.com/gedcom/gedcom1/ged1.ged
When running your script against the second GEDCOM file, you will get
the cross reference numbers you described below.
If the GEDCOM file includes the note text in the tag value, as in the
first file, you will get what you are looking for.
If the GEDCOM file includes a cross reference to a note record, you will
get the reference numbers.
You need to add some tests to your script to see if you are getting note
text, or a cross reference. If the latter, you need some code to fetch
the note text from the separate note record.
On 4/26/2010 3:41 PM, richgo...@comcast.net wrote:
Hoping I can get this question answered here.
I have been trying to use perl to parse gedcom files and have not had much luck.
My main goal is to get it to show me a list of people and then the contents of the notes section of their record. My script is based on the example code found here:
http://search.cpan.org/dist/Gedcom/lib/Gedcom.pm
The only results I can seem to get back is the persons name and the reference number of the notes associated with that person.
I appreciate any help on this matter
Thanks !
Script follows:
#!/bin/perl -w
use strict;
use Gedcom;
my $ged = Gedcom->new(shift);
for my $i ($ged->individuals)
{
for my $n ($i->get_value("note"))
{
print "========================================\n";
print $i->name, "\n";
print $i->note, "\n";
#print "========================================\n";
}
}