Print

Print


What i am trying to achieve is to make a model out of this XML, a simpler one, since i am facing problems how to index make a query and retrieve results to such a complex syntax,

any suggestions?




________________________________
 Απο: Marc Chantreux <[log in to unmask]>
Προς: [log in to unmask] 
Στάλθηκε: 11:59 π.μ. Τρίτη, 24 Σεπτεμβρίου 2013
Θέμα: Re: [CODE4LIB] Σχετ: [CODE4LIB] Perl module to transform XSL to JSON
 

On Tue, Sep 24, 2013 at 09:29:58AM +0100, dasos ili wrote:
>    for storage in mongodb and elasticsearch

then don't convert anything and just store the xml content as a value:
( less code, less transformation, less computation so more speed and
more reliability)

use IO::All;
use MongoDB;

my $xml = io('file.xsl')->all; 
my $client = MongoDB::MongoClient->new
   ( host => 'localhost'
   , port => 27017 );
my $database   = $client->get_database( 'foo' );
my $collection = $database->get_collection( 'bar' );
my $id         = $collection->insert({ transformation => $xml });

HTH




-- 
Marc Chantreux
Université de Strasbourg, Direction Informatique
14 Rue René Descartes,
67084  STRASBOURG CEDEX
☎: 03.68.85.57.40
http://unistra.fr
"Don't believe everything you read on the Internet"
    -- Abraham Lincoln