flex - extracting xml cdata with actionscript 3 -


i have been racking brain trying extract cdata xml no success. here code.

<?xml version="1.0" encoding="utf-8"?> <mx:application xmlns:mx="http://www.adobe.com/2006/mxml"       xmlns:s="library://ns.adobe.com/flex/spark"       creationcomplete="mydata.send();" backgroundcolor="white" >  <mx:httpservice id="mydata" resultformat="e4x" url="./assets/rawxml.xml" result="handleresult1(event)"/> <mx:script><![cdata[     import mx.collections.xmllistcollection;     import mx.rpc.events.*;     [bindable]     private var firstname:string;     [bindable]     private var myxml:xmllist;      private function handleresult1(event:resultevent):void{         myxml = event.result.row;         each(var sitexml:xml in myxml){             firstname = sitexml..sc_df_field_3.text();         }     } ]]> </mx:script>         <mx:textarea text = "{firstname}" height="200" width="800"/> </mx:application> 

here xml;

<?xml version="1.0"?>  <?xml-stylesheet type="text/xsl" href="myfirsttemplate.xsl"?> <viewall>     <recordset_metadata>         <startrec>1</startrec>         <keyfields>true</keyfields>         <endrec>6</endrec>         <totalrec>6</totalrec>         <page_no>1</page_no>         <sort_type>dt_updated</sort_type>         <sort_order>desc</sort_order>         <form_id>414898</form_id>         <report_id></report_id>         <saved_id></saved_id>         <nextsortorder>             <![cdata[&sortorder=desc]]>         </nextsortorder>         <sc_df_xsl_help_url>             <![cdata[http://libraries.ge.com/librarieswiki/2767051101/data%20forms%20-%20customizing%20records%20view]]>         </sc_df_xsl_help_url>         <filter_data>             <![cdata[var advsrchfltrxml_string =  { advsrchfltrdata  : { filter : [ {selelementtype  : '',selelementparentdf  : '',selcomb  : '',exclcheck  : '',selelement  : '',query  : '',query_psrch  : '',includenull  : '',lockfilter  : '',lockfilterflg  : '',datefrom  : '',dateto  : '',betweendaysfrom  : '',betweendaysto  : '',betweendaysfromoption  : '',betweendaystooption  : '',exactdaysoption  : '',exactdays  : '',morethanoption  : '',morethan  : '',numagingquery  : '',betweennumfrom  : '',betweennumto  : '',greaterorlessorequaltonum  : '',datefromformat  : '',datetoformat  : ''} ] },size : 1, hiddenxmlfiltercount :''}]]>         </filter_data>         <filter_fields>             <![cdata[ var arrfields = new array(new array("form_doc_id","entry #","req","","","","",""),new array("logged_by","logged by","psrch","","","","","1"),new array("dt_logged","date logged","dt","","","","",""),new array("last_updated_by","last updated by","psrch","","","","","1"),new array("dt_updated","date updated","dt","","","","",""),new array("el_values_field3","name","t","","","5707420","alpha","0"))]]>         </filter_fields>         <generate_hidden_var>             <![cdata[]]>         </generate_hidden_var>         <hidden_xml_filter_count>             <![cdata[]]>         </hidden_xml_filter_count>         <hidden_filter_remove_number>             <![cdata[]]>         </hidden_filter_remove_number>         <df_link_fields_var>             <![cdata[]]>         </df_link_fields_var>         <sa_upload_flag>             <![cdata[-1]]>         </sa_upload_flag>         <flg_export_pdf_word>0</flg_export_pdf_word>         <flg_disable_bulk_update_append>0</flg_disable_bulk_update_append>         <flg_export_kml>1</flg_export_kml>         <flg_export_to_map>0</flg_export_to_map>         <flgfulltxtsearch>0</flgfulltxtsearch>         <published_flag>0</published_flag>         <str_create_order>402</str_create_order>         <func_create_order>asc</func_create_order>         <form_name>fsr map points</form_name>         <prod_id>267672</prod_id>         <archive_flag>0</archive_flag>         <facilitator_flag>1</facilitator_flag>         <advanced_search_flag>1</advanced_search_flag>         <export_all_flag>1</export_all_flag>         <export_page_flag>0</export_page_flag>         <delete_record_flag>1</delete_record_flag>         <fieldchooser_edit_flag>1</fieldchooser_edit_flag>         <fieldchooser_copy_flag>1</fieldchooser_copy_flag>         <rss_feed>1</rss_feed>         <field_chooser_enable_flag>1</field_chooser_enable_flag>         <archive_all_enable_flag>1</archive_all_enable_flag>         <truncate_text_flag>0</truncate_text_flag>         <called_for></called_for>         <calling_entity_type></calling_entity_type>         <exceluploadflag>true</exceluploadflag>         <viewaudittrail>1</viewaudittrail>         <staticserver>//static.supportcentral.com</staticserver>         <viewers_detail>             <v_sso_id>222222222</v_sso_id>             <v_person_id>1273000</v_person_id>             <v_first_name>geoffrey</v_first_name>             <v_last_name>goodman</v_last_name>             <v_business_segment>power &amp; water</v_business_segment>             <v_focus_group>ge power &amp; water</v_focus_group>             <v_sub_business>pw-wtr water</v_sub_business>             <v_language>english</v_language>             <v_function>services</v_function>         </viewers_detail>     </recordset_metadata>     <dflink_element_details>         <calledforsf display_name="calledforsf" search_field="no">&amp;nbsp</calledforsf>         <source_element_id display_name="source_element_id" search_field="no">&amp;nbsp</source_element_id>         <target_element_id display_name="target_element_id" search_field="no">&amp;nbsp</target_element_id>     </dflink_element_details>     <df_fields>         <sc_sys_df_form_doc_id display_name="entry #" search_field="yes">entry #</sc_sys_df_form_doc_id>         <sc_sys_df_dt_logged display_name="date logged" search_field="yes">logged date</sc_sys_df_dt_logged>         <sc_sys_df_dt_updated display_name="date updated" search_field="yes">last updated date</sc_sys_df_dt_updated>         <sc_sys_df_logged_by display_name="logged by" search_field="yes">logged by</sc_sys_df_logged_by>         <sc_sys_df_last_updated_by display_name="last updated by" search_field="yes">last updated by</sc_sys_df_last_updated_by>         <sc_sys_df_audit_trail_header display_name="audit trail" search_field="yes">audit trail</sc_sys_df_audit_trail_header>         <sc_df_field_3 display_name="name" element_type="t" search_field="yes" inactive_user="0">name</sc_df_field_3>     </df_fields>     <header>         <sc_sys_df_form_doc_id display_name="entry #" search_field="yes">entry #</sc_sys_df_form_doc_id>         <sc_sys_df_dt_logged display_name="date logged" search_field="yes">logged date</sc_sys_df_dt_logged>         <sc_sys_df_dt_updated display_name="date updated" search_field="yes">last updated date</sc_sys_df_dt_updated>         <sc_sys_df_logged_by display_name="logged by" search_field="yes">logged by</sc_sys_df_logged_by>         <sc_sys_df_last_updated_by display_name="last updated by" search_field="yes">last updated by</sc_sys_df_last_updated_by>         <sc_sys_df_audit_trail display_name="audit trail" search_field="yes">audit trail</sc_sys_df_audit_trail>         <sc_df_field_1 display_name="menu l1" element_type="t" search_field="no">menu l1</sc_df_field_1>         <sc_df_field_2 display_name="menu l2" element_type="t" search_field="no">menu l2</sc_df_field_2>         <sc_df_field_3 display_name="name" element_type="t" search_field="yes">name</sc_df_field_3>         <sc_df_field_4 display_name="information" element_type="t" search_field="no">information</sc_df_field_4>         <sc_df_field_5 display_name="city, state" element_type="t" search_field="no">city, state</sc_df_field_5>         <sc_df_field_6 display_name="latitude" element_type="t" search_field="no">latitude</sc_df_field_6>         <sc_df_field_7 display_name="longitude" element_type="t" search_field="no">longitude</sc_df_field_7>     </header>     <row edit_access="1">         <sc_sys_df_form_doc_id_action display_name="entry # actions">             <![cdata[6193418162]]>         </sc_sys_df_form_doc_id_action>         <sc_sys_df_form_doc_id display_name="entry #">             <![cdata[6193418162]]>             <entry_view_url display_name="view entry url">                 <![cdata[http://supportcentral.com/dataforms/sup_dataform_display.asp?dataform_id=414898&dataform_doc_id=6193418162]]>             </entry_view_url>         </sc_sys_df_form_doc_id>         <sc_sys_df_dt_logged display_name="date logged">             <![cdata[4/4/2013 9:27:46 am]]>         </sc_sys_df_dt_logged>         <sc_sys_df_dt_updated display_name="date updated">             <![cdata[4/4/2013 9:27:46 am]]>         </sc_sys_df_dt_updated>         <sc_sys_df_logged_by display_name="logged by">             <![cdata[&nbsp]]>             <person>                 <sc_df_person_link display_name="profile url">                     <![cdata[../common/sup_persondtls.asp?p_id=2348753]]>                 </sc_df_person_link>                 <sc_df_sso display_name="">                     <![cdata[218010000]]>                 </sc_df_sso>                 <sc_df_email display_name="email">                     <![cdata[joseph.ulo@go.com]]>                 </sc_df_email>                 <sc_df_first_name display_name="first name">                     <![cdata[joseph]]>                 </sc_df_first_name>                 <sc_df_last_name display_name="last name">                     <![cdata[ulo]]>                 </sc_df_last_name>             </person>             <person_string>                 <person_string_var display_name="person person person">                     <![cdata[var person_string = {person : [ {person_id  : '../common/sup_persondtls.asp?p_id=2348753',first_name  : 'joseph',last_name:'ulo'}], size : 1 }]]>                 </person_string_var>             </person_string>         </sc_sys_df_logged_by>         <sc_sys_df_last_updated_by display_name="last updated by">             <![cdata[&nbsp]]>             <person>                 <sc_df_person_link display_name="profile url">                     <![cdata[../common/sup_persondtls.asp?p_id=2348753]]>                 </sc_df_person_link>                 <sc_df_sso display_name="">                     <![cdata[218010000]]>                 </sc_df_sso>                 <sc_df_email display_name="email">                     <![cdata[joseph.ulo@go.com]]>                 </sc_df_email>                 <sc_df_first_name display_name="first name">                     <![cdata[joseph]]>                 </sc_df_first_name>                 <sc_df_last_name display_name="last name">                     <![cdata[ulo]]>                 </sc_df_last_name>             </person>             <person_string>                 <person_string_var display_name="person person person">                     <![cdata[var person_string = {person : [ {person_id  : '../common/sup_persondtls.asp?p_id=2348753',first_name  : 'joseph',last_name:'ulo'}], size : 1 }]]>                 </person_string_var>             </person_string>         </sc_sys_df_last_updated_by>         <sc_sys_df_audit_trail display_name="audit trail">             <![cdata[<a href="../caseforms/complete_audit_trail.asp?calling_entity_id=414898&form_doc_id=6193418162&pageno=0&audittype=0&callingentity=4" target="_none">audit trail</a>]]>         </sc_sys_df_audit_trail>         <sc_df_field_1 display_name="menu l1" element_type="t" data_type="alpha">             <![cdata[fsr]]>         </sc_df_field_1>         <sc_df_field_2 display_name="menu l2" element_type="t" data_type="alpha">             <![cdata[mobile man]]>         </sc_df_field_2>         <sc_df_field_3 display_name="name" element_type="t" data_type="alpha">             <![cdata[ulo, joseph]]>         </sc_df_field_3>         <sc_df_field_4 display_name="information" element_type="t" data_type="alpha">             <![cdata[northeast territory]]>         </sc_df_field_4>         <sc_df_field_5 display_name="city, state" element_type="t" data_type="alpha">             <![cdata[virginia beach, va]]>         </sc_df_field_5>         <sc_df_field_6 display_name="latitude" element_type="t" data_type="alpha">             <![cdata[-75.977976563656]]>         </sc_df_field_6>         <sc_df_field_7 display_name="longitude" element_type="t" data_type="alpha">             <![cdata[36.852930519206]]>         </sc_df_field_7>     </row>     <row edit_access="1">         <sc_sys_df_form_doc_id_action display_name="entry # actions">             <![cdata[6193418164]]>         </sc_sys_df_form_doc_id_action>         <sc_sys_df_form_doc_id display_name="entry #">             <![cdata[6193418164]]>             <entry_view_url display_name="view entry url">                 <![cdata[http://supportcentral.com/dataforms/sup_dataform_display.asp?dataform_id=414898&dataform_doc_id=6193418164]]>             </entry_view_url>         </sc_sys_df_form_doc_id>         <sc_sys_df_dt_logged display_name="date logged">             <![cdata[4/4/2013 9:27:46 am]]>         </sc_sys_df_dt_logged>         <sc_sys_df_dt_updated display_name="date updated">             <![cdata[4/4/2013 9:27:46 am]]>         </sc_sys_df_dt_updated>         <sc_sys_df_logged_by display_name="logged by">             <![cdata[&nbsp]]>             <person>                 <sc_df_person_link display_name="profile url">                     <![cdata[../common/sup_persondtls.asp?p_id=3282603]]>                 </sc_df_person_link>                 <sc_df_sso display_name="">                     <![cdata[2180200000]]>                 </sc_df_sso>                 <sc_df_email display_name="email">                     <![cdata[kevin.woodsman@go.com]]>                 </sc_df_email>                 <sc_df_first_name display_name="first name">                     <![cdata[kevin]]>                 </sc_df_first_name>                 <sc_df_last_name display_name="last name">                     <![cdata[woodsman]]>                 </sc_df_last_name>             </person>             <person_string>                 <person_string_var display_name="person person person">                     <![cdata[var person_string = {person : [ {person_id  : '../common/sup_persondtls.asp?p_id=3282603',first_name  : 'kevin',last_name:'woodsman'}], size : 1 }]]>                 </person_string_var>             </person_string>         </sc_sys_df_logged_by>         <sc_sys_df_last_updated_by display_name="last updated by">             <![cdata[&nbsp]]>             <person>                 <sc_df_person_link display_name="profile url">                     <![cdata[../common/sup_persondtls.asp?p_id=3282603]]>                 </sc_df_person_link>                 <sc_df_sso display_name="">                     <![cdata[218020000]]>                 </sc_df_sso>                 <sc_df_email display_name="email">                     <![cdata[kevin.woodsman@go.com]]>                 </sc_df_email>                 <sc_df_first_name display_name="first name">                     <![cdata[kevin]]>                 </sc_df_first_name>                 <sc_df_last_name display_name="last name">                     <![cdata[woodsman]]>                 </sc_df_last_name>             </person>             <person_string>                 <person_string_var display_name="person person person">                     <![cdata[var person_string = {person : [ {person_id  : '../common/sup_persondtls.asp?p_id=3282603',first_name  : 'kevin',last_name:'woodsman'}], size : 1 }]]>                 </person_string_var>             </person_string>         </sc_sys_df_last_updated_by>         <sc_sys_df_audit_trail display_name="audit trail">             <![cdata[<a href="../caseforms/complete_audit_trail.asp?calling_entity_id=414898&form_doc_id=6193418164&pageno=0&audittype=0&callingentity=4" target="_none">audit trail</a>]]>         </sc_sys_df_audit_trail>         <sc_df_field_1 display_name="menu l1" element_type="t" data_type="alpha">             <![cdata[fsr]]>         </sc_df_field_1>         <sc_df_field_2 display_name="menu l2" element_type="t" data_type="alpha">             <![cdata[mobile man]]>         </sc_df_field_2>         <sc_df_field_3 display_name="name" element_type="t" data_type="alpha">             <![cdata[woodsman, kevin]]>         </sc_df_field_3>         <sc_df_field_4 display_name="information" element_type="t" data_type="alpha">             <![cdata[northeast territory]]>         </sc_df_field_4>         <sc_df_field_5 display_name="city, state" element_type="t" data_type="alpha">             <![cdata[manchester, nh]]>         </sc_df_field_5>         <sc_df_field_6 display_name="latitude" element_type="t" data_type="alpha">             <![cdata[-71.454786492200]]>         </sc_df_field_6>         <sc_df_field_7 display_name="longitude" element_type="t" data_type="alpha">             <![cdata[42.995647573539]]>         </sc_df_field_7>     </row>  </viewall> 

any suggestions on how sc_df_field_3 field increment? no matter try last name (woodsman, kevin) appear. im pretty sure overwriting fistname variable in each loop im not sure how change it. appraciated!

assuming want shows names in textarea component, , asumming code works.

if want show this:

ulo joseph woodsman kevin 

maybe useful:

<?xml version="1.0" encoding="utf-8"?> <mx:application xmlns:mx="http://www.adobe.com/2006/mxml"        xmlns:s="library://ns.adobe.com/flex/spark"       creationcomplete="mydata.send();" backgroundcolor="white" >  <mx:httpservice id="mydata" resultformat="e4x" url="./assets/rawxml.xml" result="handleresult1(event)"/> <mx:script><![cdata[       import mx.collections.xmllistcollection;     import mx.rpc.events.*;      private var names:string;     [bindable]     private var myxml:xmllist;      private function handleresult1(event:resultevent):void{         myxml = event.result.row;         names= "";          each(var sitexml:xml in myxml){             names= names + '-' + sitexml..sc_df_field_3.text();         }         txtarea.text = names;     } ]]> </mx:script>          <mx:textarea id="txtarea" height="200" width="800" /> </mx:application> 

try , tell me f worked.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -