RE: [flexcoders] xml parsing
The double colon is the namespace accessor. But I do not really understand that example. Unless you can use a wildcard as a namespace? I have managed to mostly avoid dealing with namespaces so far. Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of luvfotography Sent: Monday, March 15, 2010 8:06 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] xml parsing What does '*::' do in the following example: (can someone explain how this works, where aspectRatios ends up with 'widescreen') var aspectRatios:XMLList = atomXml..*::aspectRatio; where atomxml = ?xml version=1.0 encoding=utf-16? entry gd:etag=W/quot;C0QCQ347eCp7ImA9WxBbFkk.quot; xmlns=http://www.w3. http://www.w3.org/2005/Atom org/2005/Atom xmlns:media=http://search. http://search.yahoo.com/mrss/ yahoo.com/mrss/ xmlns:gd=http://schemas. http://schemas.google.com/g/2005 google.com/g/2005 xmlns:yt=http://gdata. http://gdata.youtube.com/schemas/2007 youtube.com/schemas/2007 idtag:youtube.com,2008:video:yNq5vC_EHAg/id published2009-03-17T07:44:54.000Z/published yt:accessControl action=syndicate permission=allowed / gd:comments gd:feedLink href=http://gdata. http://gdata.youtube.com/feeds/api/videos/yNq5vC_EHAg/comments?v=2 youtube.com/feeds/api/videos/yNq5vC_EHAg/comments?v=2 countHint=1031 / /gd:comments media:group yt:aspectRatiowidescreen/yt:aspectRatio yt:duration seconds=232 / yt:uploaded2009-03-17T07:44:54.000Z/yt:uploaded yt:videoidyNq5vC_EHAg/yt:videoid /media:group gd:rating average=4.794872 max=5 min=1 numRaters=3159 rel=http://schemas. http://schemas.google.com/g/2005#overall google.com/g/2005#overall / yt:statistics favoriteCount=9429 viewCount=4563767 / /entry
[flexcoders] xml parsing
What does '*::' do in the following example: (can someone explain how this works, where aspectRatios ends up with 'widescreen') var aspectRatios:XMLList = atomXml..*::aspectRatio; where atomxml = ?xml version=1.0 encoding=utf-16? entry gd:etag=W/quot;C0QCQ347eCp7ImA9WxBbFkk.quot; xmlns=http://www.w3.org/2005/Atom; xmlns:media=http://search.yahoo.com/mrss/; xmlns:gd=http://schemas.google.com/g/2005; xmlns:yt=http://gdata.youtube.com/schemas/2007; idtag:youtube.com,2008:video:yNq5vC_EHAg/id published2009-03-17T07:44:54.000Z/published yt:accessControl action=syndicate permission=allowed / gd:comments gd:feedLink href=http://gdata.youtube.com/feeds/api/videos/yNq5vC_EHAg/comments?v=2; countHint=1031 / /gd:comments media:group yt:aspectRatiowidescreen/yt:aspectRatio yt:duration seconds=232 / yt:uploaded2009-03-17T07:44:54.000Z/yt:uploaded yt:videoidyNq5vC_EHAg/yt:videoid /media:group gd:rating average=4.794872 max=5 min=1 numRaters=3159 rel=http://schemas.google.com/g/2005#overall; / yt:statistics favoriteCount=9429 viewCount=4563767 / /entry
[flexcoders] XML Parsing Questions
Hi all, I'm working with httpservice and a rich text area. I pull in the xml via httpservice, then parse out all xml tags. However, dependent on the XML I need to do various things, such as if the text is in an boldMe tag, then make it bold; if it's in an italicizeMe tag, then I'll italicize it, then display it, correctly formatted, in the RTE. Questions: 1) I need to have the P tags create new lines. Not sure how to do that without kludgy regular expressions. That can't be the best way. Can it? :) 2) I want to keep the whitespace, but as you'll see that isn't happening. Thanks, David *** Code: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; width=900 height=800 initialize=initializeHandler(); mx:Script ![CDATA[ import mx.rpc.events.ResultEvent; import flash.text.TextFormat; [Bindable] public var xData:XML; private function initializeHandler():void { bt.send(); } private function btRPCResult(event:ResultEvent):void { xData = event.result as XML; xData.ignoreWhitespace = false; } private function showTest():void { outField.text = ; for each (var item:XML in xData.Content.P.*) { //here's where I want to conditionally act upon the text of boldMe, italicizeMe, etc. outField.text += item; } } ]] /mx:Script mx:HTTPService id=bt url=test.xml result=btRPCResult(event) resultFormat=e4x/ !-- User interface -- mx:ApplicationControlBar dock=true mx:Button label=Show Test Story click=showTest() / /mx:ApplicationControlBar mx:TextArea id=outField width=100% height=100% text={xData.toString()} / /mx:Application test.xml: Text Content P The quick boldMebrown/boldmMe italicizeMefox/italicizeMe jumps over the boldMelazy/boldMe dog. /P P Now is the time for all boldMegood/boldMe men to come to the aid of their italicizeMecountry/italicizeMe. /P /Content /Text
[flexcoders] XML Parsing - maintaining a record pointer
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
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...@yahoo.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 Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
RE: [flexcoders] XML Parsing - maintaining a record pointer
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...@yahoo.com 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] XML Parsing
I assume its something like this: foo attr=barbaz/foo I thought we had dealt with this but it might be a known issue. Try tracing foo[attr] and foo.toString() and see if you get the values. Otherwise youll need to adjust your XML. Matt From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Clint Modien Sent: Friday, August 19, 2005 12:31 PM To: [EMAIL PROTECTED] Subject: Re: [flexcoders] XML Parsing Do you have a quick example you could post? On 8/19/05, Kevin Towes (New Toronto Group) [EMAIL PROTECTED] wrote: Has anyone run into an issue when parsing an XML file in FLEX? When the automatic parser parses an XML file, and there is an attribute in the node, the value between the XML tags is not parsed when it is converted into an AS object. Any help would be great! Kev. Kevin Towes, Sr. Consultant New Toronto Group, [EMAIL PROTECTED] Office: 905-897-7790 x4018 Mobile: 416-882-4445 [onRemote] -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Computer software testing Macromedia flex Development Software developer YAHOO! GROUPS LINKS Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] XML Parsing
Do you have a quick example you could post? On 8/19/05, Kevin Towes (New Toronto Group) [EMAIL PROTECTED] wrote: Has anyone run into an issue when parsing an XML file in FLEX? When the automatic parser parses an XML file, and there is an attribute in the node, the value between the XML tags is not parsed when it is converted into an AS object. Any help would be great!Kev.Kevin Towes, Sr. ConsultantNew Toronto Group, [EMAIL PROTECTED] Office: 905-897-7790 x4018 Mobile: 416-882-4445[onRemote] --Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Computer software testing Macromedia flex Development Software developer YAHOO! GROUPS LINKS Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Computer software testing Macromedia flex Development Software developer YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.