[Xml-compile] Trying to create METS file - help needed

Anthony Wood bessington at gmail.com
Fri Aug 24 07:01:42 GMT 2012


G'day All

I need to create a METS file, a format used in the digitisation and
archiving of old documents, newspapers etc. Here's my code trying to create
a writer :

 #!/usr/local/bin/perl

use warnings;
use strict;
use XML::Compile::Schema;

# xsd copied locally from http://www.loc.gov/standards/mets/mets.xsd
my $xsd =3D '/cygdrive/h/tony.wood/xml/xsd/mets.xsd';

my $schema =3D XML::Compile::Schema->new($xsd);

# the following dir also contains xlink.xsd
$schema->addSchemaDirs('/cygdrive/h/tony.wood/xml/xsd');

$schema->printIndex();   # this produces as seen below

# create the type for XML::Compile::Schema->compile()
use XML::Compile::Util qw/pack_type/;
my $type =3D pack_type 'http://www.loc.gov/METS/', 'mets';

my $writer =3D $schema->compile(WRITER =3D> $type);
exit;


output from printIndex() :

namespace: http://www.loc.gov/METS/
 filename: /cygdrive/h/tony.wood/xml/xsd/mets.xsd
  definitions of elements:
    mets
  definitions of simpleTypes:
    URIs
  definitions of complexTypes:
    amdSecType
    areaType
    behaviorSecType
    behaviorType
    divType
    fileGrpType
    fileType
    mdSecType
    metsType
    objectType
    parType
    seqType
    structLinkType
    structMapType
  definitions of attributeGroups:
    FILECORE
    LOCATION
    METADATA

the last line of code gets the error :

error: cannot find attributeGroup {http://www.w3.org/1999/xlink}simpleLinka=
t {
http://www.loc.gov/METS/}mets/dmdSec/mdRef

Any insights would be great
Thanks in advance
Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20120824/3c=
ce78af/attachment.htm


More information about the Xml-compile mailing list