[Xml-compile] Trying to create METS file - help needed
Mark Overmeer
solutions at overmeer.net
Fri Aug 24 08:05:54 GMT 2012
* Anthony Wood (bessington at gmail.com) [120824 07:01]:
> 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 :
You have to manually load all schema's which are used. Your schema
uses
<xsd:import namespace="http://www.w3.org/1999/xlink"
schemaLocation="http://www.loc.gov/standards/xlink/xlink.xsd"/>
So you need to load the file from
"http://www.loc.gov/standards/xlink/xlink.xsd"
and store it into '/cygdrive/h/tony.wood/xml/xsd', then
$schema->importDefinitions('xlink.xsd');
You may wish to improve your program this way: (use ::Cache) (untested)
my $schema = XML::Compile::Cache->new($xsd);
$schema->addSchemaDirs('/cygdrive/h/tony.wood/xml/xsd');
$schema->includeDefinitions('xlink.xsd');
$schema->prefixes(m => 'http://www.loc.gov/METS/');
my $writer = $schema->writer('m:mets');
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark at Overmeer.net solutions at overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net
More information about the Xml-compile
mailing list