Hi,

You can probably save time and memory by directly passing the file
stream to the XMLParser:
stream := (FileStream readOnlyFileNamed: aFilenameString) readStream.
root := (XMLDOMParser  parse: stream) root.

I follow your suggestion Tudor, but it didn't reduce the total time expended on reading of data or the reduction was minimal.
 
A question: if you do you have a problem with the reading part (I mean
to compute the root), or is it spent in the follow up loops?

I not understood well your question. I got to compute almost everything that I needed, but for some reason, some data are lost when I iterate on root. Is about it your question?



Cheers,
Doru



2012/3/9 Júlio Martins <[hidden email]>:
> HI!
>
> I have a optimization problem to solve and I would want some hint of you.
>
> I am using the xml framework to work with data from xml file, and the
> reading of the data is consuming much time.
> In my code I do something as:
>
> | stream root |
>
> stream := (FileStream readOnlyFileNamed: aPath) contentsOfEntireFile
> asString..
> root := (XMLDOMParser  parse: stream) root.
>
> root allElementsNamed: 'something' do:[ :eachB|
>          eachB attributeNodes attributeValueAt: 'list'
>          ...
>          eachB allElementsNamed: 'another something' do:{ :eachD|
>            .  eachD attributeNodes attributeValueAt: 'element'
>               ..
>         ]
> ]
>
> I know such iteration like that take much time to be executed when the file
> read is big. There is a another manner to read the data from xml file that
> consume less time as possible? Or have someone an idea to improve this code?
>
> Julio
>
> ________________________________
> View this message in context: XML Data Parsing
> Sent from the Moose mailing list archive at Nabble.com.
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>



--
www.tudorgirba.com

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



View this message in context: XML Data Parsing
Sent from the Moose mailing list archive at Nabble.com.