return $self;
}
+=head2 xpc()
+
+ Give back an XPathContext Object, registered to the correct namespace
+
+=cut
+
+sub xpc {
+ my $self = shift;
+ my $xpc = XML::LibXML::XPathContext->new;
+ $xpc->registerNs( 'ns', $self->namespace() );
+ return $xpc;
+}
+
=head2 get_user_elements($xml)
When passed an xml dom, this will find the user elements and pass convert them into an arrayref
sub get_user_elements {
my $self = shift;
my $xmldoc = shift;
- my $xpc = XML::LibXML::XPathContext->new;
- $xpc->registerNs( 'ns', $self->namespace() );
+ my $xpc = $self->xpc();
my $root = $xmldoc->documentElement();
my @elements =
my $root = $xmldoc->documentElement();
- my $from =
- $xpc->find( '//ns:FromAgencyId', $root );
- my $to =
- $xpc->find( '//ns:ToAgencyId', $root );
+ my $from = $xpc->find( '//ns:FromAgencyId', $root );
+ my $to = $xpc->find( '//ns:ToAgencyId', $root );
return ( $from, $to );
}
my $xmldoc = shift;
if ($xmldoc) {
my $root = $xmldoc->documentElement();
- my $xpc = XML::LibXML::XPathContext->new;
- $xpc->registerNs( 'ns', $self->namespace() );
+ my $xpc = $self->xpc();
my $itemid = $xpc->findnodes( '//ns:ItemId', $root );
# checkin the item
my $xmldoc = shift;
if ($xmldoc) {
my $root = $xmldoc->documentElement();
+ my $xpc = $self->xpc();
my $itemid =
- $root->findnodes('CheckInItem/UniqueItemId/ItemIdentifierValue');
- my @elements = $root->findnodes('CheckInItem/ItemElementType/Value');
+ $xpc->findnodes('//ns:ItemId',$root);
# checkin the item
my $branch='AS'; # where the hell do we get this from???
}
else {
- $vars->{'elements'} = \@elements;
+ $vars->{'elements'} = $self->get_user_elements($xmldoc);
$vars->{'checkin'} = $checkin;
$output = $self->render_output( 'response.tt', $vars );
}
my ($user_id) =
$xmldoc->getElementsByTagNameNS( $self->namespace(),
'UserIdentifierValue' );
- my $xpc = XML::LibXML::XPathContext->new;
- $xpc->registerNs( 'ns', $self->namespace() );
+ my $xpc = $self->xpc();
unless ($user_id) {
# We may get a password, username combo instead of userid