[flexcoders] Re: XML Parsing - maintaining a record pointer
well, this is a sequential file, output from a mainframe and basically I need to start at the top and work my way to the bottom, with frequent look-aheads. I have been trying hard to use e4x but so far have not been successful with getting it to work. apparently there is something about the syntax I am not getting. That cursor idea another poster mentioned sounds intriguing... --- In flexcoders@yahoogroups.com, Tracy Spratt tspr...@... wrote: I would suggest that you do not think in terms of reading the file. Rather, use e4x to find the node you want to process, then go from there. OTOH, it is acceptable to manipulate an XMLList, especially if your data is a single level. Tracy Spratt Lariat Services Flex development bandwidth available From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Sam Lai Sent: Friday, February 20, 2009 4:12 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] XML Parsing - maintaining a record pointer You could use a different variable name in the inner loop, that way it won't change the object in the outer loop. On 2/21/09, Libby libbychan...@... mailto:libbychantel%40yahoo.com wrote: hi, flexCoders! thanks for all ur help in the past! Does Flex maintain your record pointer while reading an xml file? basically what i want to do is read each line and when I hit certain values, read on for 4 or 5 records, then return to the original process without starting back at the last record read at the first read. I can do this the hard way of course by maintaining my own pointer and treating the file as a giant array, but surely there is an easier way? for each (var xmlNode:XML in xml.children()) { // do stuff // if(xmlNode.something==aValue) { for each (var xmlNode:XML read on into the file thanks, Libby -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf- 1e62079f6847 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf -1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo ! Groups Links
RE: [flexcoders] Re: XML Parsing - maintaining a record pointer
Both XMLList and XMLListCollection can be accessed by index. Tracy From: flexcoders@yahoogroups.com on behalf of Libby Sent: Tue 2/24/2009 10:07 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: XML Parsing - maintaining a record pointer well, this is a sequential file, output from a mainframe and basically I need to start at the top and work my way to the bottom, with frequent look-aheads. I have been trying hard to use e4x but so far have not been successful with getting it to work. apparently there is something about the syntax I am not getting. That cursor idea another poster mentioned sounds intriguing... --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tspr...@... wrote: I would suggest that you do not think in terms of reading the file. Rather, use e4x to find the node you want to process, then go from there. OTOH, it is acceptable to manipulate an XMLList, especially if your data is a single level. Tracy Spratt Lariat Services Flex development bandwidth available From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Sam Lai Sent: Friday, February 20, 2009 4:12 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: Re: [flexcoders] XML Parsing - maintaining a record pointer You could use a different variable name in the inner loop, that way it won't change the object in the outer loop. On 2/21/09, Libby libbychan...@... mailto:libbychantel%40yahoo.com wrote: hi, flexCoders! thanks for all ur help in the past! Does Flex maintain your record pointer while reading an xml file? basically what i want to do is read each line and when I hit certain values, read on for 4 or 5 records, then return to the original process without starting back at the last record read at the first read. I can do this the hard way of course by maintaining my own pointer and treating the file as a giant array, but surely there is an easier way? for each (var xmlNode:XML in xml.children()) { // do stuff // if(xmlNode.something==aValue) { for each (var xmlNode:XML read on into the file thanks, Libby -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf- https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf- 1e62079f6847 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf -1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo ! Groups Links winmail.dat
[flexcoders] Re: XML Parsing - maintaining a record pointer
Another idea would be to put your data into an XMLListCollection, get a view cursor to the list with createCursor(). Now you can use the the view cursor to iterate over your XMLListCollection and use the cursor's bookmark property to remember your position when necessary. Probably more work than necessary for a simple scenario... in which case try and follow Tracy's advice to just do it w/e4x. Sunil --- In flexcoders@yahoogroups.com, Libby libbychan...@... wrote: hi, flexCoders! thanks for all ur help in the past! Does Flex maintain your record pointer while reading an xml file? basically what i want to do is read each line and when I hit certain values, read on for 4 or 5 records, then return to the original process without starting back at the last record read at the first read. I can do this the hard way of course by maintaining my own pointer and treating the file as a giant array, but surely there is an easier way? for each (var xmlNode:XML in xml.children()) { // do stuff // if(xmlNode.something==aValue) { for each (var xmlNode:XML read on into the file thanks, Libby