| 1 | package HTTP::OAI::Metadata::OAI_Identifier; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Carp; | ||
| 7 | use XML::LibXML; | ||
| 8 | use HTTP::OAI::Metadata; | ||
| 9 | |||
| 10 | use vars qw( @ISA ); | ||
| 11 | @ISA = qw( HTTP::OAI::Metadata ); | ||
| 12 | |||
| 13 | our $VERSION = '4.13'; | ||
| 14 | |||
| 15 | sub new { | ||
| 16 | my $self = shift->SUPER::new(@_); | ||
| 17 | my %args = @_; | ||
| 18 | my $dom = XML::LibXML->createDocument(); | ||
| 19 | $dom->setDocumentElement(my $root = $dom->createElementNS('http://www.openarchives.org/OAI/2.0/oai-identifier','oai-identifier')); | ||
| 20 | # $root->setAttribute('xmlns','http://www.openarchives.org/OAI/2.0/oai-identifier'); | ||
| 21 | $root->setAttribute('xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance'); | ||
| 22 | $root->setAttribute('xsi:schemaLocation','http://www.openarchives.org/OAI/2.0/oai-identifier http://www.openarchives.org/OAI/2.0/oai-identifier.xsd'); | ||
| 23 | for(qw( scheme repositoryIdentifier delimiter sampleIdentifier )) { | ||
| 24 | Carp::croak "Required argument $_ is undefined" unless defined($args{$_}); | ||
| 25 | $root->appendChild($dom->createElement($_))->appendChild($dom->createTextNode($args{$_})); | ||
| 26 | } | ||
| 27 | $self->dom($dom); | ||
| 28 | $self; | ||
| 29 | } | ||
| 30 | |||
| 31 | 1; |