Re: Converting XML to MARC without reading a file?

2018-04-22 Thread David Cook
The downside of that is that you would be parsing your XML twice though. Once with XML::Twig and once with MARC::File::XML. That said, if you have a huge result set, it would probably be better (or even necessary) to use XML::Twig::parseurl() or roll your own using LWP with callbacks and a pull p

Re: Converting XML to MARC without reading a file?

2018-04-19 Thread David Cook
I was thinking the same thing because that's what we do in Koha, but I think Andy is getting back more than 1 XML record per HTTP request so I don't think that will work. That said he could use a XML streaming parser and LWP with callbacks and then pass each individual record to new_from_xml. O

Re: Converting XML to MARC without reading a file?

2018-04-18 Thread David Cook
I'm glad that I was able to help! I had wondered if you were going to run into encoding issues, and I had thought about warning you... but I figured that was a different piece of the puzzle. So far, I've actually only written to in-memory file handles (my example above was the first time reading f

Re: Converting XML to MARC without reading a file?

2018-04-18 Thread David Cook
dards/marcxml/schema/MARC21slim.xsd"; xmlns="http://www.loc.gov/MARC21/slim";> 00898nam a2200265 a 4500 Test 2 On Thu, Apr 19, 2018 at 10:44 AM, David Cook wrote: > Hey Andy, > > That does sound like an annoying problem. Someone else might have a bet

Re: Converting XML to MARC without reading a file?

2018-04-18 Thread David Cook
Hey Andy, That does sound like an annoying problem. Someone else might have a better answer, but I think I have a clever solution... Instead of using MARC::File::XML directly, you can use MARC::Batch instead: my $batch = MARC::Batch->new( 'XML', $filename ); According to the MARC::Batch documen

Re: Options for translating languages within perl scripts

2015-02-27 Thread David Cook
Personally, I wouldn't recommend automatic translations, since they're very prone to errors. However, as a French/English speaker, I'd suggest Reverso ( http://localize.reverso.net/Default.aspx?lang=en). I haven't used their API, but it's an excellent service. Its translation engine is the best I'