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: http://forum.world.st/XML-Data-Parsing-tp4459406p4459406.html Sent from the Moose mailing list archive at Nabble.com.
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
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,
On Fri, Mar 9, 2012 at 2:22 PM, Tudor Girba tudor@tudorgirba.com wrote:
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