Hello, you can try:
...
stream := StandardFileStream readOnlyFileNamed: aPath.
root := (XMLDOMParser parse: stream) root.
...
in addition you can read from a url:
...
stream := HTTPClient httpGet: 'http://rss.cnn.com/rss/edition_world.rss'.
root := (XMLDOMParser parse: stream) root.
...
regards,
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.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?
Cheers,
Doru
2012/3/9 Júlio Martins <jleandro.martins@gmail.com>:
> _______________________________________________> 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
> Moose-dev@iam.unibe.ch
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
--
www.tudorgirba.com
"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev