Skip Menu |

This queue is for tickets about the XML-Smart CPAN distribution.

Report information
The Basics
Id: 86801
Status: resolved
Priority: 0/
Queue: XML-Smart

People
Owner: TMHARISH [...] cpan.org
Requestors: tony [...] patchcord.ca
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Fwd: XML::Smart -- importing tabular data
Date: Tue, 9 Jul 2013 07:40:42 -0400
To: bug-xml-smart [...] rt.cpan.org
From: Tony Szaranski <tony [...] patchcord.ca>
Hi Mr. Graciliano / Mr. Madabushi, Please see below message which bounced when I tried to email directly. Thanks, Tony Show quoted text
---------- Forwarded message ---------- From: Tony Szaranski <tony@patchcord.ca> Date: Tue, Jul 9, 2013 at 7:32 AM Subject: XML::Smart -- importing tabular data To: gm@virtuasites.com.br Hi Mr. Graciliano, First off I would like to thank you for a very cool toolkit XML::Smart. I recently ran into an issue trying to convert a semi-large record set (basically tabular data) into XML and wanted to use XML::Smart for initial XML creation and node additions further downstream in the process. The issue I ran into, was I need to emulate the same output as I had previously with XML::Simple, where all the tags are 'nodes'. Basically I was importing a perl hash into XML::Smart, setting the node using set_node() on each tag, and then exporting. I found if I called set_node() on each row/field it was very slow. (1.6.8 and the latest 1.7.7) See attachment (b.pl) ... time to run for 20000 'records' is: # time perl b.pl real 1m30.919s user 1m29.599s sys 0m0.144s If I manually set the nodes on each 'record', it is much faster. # time perl c.pl real 0m27.866s user 0m26.698s sys 0m0.083s My question is, is this likely to change (internals) so my code will break in the future release, or is there a better way to set a default 'everything is a node' prior to creating? Or am I approaching a big load the wrong way? Any advise you can provide would be very helpful. Thank you for your time. Tony -- Tony Szaranski, ITCP Patchcord.ca Inc. W: 705-223-8000 F: 705-233-8001 C: 705-475-6316 --- Making Connections -- Tony Szaranski, ITCP Patchcord.ca Inc. W: 705-223-8000 F: 705-233-8001 C: 705-475-6316 --- Making Connections

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Hi Tony, The fastest way to create this ( that I can think of ) is to use the following when creating the input HASH. Replace: { a=>1, b=>2, c=>3} with: { 'a' => { CONTENT =>1 } , 'b' => { CONTENT =>1 } , 'c' => { CONTENT =>1 } , } Regarding the manual setting of the nodes - Its likely to break a lot of things. Here is why: ( Part of ) The internal structure of xml object with set_node: "row" => [ { "/nodes" => { a => 1, b => 1, c => 1 }, "a" => { CONTENT => 1 }, "b" => { CONTENT => 2 }, "c" => { CONTENT => 3 }, }, ... And with manual update: "row" => [ { "/nodes" => { a => 1, b => 1, c => 1 }, "a" => 1, "b" => 2, "c" => 3 }, ... This will cause a lot of functions including traversing of the tree to break. Hope that helps! Harish
Subject: Re: [rt.cpan.org #86801] Fwd: XML::Smart -- importing tabular data
Date: Tue, 9 Jul 2013 08:27:30 -0400
To: bug-xml-smart <bug-XML-Smart [...] rt.cpan.org>
From: Tony Szaranski <tony [...] patchcord.ca>
Thank you very much! That did the trick. Tony On Tue, Jul 9, 2013 at 8:19 AM, Harish T Madabushi via RT < bug-XML-Smart@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=86801 > > > Hi Tony, > > The fastest way to create this ( that I can think of ) is to use the > following when creating the input HASH. > > Replace: > { a=>1, b=>2, c=>3} > > with: > { > 'a' => { CONTENT =>1 } , > 'b' => { CONTENT =>1 } , > 'c' => { CONTENT =>1 } , > } > > > > Regarding the manual setting of the nodes - Its likely to break a lot of > things. Here is why: > > ( Part of ) The internal structure of xml object with set_node: > > > "row" => [ > { > "/nodes" => { a => 1, b => 1, c => 1 }, > "a" => { CONTENT => 1 }, > "b" => { CONTENT => 2 }, > "c" => { CONTENT => 3 }, > }, > > ... > > > And with manual update: > > "row" => [ > { > "/nodes" => { a => 1, b => 1, c => 1 }, > "a" => 1, > "b" => 2, > "c" => 3 > }, > ... > > > This will cause a lot of functions including traversing of the tree to > break. > > Hope that helps! > > Harish > >
-- Tony Szaranski, ITCP Patchcord.ca Inc. W: 705-223-8000 F: 705-233-8001 C: 705-475-6316 --- Making Connections