You are here:  » Getting higher level nodes more quickly in large files


Getting higher level nodes more quickly in large files

Submitted by WizardTechie on Tue, 2014-07-22 16:09 in

Hi David

Is there anyway I can retrieve the higher nodes attributes more quickly? The following example file is about 50,000 lines.

When using the input string: "xml|TRAININGCENTERDATABASE/ACTIVITIES/ACTIVITY/LAP/TRACK/TRACKPOINT/"
The trackpoint data is retrieved in feasible time, but when trying go access the higher level node attributes e.g.
"xml|TRAININGCENTERDATABASE/ACTIVITIES/ACTIVITY/"
the script becomes extremely slow, and times out on most files. This also happens on your demo server. I don't need all the info in one call as I want to store information in a relational db - is there anyway to skip reading of childnodes, or to specifiy a maximum recursion / node depth or any other way I can get the higher level data faster - especially ACTIVITY and LAP?

Many thanks
Jez

{code saved}

Submitted by support on Tue, 2014-07-22 16:17

Hello Jez, and welcome to the forum!

I have a development version of Magic Parser that provides access to all parent elements of the child node you are parsing against which I will email to you in just a moment.

With this version, you would continue to use the leaf node format string e.g.

xml|TRAININGCENTERDATABASE/ACTIVITIES/ACTIVITY/LAP/TRACK/TRACKPOINT/

...but in the $record array as seen by your myRecordHandler function you will also have access to all parent elements using standard directory notation e.g. ../PARENT/ELEMENT/

Cheers,
David
--
MagicParser.com

Submitted by WizardTechie on Tue, 2014-07-22 17:15

That's fantastic! Just what I needed! Thank you for all your help! And for a speedy response (your reply and your script execution!)! This is going to make my app much better! Thank you!

A great script!

Jez