On Fri, Jan 11, 2013 at 08:07:08PM +0100, Mikkel Eide Eriksen wrote:
> Hi Steve
> 
> AFAIK the gedcom standard does not impose any restrictions on whether an app 
> may modify an xref, so there's no guarantee that an xref will survive being 
> opened in "some app". You're probably only using your own code for these 
> files, though, so that might not be an issue. Anyway, maybe you can use one 
> of the following tags:
> 
>     +1 RFN <PERMANENT_RECORD_FILE_NUMBER>  {0:1}
>     +1 REFN <USER_REFERENCE_NUMBER>  {0:M}
>       +2 TYPE <USER_REFERENCE_TYPE>  {0:1}
>     +1 RIN <AUTOMATED_RECORD_ID>  {0:1}
> 
> Regards,
> Mikkel
> 
> On 11/01/2013, at 15.46, Stephen Woodbridge <wood...@swoodbridge.com> wrote:
> 
> > Hi All,
> > 
> > Is it possible to create and individual and set the xref to a specific 
> > value?
> > 
> > The use case for this is to maintain consistent references between various 
> > files and/or when the xref is used as a persistent reference for a web 
> > application.
> > 
> > For example, I am parsing some web pages that use the xref for individuals 
> > in the url. I would like to maintain these in the Gedcom file I create so 
> > when I later regenerate the pages I can maintain the same url to 
> > individuals relationship.
> > 
> > Thoughts?

But if you're talking about Gedcom.pm, in versions previous to 1.17 you
could add a parameter to add_individual which would be the xref you
wanted.

Now forget all that.  I had never documented it, and in 1.17 I changed
it and added some documentation:

  Normally you will not want to pass any arguments to the function.  Those
  functions which have an xref (ie not header or trailer) accept an optional
  first argument { xref => $x } which will use $x as the xref rather than
  letting the module automatically choose the xref.

So now you can call:

  my $individual = $ged->add_individual({ xref => "I123" });

There's an example using add_note() in t/ged_create.t

This is less than a fortnight old, so if you go this way you may be the
first person to use this feature.

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

Reply via email to