EPrints Technical Mailing List Archive
Message: #06955
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Adding items to EP-XML template
- To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Adding items to EP-XML template
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- Date: Tue, 21 Nov 2017 16:37:27 +0000
Your best bet may be to replicate the RSS feed and modify it for the dates you want, such that it is *only* used by your ICT rather than breaking the standard for the publicly available
feed? I suspect the date isn’t matching the regex as it doesn’t have the time components? Alan From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of John Salter > However, it now transpires that the date on the RSS2 feed is just plain wrong I don’t think it's plain wrong. It's an RSS feed. I think what it does is correct. It's representing the date that the item appeared in the RSS feed - so RSS aggregators can get things in a sensible way. I think your ICT are trying to use (crowbar) a technology so suit their needs, rather than for the purpose it's intended for (maybe tell your ICT to read up about what RSS is used for ;o)? I'm pretty sure there was a very similar discussion on this list a while ago. (I'm sure there's a sensible 'middle' solution - can't quite picture what it is right now) Cheers, John From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Andrew Beeken Okay, so the goalposts have shifted on this since talking in more detail with our ICT team! Basically, our repository feeds our staff directory pages in real time using the available feeds; specifically this feed:
http://eprints.lincoln.ac.uk/cgi/exportview/creators/userid/RSS2/userid.xml.
I did question why the RSS2 feed was being used and received the answer that this particular feed formats up a “Description” which can be pulled straight into the staff profiles which are then ordered based on the date on the record. So far, so good, but the
issue at hand is those dates. I initially thought the problem was the format that the dates were coming out in and proposed that we include the records pre-formatted citation in the standard XML feed for them. However, it now transpires that the date on the RSS2 feed is just plain wrong; it’s using the datestamp, when the record was created, rather than the date that the article, book etc was published,
as stored in the date field. For the academics this means that the records on their staff profile are not in publication order. So we come back to the decision – use the standard XML file and add the citation, or change the RSS2 template to use the published
date rather than the created date. ICT would prefer the latter so that they don’t have to change the staff directory code. I’ve been taking a look at the latter an I think I’ve found the chunk in the RSS2 script that deals with the date: my $datestamp = $eprint->get_value( "datestamp" ); if( $datestamp =~ /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/ ) { my $time = timelocal( $6, $5, $4, $3, $2-1, $1 ); $item->appendChild( $session->render_data_element( 2, "pubDate", EPrints::Time::rfc822_datetime( $time ) ) ); } I tried tweaking this to change datestamp to date, however this completely removed the date from the feed. I’m guessing that this is something to do with how the RegEx decides to proceed on the if
statement. So I thought I’d see what happened if I just pushed the date straight into the element which… didn’t work… $item->appendChild( $session->render_data_element( 2, "pubDate", EPrints::Time::rfc822_datetime( $eprint->get_value( "date" ) ) ) ); I’m sure there’s obvious reasons for that which I probably can’t see (I always feel code dyslexic when I look at EPrints source for some reason…) Personally I’d prefer to push the citation in a more
capable feed than RSS2 but I think I’m going to be at the behest of the Staff Directory here. From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of John Salter >
The XML export just exports all the fields on an object Unless that field has export_as_xml => 0, - like the suggestions field does by default… What are you trying to achieve with your export? Personally, I'd suggest subclassing that plugin, and adding a citation to it that way - as always, TMTOWTDI! It depends on how and when you'll be calling the plugin. If it's for active, user-generated requests, Adam's method may be more suitable, as the processing is done when a record is saved, rather than when a record is requested. Cheers, John From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Adam Field Hi Andrew The XML export just exports all the fields on an object. I wouldn’t modify it if I were you. The simplest way would be to add a new field to your item. I’m not sure if virtual fields come out in the XML export, but if they do, adding a virtual field to your object may be the easiest way to do this. Alternatively, use an automatic field and write the
citation to it. See https://wiki.eprints.org/w/Training_Video:Virtual_Fields and
https://wiki.eprints.org/w/Training_Video:Automatic_Fields
-- Adam From:
<eprints-tech-bounces@ecs.soton.ac.uk> on behalf of Andrew Beeken <anbeeken@lincoln.ac.uk> Hi all, Just took a dive into the EPrints XML export template (perl_lib/EPrints/Plugin/Export/XML.pm) to try and add a node for the records citation to it and I can’t see where you would do this? Is
there somewhere separate that defines what data it pulls through? Cheers in advance! Andrew
*** Options:
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
|
- References:
- Re: [EP-tech] Adding items to EP-XML template
- From: Adam Field <adam@adamfield.net>
- Re: [EP-tech] Adding items to EP-XML template
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] Adding items to EP-XML template
- From: Andrew Beeken <anbeeken@lincoln.ac.uk>
- Re: [EP-tech] Adding items to EP-XML template
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] Adding items to EP-XML template
- Prev by Date: Re: [EP-tech] Adding items to EP-XML template
- Next by Date: [EP-tech] Experimental Schema.org support for EPrints
- Previous by thread: Re: [EP-tech] Adding items to EP-XML template
- Next by thread: Re: [EP-tech] Adding items to EP-XML template
- Index(es):